Skip to main content
Use Cases
Use web search and other built-in tools without client-side tool orchestration.
Server-side state is retained between turns via previous_response_id, without resending the full message history.
Pass input_image and input_file items in a single request.
Combine function calling, reasoning, and tool continuation for agent-style loops.

The Responses API is the OpenAI-style /responses endpoint on the AI Gateway, exposed at POST /v3/router/responses. It implements the OpenResponses specification: a request carries a model and an input, and the response returns structured output items together with token and cost usage. The endpoint supports built-in tools such as web search, server-side conversation state, streaming, and multimodal input. Choose it when those capabilities matter; for a classic messages-based flow, use Chat Completions.
Invoke a configured agent by setting model to agent/<key>; the agent’s tools, knowledge bases, and memory apply automatically. See Run Agents.
A Model Fusion answers one request with a panel of models and returns a single judged response: set model to the fusion’s name. See Model Fusion.

Responses vs Chat Completions

Both endpoints share the same base URL (https://my.orq.ai/v3/router), authentication, and AI Gateway features: fallbacks, retries, caching, guardrails, and budgets. The table below lists the differences. Function calling works on both endpoints through the tools array; see Tool Calling.

Quick Start

Use the OpenAI SDK against the AI Gateway base URL and call client.responses.create.

Statefulness

Responses are persisted server-side by default (store defaults to true) and can be retrieved by ID (GET /v3/router/responses/{response_id}, see Retrieve Response). Continue a conversation by passing previous_response_id on the next request, with only the new input. previous_response_id requires store: true on the original response. What carries over. A continuation replays the stored input history, meaning the earlier turns of the chain, and reuses the template variables that rendered them; values set in the new request take precedence. These fields come from the new request:
  • tools: include the array again to let the model call tools on the continuation.
  • instructions: set it again to keep the same system instructions.
  • model: set it on every continuation, because the model from the earlier turn is not reused.
Stored responses expire with the workspace’s tracing retention period, counted from when the response is created; continuing a chain does not reset that date. The plan sets the maximum and each workspace picks its period in Settings → Organization → General. Once the response named in previous_response_id expires, that ID returns 404 with code previous_response_not_found, and retrieving the response by ID returns 404 with code not_found; resend the history as input to start a new chain. See Data retention. List the input stored for a response with client.responses.inputItems.list(id) in the Node OpenAI SDK or client.responses.input_items.list(id) in Python, pointed at the same baseURL. See List Response Input Items for pagination, include, and what is listed per request type.
Set store: false to skip persisting a response. The response cannot be retrieved later, and previous_response_id will not work on follow-up requests. The request and response still appear in traces and logs, which follow the retention period.

Stored conversations

conversation.id references an existing conversation, identified as conv_01…, created by Orq when a chat starts. The request loads the conversation’s earlier messages as context and appends the new exchange; an unknown id returns 404 with code conversation_not_found:
A request sets either conversation or previous_response_id; setting both returns 400. On a request without a thread id, conversation.id also keys session affinity. A conversation and its messages expire with the workspace’s tracing retention period; each new message refreshes the expiry. See Data retention.

Streaming

Set "stream": true on the request body. The server responds with a Server-Sent Events stream in the OpenAI Responses format: incremental text arrives as response.output_text.delta events, and the stream ends with a completed event carrying final usage. See Streaming for event handling, retry, and error patterns. To keep one connection open across several turns instead of opening a stream per request, the Responses API also accepts a WebSocket transport: see Realtime and WebSocket sessions.

Telemetry

Successful responses carry the OpenTelemetry ids of the turn. The response body includes a top-level telemetry object with the trace and span ids of the request:
trace_id is the 32-character hex id of the trace and span_id the 16-character hex id of the response span. The same values are echoed as the x-orq-trace-id and x-orq-trace-span-id response headers, which every router endpoint sets.
The telemetry object is present only on successful calls. Failed calls do not include it in the response body: read the ids from the x-orq-trace-id and x-orq-trace-span-id response headers instead, which are set on error responses as well.
When streaming, the ids arrive on the final response.completed event inside response.telemetry; the response.created event does not carry them. Read them from the completed event, or from the response headers. Use the ids to correlate the call with its Trace and wherever a span must be referenced, such as annotating a span or logging feedback.

Built-in tools

Built-in tools run server-side: pass them in the tools array and the gateway executes them during generation. Web search is available only through the Responses API, as web_search and web_search_preview tool types. See Web search in Responses API for tool fields, provider mapping, and the include option. Function tools work on both endpoints; see Tool Calling.

Multimodal input

Send images and PDFs alongside text in the input array using input_image and input_file items. See Image, PDF, and audio: multimodal inputs and generation for supported formats and full examples.

AI Gateway features

All AI Gateway features apply to the Responses API. Most are configured per request through request-body fields; budgets are configured in the console and apply by scope.

See also