Responses API
The Responses API is OpenAI's response-generation endpoint for applications that use its input/output item format instead of the chat-completions message format. An AISIX gateway exposes this route for Responses API clients while keeping caller authentication, model aliases, upstream credentials, and gateway policy in the gateway.
Use this route when an application or tool already speaks the Responses API. When the model's upstream serves the Responses API itself, AISIX forwards the request there. Otherwise AISIX translates the request through the provider adapter and returns a Responses API result to the caller.
Prerequisites
Before starting, prepare the following:
- A running AISIX gateway that can serve proxy requests.
- A caller API key that can access the model alias.
- A model alias backed by an upstream that serves the Responses API natively or supports the translated request shape.
Export the gateway connection and request values:
# AISIX_PROXY has no trailing slash or endpoint path such as /v1.
# The local quickstarts use http://127.0.0.1:3000.
export AISIX_PROXY="YOUR_AISIX_GATEWAY_URL"
export AISIX_API_KEY="YOUR_CALLER_API_KEY"
export AISIX_MODEL="gpt-4o-prod"
Send a Responses Request
Send the request through the gateway proxy with the AISIX model alias in the request body:
curl -sS -X POST "${AISIX_PROXY}/v1/responses" \
-H "Authorization: Bearer ${AISIX_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "'"${AISIX_MODEL}"'",
"input": "Say hello from AISIX."
}'
AISIX resolves the model alias and chooses the provider path for the selected model. When the provider key selects a native Responses surface, AISIX forwards the request without body translation. Otherwise, it uses the cross-provider bridge. A request that declares tools in additional_tools input items takes the bridge on most keys even when they declare the native surface; see Lite-Mode Tool Requests.
The response body is returned in the upstream Responses API format:
{
"id": "resp_***",
"object": "response",
"model": "gpt-4o-prod",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Hello from AISIX."
}
]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 5,
"total_tokens": 17
}
}
The example shows only the fields this page discusses. On the bridged path, a reasoning-capable upstream leads with a reasoning item ahead of this message item, and the Response object carries the full top-level field set of the Responses API. See What the Bridge Returns.
Provider Behavior
AISIX handles Responses requests in two ways:
| Upstream | Behavior |
|---|---|
| Serves the Responses API | AISIX rewrites the request model to the upstream model ID and forwards the request to the upstream Responses API. Upstream-specific Responses features pass through when the upstream supports them. |
| Does not serve it | AISIX translates supported Responses fields into the gateway's chat format, dispatches through the provider adapter, and returns a Responses API result. |
Which one applies is decided per provider key, with the one request-dependent exception described in Lite-Mode Tool Requests. The bedrock, vertex, and azure-openai adapters always use the bridge. For every other adapter, when no surface is declared, AISIX forwards natively for the openai provider and translates for every other provider. That default is wrong in both directions for some endpoints: an OpenAI-compatible endpoint reached through the openai provider with a custom api_base may have no /v1/responses route, and an endpoint on another provider may serve one. Declare the key's API surfaces to say which it is — see Declare the API Surfaces.
Lite-Mode Tool Requests
Codex in its Responses Lite mode declares its tools in additional_tools input items instead of a top-level tools list. OpenAI's Responses API reads that item type; other upstreams that serve the Responses API ignore it, so a model behind them would receive no tools. Even when the key would otherwise forward Responses natively, a request that declares tools this way stays native only when provider is openai, byo, omitted in an AISIX OSS resources file, or the literal azure value with an adapter other than bedrock, vertex, or azure-openai. The bridge reads additional_tools as described in Tool Parameters.
An Azure OpenAI provider key uses adapter: azure-openai, which does not serve Responses natively, so it takes the bridge for every Responses request. Without additional_tools, other keys follow the ordinary surface rule above.
AISIX makes this decision for each upstream attempt, from the provider key of the target it actually dispatches. In a routing model whose first target uses an OpenAI key and whose fallback uses a DeepSeek key, a lite-mode request is forwarded natively on the first attempt and bridged on the fallback. A bridged attempt is reported like any other bridged request in usage events, access logs, metrics, and traces.
Such a request carries only what the bridge carries. Fields the bridge does not translate are dropped, as listed in Fields Ignored on Translated Requests; in particular, the bridge does not resolve a previous_response_id. This matters only to a client that relies on responses stored by the upstream. Codex over HTTP sends store: false and the full input on every turn.
The bridge supports common text, tool call, tool result, sampling, and streaming fields, plus the message parts, tool parameters, and structured-output format described below. It carries reasoning.effort into the canonical chat request as reasoning_effort; provider adapters that support an effort control then translate it to their wire field. For example, Anthropic receives output_config.effort, or a thinking budget on the Claude families that reject the effort; see Reasoning Effort on Older Claude Models. You can also rewrite the value per direct model with Reasoning Effort Mapping. A Responses feature that the chat format cannot express is dropped rather than flattened onto the upstream body, so the request still reaches the provider instead of being rejected by it; Fields Ignored on Translated Requests lists what falls in that set.
Message Parts
Besides the text parts, the bridge carries the non-text parts of a message into their chat content-block counterparts:
| Responses part | Chat content block |
|---|---|
input_image | image_url, with the image addressed by a URL or a data: URL, and detail carried when the caller sent one |
input_file | file, carrying whichever of file_data, filename, and file_id the caller sent |
input_audio | input_audio, carrying data and format |
A message slot that produces any non-text block is sent as an array content. A text-only slot keeps the bare-string shape it has always had.
Tool Parameters
parallel_tool_callsis forwarded as the caller sent it, whenever at least one tool survives translation.- Every
tool_choiceform is normalized to the provider-neutral chat shape.auto,none,required, and{"type": "function", "name": ...}are unchanged.{"type": "any"}becomesrequired.{"type": "custom", "name": ...}and{"type": "tool", "name": ...}become the named function.{"type": "allowed_tools", "mode": ...}keeps only its mode, and the tool subset it names is dropped, because a chat upstream cannot be restricted to a subset of the tools it was given. - A
custom(freeform) tool becomes a function tool that takes one required string parameter, with the tool's grammar folded into that parameter's description, which is the only place a chat upstream reads it. - A
namespacetool, such as themulti_agent_v1tool Codex sends, is flattened: each of itsfunctionandcustomsub-tools is offered to the model as a function tool named<namespace>__<tool>, described by the namespace's description followed by the sub-tool's own. Acustomsub-tool is converted the same way as a top-levelcustomtool. A sub-tool whose flattened name collides with a top-level function or custom tool is not offered, so the top-level tool wins. A replayedfunction_callorcustom_tool_callthat carries anamespace, and atool_choicethat names a sub-tool with itsnamespace, are sent upstream under the flattened name. - A tool result whose
outputis a JSON object, number, or boolean reaches the upstream as that value serialized to a string, because a chattoolmessage carries a string.nulland an absent output stay the empty string.
Tools can also be declared in additional_tools input items, which Codex sends in its Responses Lite mode instead of a top-level tools list. The bridge translates their tools by the same rules as top-level tools and adds them to the upstream tools after the top-level ones, in input order. The item itself is not forwarded as a message. A tool declared more than once is sent once: the later declaration wins and keeps the position of the first, and a namespace declared again is merged member by member. Whether tool_choice and parallel_tool_calls are forwarded depends on this merged list. A tool that Codex removes during a session is still sent to the model, because Codex announces the removal only in a text message and the earlier declaration stays in the history.
A client can also declare a tool_search tool that it runs itself, with "execution": "client", either in the top-level tools or in an additional_tools item, and hold other tools back until a search loads them. Codex does this for its MCP tools. The bridge carries the search to the chat model:
- The client
tool_searchis offered to the model as a function tool namedtool_search, with its description and parameters, and a default for whichever is missing. It is sent once, however many times it is declared. A hostedtool_search, one without"execution": "client", is dropped like other hosted tools. - When the request declares a client
tool_search, a tool or namespace sub-tool marked"defer_loading": trueis not sent until a search loads it. Without a clienttool_search, such tools are sent as before. - A
tool_search_callin the history is replayed as an assistant call totool_search, and the matchingtool_search_outputas that call's tool result: a text that lists the names the loaded tools can now be called by. A search item that is not client-executed or carries nocall_idis dropped. - The tools in each
tool_search_outputare offered to the model like declared tools, with namespace sub-tools flattened to<namespace>__<tool>anddefer_loadingremoved. They come after every directly declared tool: loaded top-level tools first, then loaded sub-tools grouped by namespace. A loaded tool whose callable name a declared tool already takes is not sent, and a tool loaded more than once keeps its first definition.
A request forwarded to a native Responses surface reaches the upstream unchanged, so none of this applies there. A request that carries additional_tools can still take the bridge according to Lite-Mode Tool Requests.
When no tool survives translation, such as a context-compaction request carrying "tools": [] or a request carrying only hosted tools, tool_choice and parallel_tool_calls are both dropped, including the forms that force a call. Neither key is sent to an upstream that rejects it without a tools list, and the request proceeds as an ordinary tool-free call.
Structured Output
text.format becomes the chat response_format. A json_schema format becomes {"type": "json_schema", "json_schema": {...}}, carrying whichever of name, schema, strict, and description the caller sent; json_object maps straight across; a text format, or no text member at all, sends nothing.
This is honored by OpenAI-compatible chat upstreams, and by Anthropic, Gemini, and Bedrock upstreams, each of which has its own structured-output field. Those mappings differ in what the model supports and in what the provider accepts inside a schema: see Structured Output for Anthropic, Structured Output on Gemini, and Structured Output for Bedrock.
Replayed Conversation History
Clients such as Codex resend the whole conversation on every turn, including the model's earlier reasoning and tool calls. The bridge rebuilds the chat messages from those items as follows:
- Reasoning items. A
reasoninginput item reaches the upstream asreasoning_contenton the assistant message it belongs to. The text comes from the item'scontentparts, or from itssummaryparts whencontentcarries no text.encrypted_contentis never read, and an item with no readable text replays nothing. Consecutive reasoning items are joined with newlines. Because this reasoning used to be dropped, multi-turn requests that replay it now send more input tokens upstream. - Reasoning with no answer after it. Reasoning that no assistant content follows is sent as an assistant message of its own, carrying only
reasoning_content. Upstreams reached through theanthropic,bedrock, andvertexadapters have no field for replayed reasoning: they ignore it on an assistant message that also carries text or tool calls, and skip an assistant message whose only payload isreasoning_content. - Assistant text followed by tool calls. An assistant
messageitem and thefunction_callorcustom_tool_callitems right after it are sent as one assistant message carrying bothcontentandtool_calls, the shape the model produced them in, rather than as two consecutive assistant messages.
reasoning_content is sent to every OpenAI-compatible upstream. An OpenAI-compatible upstream whose request schema rejects unknown message fields rejects a request that replays reasoning; there is no setting that turns the replay off.
What the Bridge Returns
When the selected model uses the anthropic adapter or is a Claude model on Vertex AI, both the non-streaming and the streaming path convert Claude's tool_use blocks into function_call items. On a stream, each block becomes its own function_call item in the order the blocks arrive, and its argument deltas stream as the item's arguments. A call that streams no arguments carries "{}".
The Response object. Every Response the bridge emits, the non-streaming body and the response inside every streamed lifecycle event (response.created, response.in_progress, response.completed, response.incomplete, and response.failed), carries the full top-level field set the Responses API defines. That includes tools, tool_choice, parallel_tool_calls, text, reasoning, instructions, temperature, top_p, max_output_tokens, truncation, store, metadata, completed_at, error, incomplete_details, and usage. A field echoes the request's value when the request set it, and otherwise carries the API's default or null. In the tools echo, a function tool without description, parameters, or strict gets null for the missing ones; other tool types are echoed as sent. The native Responses path returns whatever the upstream returns.
service_tier is the exception to the echo: it reports the tier the upstream served the request at, not the one the request asked for. When the upstream speaks the OpenAI chat completions format and reports a service_tier, the Response carries that value. Otherwise, including when the upstream reports its tier in another protocol's vocabulary, such as Anthropic or Amazon Bedrock, the Response carries default. The tier each upstream reports is still recorded on the usage event; see Read the Served Service Tier.
Some output items on the bridged path do not come from an upstream that speaks Responses. AISIX builds them from the chat reply.
Reasoning. When a chat upstream reports its chain of thought as reasoning_content, or as Mistral thinking or Databricks reasoning content parts, AISIX returns it as a reasoning output item placed ahead of the message item. On a non-streaming reply, the item carries the text as summary[{"type": "summary_text"}]. On a stream, it arrives as response.output_item.added, then response.reasoning_summary_part.added, then one or more response.reasoning_summary_text.delta events, then the matching done events. The message item opens at the next output_index. When reasoning arrives after text on a stream, AISIX closes the open message item before the reasoning item, and the text that follows opens a new message item, so the items keep the order the model produced them in.
Custom tool calls. A model that calls a bridged custom tool returns a custom_tool_call item carrying the freeform text as input, never a function_call item: the single string parameter the request side wrapped it in is unwrapped again. On a stream, the item carries exactly one response.custom_tool_call_input.delta with that input, followed by response.custom_tool_call_input.done.
Namespace tool calls. A model that calls a flattened namespace sub-tool returns a function_call item, or a custom_tool_call item for a custom sub-tool, whose name is the sub-tool's own name and which carries the namespace it belongs to, on both the non-streaming and streaming paths. A bare sub-tool name that identifies exactly one sub-tool is mapped back the same way.
Tool search calls. When the request declares a client tool_search, a model call to it returns a tool_search_call item with "execution": "client", the call's call_id, and arguments as a JSON object. Arguments that do not parse as an object are returned as {}, with the item's status set to incomplete. On a stream, the item arrives as response.output_item.added followed by response.output_item.done, with no argument delta events. A call to a tool that a search loaded comes back like a call to a declared tool. A loaded namespace function returns a function_call item, while a loaded namespace custom tool returns a custom_tool_call item. Both carry the sub-tool's name and namespace.
Stream Failures on the Bridged Path
When a bridged stream fails after it has started, AISIX sends the flat error event, then a response.failed event. The response.failed event carries a full Response object with status: "failed", output: [], usage: null, and error: {"code": ..., "message": ...}. If a terminal event has already reached the client, response.failed is not sent. When the failure is the first thing the client would receive, AISIX opens the stream first: response.created and response.in_progress, both carrying the Response object with status: "in_progress" and an empty output, then error and response.failed, numbered 0 to 3 by sequence_number. This covers an upstream that fails before its first chunk, an empty upstream stream, and an output guardrail that blocks a held-back response or whose buffer the response outgrows. In the held-back case, numbering starts at 0 because the withheld events were never sent. Stream helpers that require response.created first, such as responses.stream() in the OpenAI Python SDK, therefore report the real failure. A stream that has already sent response.created never gets a second one.
The error.code in response.failed depends on why the stream stopped:
| Cause | error.code in response.failed |
|---|---|
| An output guardrail blocks the response, or a held-back response outgrows the guardrail's buffer | invalid_prompt |
The upstream sends an error inside the stream whose code is context_length_exceeded, insufficient_quota, rate_limit_exceeded, server_is_overloaded, or slow_down | That code |
| Any other upstream failure | The same code as the error event, such as upstream_error |
Clients read their retry decision from this code. Codex, for example, shows the message and does not retry a turn that failed with invalid_prompt, since resending it would meet the same guardrail.
Two stream endings are handled specially:
- The connection drops after the finish. If the upstream has already sent a
finish_reasonand the connection drops before the usage chunk or[DONE], the response completes normally. When the usage chunk never arrived, the usage is estimated. - The upstream returns an empty stream. A stream that ends without any content, reasoning, tool call, or
finish_reason, such as a bare[DONE]or a usage-only chunk, fails with anerrorevent and aresponse.failedevent, both with codeupstream_errorand a message saying the upstream returned an empty stream. That code is retryable. A stream that produced content and then ended without afinish_reasonstill completes.
Fields Ignored on Translated Requests
reasoningmembers other thaneffort, such assummarytext.verbositystoreprevious_response_idmetadata,service_tier, and other OpenAI-specific controls- hosted tools such as
web_search,file_search,code_interpreter,mcp,computer_use, andimage_generation
A custom tool is no longer in that set. It is converted as described in Tool Parameters.
Two further limits hold because the chat format has no counterpart for them:
- An
input_imageaddressed only by afile_idis not forwarded. The chat image part addresses an image by a URL or adata:URL and nothing else. - A non-text part inside a tool result is not forwarded. The chat
toolrole is text-only, and an OpenAI-compatible upstream rejects an image in it.
Keep Conversation Context Across Models
A multi-turn Responses conversation can carry context that only the upstream account that produced it can read: the encrypted_content of reasoning items, which stateless clients such as Codex send back on every turn, and a previous_response_id that refers to a response the upstream stored. A follow-up turn that carries this context to a model on a different account is rejected by that model's upstream, typically with 400 invalid_encrypted_content. AISIX therefore records which model and provider key produced each piece of encrypted context, sends it only to models that can read it, and keeps a multi-target model's follow-up turns on a target that can. This behavior is always on for /v1/responses and has no configuration option.
What AISIX Tags in the Response
When a model serves a request on /v1/responses, AISIX tags the encrypted_content of each output item that carries one, such as a reasoning item, with the model that served the response and the provider key that model used at the time. This applies to direct models and to the targets of a multi-target model alike.
When a multi-target model serves the request, AISIX also tags the response id with the target that produced it. The response id of a direct model is not tagged.
The tags apply to non-streaming responses and to streamed events alike: the Response object in response.created, response.in_progress, response.queued, response.completed, response.incomplete, and response.failed, and the item of response.output_item.added and response.output_item.done. A bridged target's response, whose id AISIX generates, is tagged the same way. When the request's previous_response_id was a tagged ID, the Response echoes it back as the client sent it.
Send these values back exactly as you received them. Responses clients already treat them as opaque, so no client change is needed.
A tag is encoded, not signed. A caller can decode it to see which model served a response, and a caller that forges a tag can change only the order in which the model's own targets are tried and whether its own encrypted context is forwarded. It cannot reach a target the model does not have.
Because the client receives the tagged id of a multi-target model's response, a stored response cannot be retrieved, deleted, cancelled, or listed through AISIX by that id: AISIX has no typed route for those calls, and a passthrough route forwards the tagged id, which the upstream rejects. Responses from a direct model are unaffected.
On every /v1/responses request, whether it addresses a direct model or a multi-target model, AISIX removes the tags before it applies guardrails, logs the request, or forwards it. An upstream never receives a tagged value through /v1/responses.
Tagged context is usable only through /v1/responses on AISIX. A provider passthrough route does not remove the tags, and neither does anything outside AISIX, so conversation history continued through a passthrough route, or sent to the provider directly, reaches the upstream with its tags and is rejected. This holds for the output of direct models and of multi-target models.
Which Models Can Read Encrypted Context
Each tag on encrypted_content records the model that produced it and the provider key that model used at the time. A model receives the item's encrypted_content unchanged when any of the following holds:
- It is the model that produced the content, whatever provider key it uses now.
- It uses the recorded provider key.
- It uses the provider key that the model which produced the content uses now.
Every other model receives the item without its encrypted content, as described in When the Context Cannot Follow: the request still succeeds, but the model reasons again for that turn instead of reusing the earlier reasoning.
The same check applies whether the request addresses a direct model or a multi-target model, and when a conversation moves between them. For example, a conversation that a multi-target model's target started and that continues on a direct model keeps its encrypted context when the direct model uses the same provider key, and loses it when the direct model uses an unrelated one.
When the model that produced the context is deleted, the models on the recorded provider key go on receiving the encrypted content unchanged.
Within one upstream account, a conversation can move from one model to another. In tests of this behavior, switching between reasoning models, and from a reasoning model to a non-reasoning model, returned 200 in every case: the upstream either used the earlier reasoning or ignored what it could not reuse.
AISIX sees provider keys, not the upstream accounts behind them, so it treats a model and the provider keys the check names as one account. How you change provider keys and models decides whether that holds:
- Rotate a credential. Replace the secret on the existing provider key, or create a replacement provider key and move the models to it one by one, as described in Provider Key Rotation. Either way, conversations in progress keep their encrypted context, provided the new credential belongs to the same upstream account or organization as the old one.
- Create a new model to use another upstream account. Do not change an existing model to use a provider key for another account, and do not edit a provider key in place to hold another account's credentials or
api_base. Conversations in progress would send the old encrypted content unchanged to the new account, whose upstream rejects it with400 invalid_encrypted_content. By default, AISIX returns that400to the client. A multi-target model moves on to its next target only when itsrouting.fallback_on_statusesincludes400. See Add Provider-Specific Failover Statuses.
Context tagged by a gateway earlier than 1.11.0 records only the model that produced it. AISIX lets that model and the models on its current provider key read it, and removes its encrypted content for every other model once that model no longer exists. During a rolling upgrade or a rollback, a gateway earlier than 1.11.0 that receives context tagged by a later gateway sends it to a multi-target model's targets without the encrypted content, so the request still succeeds.
How Follow-Up Turns Are Routed
When a follow-up request to a multi-target model carries tagged context, AISIX reads which target produced it, from a tagged previous_response_id first and otherwise from the latest tagged encrypted_content in input. It then orders the targets as follows, whatever the model's strategy:
- The target that produced the context goes first, whatever provider key it uses now, as long as it is still a target of this model and it is not excluded by routing tags or
allowed_cidrs. - The other targets that can read the context, as described in Which Models Can Read Encrypted Context, follow in strategy order.
- The remaining targets follow in strategy order.
A target from the first two groups that is in cooldown or unhealthy moves behind all the other targets. A tagged previous_response_id records only the target, so for it the targets that can read the context are that target and the targets on its current provider key.
Retries, failover, max_fallbacks, and per-target rate limits and budgets still apply.
When the Context Cannot Follow
A model that cannot read the context can still serve a follow-up turn. It may be a direct model on an unrelated provider key, or a target of a multi-target model that cannot read the context, used because no target that can is available or because a failover moved the request. AISIX then sends that model the input items without the encrypted content it cannot read: each such item loses its encrypted_content and id and keeps its readable summary or content. An item with no readable text is left out, and the context it carried is lost; examples are the compaction item Codex sends and a reasoning item with an empty summary. The request therefore does not fail on context the model cannot read. A tagged value that AISIX cannot decode is removed the same way.
previous_response_id is never removed. AISIX forwards the upstream's original ID, and the upstream answers it, including with its own error when it did not store that response. A multi-target model sends the turn to the target the tagged ID names, and a direct model serves it itself, whatever provider key that model uses now. So once that model uses a provider key for another account, a stateful follow-up fails with the upstream's error that it cannot find the previous response. Start a new conversation in that case.
Find the Upstream Response ID
Access logs, usage events, and OTLP exports record the upstream's own response ID, as provider_request_id and gen_ai.response.id, not the tagged ID the client receives. To find the upstream ID behind a tagged id, base64url-decode the part after resp_: the decoded text ends with the upstream's original ID.
Policy and Usage Behavior
Input guardrails can inspect request text before AISIX calls the provider. Output guardrails can inspect non-streaming responses before content reaches the caller.
When a client replays conversation history, a guardrail can limit its input window to the latest turn. AISIX uses Responses item types to identify assistant turns and current-turn tool results. See Choose the Input Message Window.
Reasoning that the model generates on the bridged path is outside output-guardrail scanning and masking, the same as on the verbatim path. See Reasoning and Thinking Content.
If an output guardrail blocks the response, AISIX returns a content-policy error to the caller and records the blocked request for observability. On a bridged stream, the block ends the stream as described in Stream Failures on the Bridged Path.
For streaming requests, AISIX preserves the Responses SSE shape. On native Responses targets, AISIX can pass through upstream SSE. On bridged targets, AISIX encodes provider stream chunks into Responses events. If output guardrails are enabled, AISIX buffers the stream for policy inspection before returning it or blocking it. A buffered frame that AISIX cannot parse is dropped rather than released unscanned, and a response left with nothing to return is refused with 422. See Frames AISIX Cannot Scan.
For successful responses, the gateway records usage when the upstream response includes token usage. Streaming usage is emitted when AISIX receives terminal usage information from the stream.
When the upstream leaves token counts out of its usage, or reports no usage, AISIX estimates the missing counts locally, and the caller reads those same numbers: in usage on a non-streaming reply, and in the usage of the terminal event, such as response.completed, on a stream. This holds for native and bridged providers. A count the upstream did report stands, 0 included, and total_tokens is then input_tokens + output_tokens. There is no marker in the response saying a count was estimated; the usage_estimated field on the usage record is the signal. See Token Counting and Usage Estimation.
On bridged providers whose token accounting differs from OpenAI's, AISIX converts the counts into the Responses API shape: input_tokens is the full input, input_tokens_details.cached_tokens is the cache-read subset of it, input_tokens_details.cache_creation_tokens is the cache-write subset when the upstream reported one, and total_tokens is input_tokens + output_tokens. See Token Usage for a worked example with an Anthropic upstream — it is written in Chat Completions field names, which map to these one for one (prompt_tokens to input_tokens, completion_tokens to output_tokens, prompt_tokens_details to input_tokens_details, completion_tokens_details to output_tokens_details). One shape difference: output_tokens_details.reasoning_tokens is always present on a Responses reply, including when it is 0, whereas Chat Completions omits the block entirely.
Next Steps
You have now seen when to use Responses API through AISIX and how provider handling differs between direct forwarding and bridging. Next, continue with Text Completions for the legacy completions route, or Streaming when your Responses API client depends on SSE behavior.