# Response Headers

Source: https://aiand-docs-staging.pages.dev/reference/response-headers/

ai& exposes request metadata through HTTP headers rather than modifying the OpenAI- or Anthropic-shaped response body. This preserves wire-format compatibility with the official SDKs.

## Identity & tracing

| Header         | Description                                                                                                                                                                                                                                                                                                                                         |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `X-Request-ID` | Unique ID for this request on traced API routes (inference, auth, billing, and files). Include it in support tickets.                                                                                                                                                                                                                               |
| `traceparent`  | [OpenTelemetry trace context](https://opentelemetry.io/docs/concepts/context-propagation/) header. On traced inference routes and auth/files/billing HTTP requests, ai& accepts an incoming value or starts a new trace, propagates it downstream where applicable, and returns the server's trace context so you can correlate distributed traces. |
| `X-Model`      | The model that served the request, as its lowercased catalog name. This is the resolved name, so it can differ in casing from what you sent — and with the reserved `auto` name it is the only place the chosen model is reported. Compare it case-insensitively.                                                                      |

<Aside type="note">
  The current request telemetry wrapper covers inference generation/catalog/analytics/logs routes
  and all HTTP requests in auth, files, and billing. Worker-admin, worker-notifications, and
  worker-openapi are not currently wrapped.
</Aside>

## Cost metrics (opt-in)

Cost and timing headers are **not** sent by default. To receive them, send the request header `X-Aiand-Metrics: true`. They are emitted on non-streaming responses only:

| Header            | Description                                                            |
| ----------------- | ---------------------------------------------------------------------- |
| `X-Cost`          | Cost of this request in your billing currency.                         |
| `X-Cost-Currency` | The currency `X-Cost` is denominated in (`usd` or `jpy`).              |
| `X-Inference-Ms`  | Time the upstream model spent producing the response, in milliseconds. |

Token counts are not exposed as headers — read the `usage` block in the response body.

## Reasoning effort

| Header               | Description                                                                                                                                                                                                                           |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `X-Reasoning-Effort` | The effort level actually applied, on requests that asked for one — `reasoning_effort` on `/v1/chat/completions` and `/v1/messages`, `reasoning.effort` on `/v1/responses`. On [`/v1/messages`](/api/messages/) a named reasoning model treats `thinking: { "type": "disabled" }` as asking, and reports `none`. The reserved [`auto`](/models/auto/) model ignores that block, so the header is absent. Always one of the model's published levels. Absent if you didn't ask — the model's own default then applies, and we don't substitute one for you. |

A level a model doesn't list — see [`reasoning_efforts`](/models/catalog/) — runs at the next listed level up, or the model's highest if none is above it. This header then differs from what you sent, and the reasoning tokens you are billed for are the applied level's, which can cost more than the one you asked for. `none` is never rounded: on a model that doesn't list it the request is a 400, as is a value outside the effort vocabulary.

## Rate limiting

See [Rate Limits](/reference/rate-limits/) for the full set of rate-limit headers.

## Streaming

Streaming responses carry `X-Request-ID` and the rate-limit headers immediately but never carry cost headers. With `X-Aiand-Metrics: true`, chat-completion streams append a trailing `event: metrics` SSE event with tokens, cost, and currency after the model's terminal message. See [Streaming Events](/reference/streaming-events/).

<Aside type="note">
  For streaming requests, read the trailer event — don't try to parse cost from headers, which are
  sent before the body completes.
</Aside>
