Skip to main content
API Reference: POST /responses

Provider capabilities

The table below summarizes gateway support for this endpoint by provider.
Legend:
  • Supported by provider and TrueFoundry
  • Provided by provider, but not by TrueFoundry
  • Provider does not support this feature
For every gateway endpoint and provider, see Supported APIs. This guide explains how to use the OpenAI client to interact with TrueFoundry’s responses endpoint for making inference requests. Any provider marked supported above serves this endpoint natively — the request is forwarded as-is rather than translated into a chat completion.
On Databricks, native support covers the databricks-gpt-5* foundation model endpoints. Other Databricks endpoints accept /responses but are translated into a chat completion — see Databricks Responses API.
The AI Gateway also uses the Responses API in the opposite direction, serving some Chat Completions requests through it upstream — see Chat completions served through the Responses API below.

Authentication

You’ll need a TrueFoundry API key to authenticate your requests. You can find authentication details from here. You’ll also need to set the x-tfy-provider-name header to the name of the provider integration you’re using. For example, if you’re using a provider integration named my-openai-provider, you’ll set the x-tfy-provider-name header to my-openai-provider.

Text Completion

To get a text completion response:

Image Inputs

For tasks involving images:

Exprected Response

Managing Responses

Retrieve Response

Retrieve a response by id.

Expected Output

Delete Response

Delete a response permanently
Retrieve and delete are only available for providers that store responses server-side. Providers with a stateless Responses API — OpenRouter, for example — do not expose them.

Chat completions served through the Responses API

Everything above covers requests you send to /responses. The AI Gateway also uses the Responses API in the other direction: a Chat Completions request to OpenAI or Azure OpenAI can be served through the provider’s Responses API upstream and converted back before it reaches you. This exists because OpenAI exposes a model’s reasoning only through its Responses API — a plain Chat Completions call to gpt-5.x cannot return it. Your client stays on the Chat Completions contract, so your code does not change. Provided the model supports the Responses API, any one of these turns it on: That last row is worth calling out: responses-only models used to be rejected on /chat/completions. They now work, so you can reach them through the same OpenAI SDK client as every other model. The model’s thinking comes back as message.thinking_blocks, alongside a plain-text message.reasoning_content summary. Replay the assistant message unchanged on the next turn to continue the reasoning chain.
Backend pinning does not apply on this path. Unlike /responses, a Chat Completions request that replays thinking_blocks to a virtual model is load-balanced normally, so the replay can land on a different backend than the one that produced the reasoning — and that backend will reject the ciphertext. Point reasoning traffic at a single model, or use /responses, if you need the reasoning chain preserved across turns.
Some Chat Completions parameters have no Responses equivalent — including stop, seed, logprobs, and the sampling penalties — and are dropped when a request is served this way. Azure OpenAI also requires an api-version of 2025-03-01-preview or newer.
For the full behaviour — the response shape, multi-turn replay, the complete list of dropped parameters, and the Azure requirements — see Reasoning on OpenAI and Azure OpenAI.

Virtual Models

You can call /responses on a virtual model and let the AI Gateway load-balance across several backends. Because a conversation is stored on the backend that created it, the AI Gateway pins every follow-up turn to that same backend automatically — the first turn load-balances, and anything you chain off it with previous_response_id goes back to where it started. The one thing to know as a client: on a virtual model the AI Gateway returns its own response id prefixed with resp_tfyv1-, which encodes the origin backend. Pass it back verbatim and treat it as opaque; the provider’s raw id is not exposed. Send store: false if you’d rather manage history yourself. Note that this does not guarantee load balancing on every turn: if your input replays reasoning items carrying encrypted_content the AI Gateway minted, that turn is still pinned to the backend that produced it, because reasoning ciphertext is only valid at the model that created it. For the full behaviour — what pinning changes about routing, how stateless turns behave, and the errors you may see — see Responses API conversations.