OpenAI Responses endpoint
Point the OpenAI SDK or the OpenAI Agents SDK at the Cloud Score gateway: POST /v1/responses is a stateless subset that routes when model is auto and rejects stateful parameters with a 400.
On this page
What it is
POST /v1/responses accepts the OpenAI Responses API as a stateless subset. It runs the same pipeline as /v1/chat/completions, and Cloud Score never runs your tools. Send the whole history in input on every call; nothing is kept between calls.
Point the SDK at the gateway
Use the OpenAI SDK with the gateway key in the usual Bearer header.
import os
from openai import OpenAI
client = OpenAI(base_url="http://localhost:7001/v1", api_key=os.environ["DEX_API_KEY"])
response = client.responses.create(model="auto", input="Summarize this quarter in two sentences.")
print(response.output_text)The OpenAI Agents SDK works the same way once its default client points at the gateway.
from agents import set_default_openai_client
from openai import AsyncOpenAI
set_default_openai_client(
AsyncOpenAI(base_url="http://localhost:7001/v1", api_key=os.environ["DEX_API_KEY"]),
use_for_tracing=False,
)Request shape
| Field | What Cloud Score does |
|---|---|
model | Required. auto routes; a model key pins. |
input | A string, or items: message, function_call, function_call_output. |
instructions | Sent as the leading system message. |
tools | Function tools only, with tool_choice and parallel_tool_calls. |
max_output_tokens | Mapped to max_tokens. |
temperature | Forwarded. |
text.format | Mapped to response_format. |
reasoning.effort | Forwarded as the reasoning effort. |
stream | Streams Responses events. See Streaming. |
metadata, user | Attribution tags, as on the chat endpoint. |
store, include, truncation | Accepted and ignored; store keeps nothing. |
What is not supported
| You send | Result |
|---|---|
previous_response_id, conversation, background: true, prompt, an item_reference item | 400 unsupported_stateful_parameter |
| Built-in tools (web search, file search, code interpreter, MCP) | 400 unsupported_tool_type |
Images, files, audio, reasoning items | 400 unsupported_content_type |
GET /v1/responses/{id} | Not available: nothing is stored. |
Streaming
Text is sent after output checks. Each function call arrives whole. A failure is sent as response.failed. A max-tokens cut ends in response.incomplete with the same body as the non-stream response (status incomplete, incomplete_details.reason max_output_tokens); the OpenAI and Agents SDKs raise on it as they do against OpenAI.
response.created
response.in_progress
response.output_item.added
response.content_part.added
response.output_text.delta
response.output_text.done
response.content_part.done
response.output_item.done
response.function_call_arguments.delta (one, whole arguments)
response.function_call_arguments.done
response.completed (usage and dex_routing)
response.incomplete (a max-tokens cut, instead of response.completed)Errors and HTTP codes
Errors use the OpenAI shape, {"error": {"message", "type", "code", "param"}}: 400 for rejected requests, 401 for a bad key, 403 for a block, 409 when no model is available (tools_unsupported included), 502 for provider failures and 504 on deadline_exceeded.
Good to know
Good to know
Attribute spend with the X-Dex-* headers. The request shows as OpenAI Responses under Object on /logs.
Related
- OpenAI-compatible endpointPoint the official OpenAI SDK at the Cloud Score gateway: POST /v1/chat/completions routes when model is auto, pins when it is a model key, accepts dex_strategy, and answers with a dex_routing block, HTTP 403 on a block, 409 when no tool-capable model is available, and 502 on any other failure.
- Anthropic Messages endpointPoint the official Anthropic SDK at the Cloud Score gateway: POST /v1/messages takes x-api-key, routes when model is auto, and returns Messages-shaped bodies, SSE events and errors with a dex_routing block.
- Attribute cost to teams and appsTag every request with team, application, agent, environment, and end_user so Usage & cost can break spend down by them as reported tags, budgets can cap a team or an app, and alert rules can watch them.
- ObservabilityThe per-request audit trail and the gateway's health: filter the request list, open a request for its route, attempts, cost and savings receipt, and read latency, outcomes and retries on Gateway health.