Skip to main content
The gateway adds x-bifrost-* headers to every inference response. They say which provider, model and key handled the request, whether a fallback served it, and how long the provider took. The same facts are in the response body’s extra_fields, but the drop-in SDK routes (Anthropic, GenAI, Bedrock, Cohere) return the provider’s own response shape with no extra_fields, so the headers are the only place to read them there. The headers to send with a request, such as x-bf-vk, x-bf-api-key-id, x-bf-direct-key and x-bf-session-id, are covered in Request Options.

Correlation

Sent on every inference response, including errors and requests refused before routing. See Correlation response headers for how to use them with your log store.

Routing

Sent on success and on errors, by /v1 and the drop-in routes alike, streams included. A header is left out when it has no value, and a true/false header is sent only when it is true. On an error, the headers describe the attempt whose error was returned. A request refused before routing, for example by governance, carries only the correlation headers, x-bifrost-request-type and the legacy headers below. x-bifrost-provider, x-bifrost-original-model and x-bifrost-resolved-model are still sent for older clients. They mirror the deprecated extra_fields.provider, original_model_requested and resolved_model_used fields; use the routing-info headers instead.
On a stream the headers are written before the first chunk. x-bifrost-upstream-latency-ms then covers only the time until the stream opened, and server-side-fallback-model is never sent.On /v1 error responses, x-bifrost-fallback-index and x-bifrost-upstream-latency-ms are not sent; the drop-in routes send both.

Cache

When semantic caching looks a request up, the response carries x-bifrost-cache-* headers: whether it was a hit, the hit type, the similarity and the cache entry. See its response headers for the full list.

Things to know

  • Provider headers. A provider’s own response headers are forwarded to the caller, except any x-bifrost-* header, so an upstream Bifrost gateway can never overwrite this gateway’s values. The provider’s values are kept in extra_fields.provider_response_headers.
  • Browsers. Bifrost does not list these headers in Access-Control-Expose-Headers, so JavaScript in a browser calling the gateway from another origin cannot read them. Read them server side, or from the response body’s extra_fields.
  • Plugins. A plugin’s HTTP transport hook can change or remove any of these headers before the response is sent.