Skip to content

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.

HeaderDescription
X-Request-IDUnique ID for this request on traced API routes (inference, auth, billing, and files). Include it in support tickets.
traceparentOpenTelemetry trace context 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.

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:

HeaderDescription
X-CostCost of this request in your billing currency.
X-Cost-CurrencyThe currency X-Cost is denominated in (usd or jpy).
X-Inference-MsTime the upstream model spent producing the response, in milliseconds.

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

HeaderDescription
X-Reasoning-EffortThe effort level actually applied, on requests that sent a reasoning_effort. Always one of the model’s published levels. Absent if you didn’t send one — the model’s own default then applies, and we don’t substitute one for you.

Sending an effort a model doesn’t support is normally a 400 naming the values it takes — see reasoning_efforts per model. A few models are configured to fall back to a supported level instead; there this header differs from what you sent, and the reasoning tokens you are billed for are the applied level’s, not the requested one’s. Compare it against your request if that distinction matters to you.

See Rate Limits for the full set of rate-limit headers.

Streaming responses carry X-Request-ID 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.