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
Section titled “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 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 metrics (opt-in)
Section titled “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
Section titled “Reasoning effort”| Header | Description |
|---|---|
X-Reasoning-Effort | The 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.
Rate limiting
Section titled “Rate limiting”See Rate Limits for the full set of rate-limit headers.
Streaming
Section titled “Streaming”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.