API & Error Codes
The OpenAI Responses endpoint
For the Codex CLI and the OpenAI SDK's responses API: the same key, no stored conversations, and three behaviours that differ from the official API.
Alongside Chat Completions, the gateway also serves OpenAI's Responses API:
| Endpoint | Purpose |
|---|---|
POST /v1/responses |
Chat completions over the Responses protocol, with neither request nor response translated |
This is the endpoint the Codex CLI and the OpenAI SDK's client.responses.create() use.
Authentication and address: the same as Chat Completions
Authorization: Bearer your key
The address is the same one too (with /v1):
https://api.xisu.ai/v1
Key, tenant, balance, plan and budget are shared with the other two surfaces — nothing extra to request, and usage lands on the same account.
Request and response
Standard Responses shape, with model and input required. If you send max_output_tokens, it must be a positive integer. Apart from the model name, the request body reaches the upstream as-is — reasoning, instructions, function tools and the rest are not translated.
Responses are returned as-is. Streaming is a native Responses event stream (response.created … response.output_text.delta … response.completed) with no data: [DONE], so don't write your termination check against it. Usage appears once, in response.completed, as input_tokens / output_tokens (not prompt_tokens / completion_tokens).
⚠️ Three behaviours that differ from the official API
1. No stored conversations: three fields are rejected with 400
The gateway does not store your conversations. These fields depend on server-side storage and return 400 instead of being silently ignored:
| Field | What to do |
|---|---|
previous_response_id |
Put the full conversation in input |
background |
Background jobs are not supported; use a normal or streamed request |
store: true |
Set it to false, or leave it out |
(Ignoring them silently would send the upstream a request with no history — the model answers out of context and you are still billed. So we fail loudly instead.)
2. Server-side tools are billed per call
Tools executed by the upstream — web_search, file_search, code_interpreter, mcp and the like — pass through as-is but are billed per call, outside token usage.
- They are allowed only when the model has a per-call price configured; otherwise, or if we don't recognise the tool type yet, you get 400
server_tool_not_priced; - Tools you execute yourself, such as
functionandcustom, are not billed per call and pass through normally; - Requests that use per-call tools are not covered by prepaid packs; they are charged to your balance in full.
3. The models here are a subset
Only models with an OpenAI-compatible upstream can be called on this endpoint. The two failure cases call for opposite next steps:
| Response | Meaning | What to do |
|---|---|---|
404 model_not_on_endpoint |
The model has upstreams, but none of them can serve this endpoint | Permanent, retrying won't help: pick another model or use /v1/chat/completions |
503 no_available_channel |
The model belongs to this endpoint, but no upstream is available right now | Temporary: back off using the Retry-After header and retry |
Models marked OpenAI Responses in the model catalog and the console's available-models list can use this endpoint; an unmarked model is not necessarily unsupported — the actual call is the source of truth. All other error codes are the same as for Chat Completions; see Error codes and rate limits.