Responses
Create a response with the OpenAI Responses API. This is the endpoint Codex uses.
Follows OpenAI's Responses format. The body is forwarded once it passes the gateway's checks, after a model id that is not the catalog id is replaced with that id. A trailing [1m] is removed. models, fallbacks, route, provider, plugins that add a fee, tool types other than function, custom and the supported web-search tools, x_search and audio input each return 400 unsupported_. A file sent to a model without file input also returns 400 unless the request asks for the free parser: "plugins": [{ "id": "file-parser", "pdf": { "engine": "cloudflare-ai" } }]. Responses runs statelessly: send the whole conversation in input on every request. Send the key as Authorization: Bearer sk-df-....
Send a request
curl https://deference.si/v1/responses \
-H "Authorization: Bearer $DEFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5.5",
"input": "Say hello in one sentence."
}'import os
from openai import OpenAI
client = OpenAI(base_url="https://deference.si/v1", api_key=os.environ["DEFERENCE_API_KEY"])
response = client.responses.create(
model="anthropic/claude-sonnet-5.5",
input="Say hello in one sentence.",
)
print(response.output_text)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://deference.si/v1",
apiKey: process.env.DEFERENCE_API_KEY,
});
const response = await client.responses.create({
model: "anthropic/claude-sonnet-5.5",
input: "Say hello in one sentence.",
});
console.log(response.output_text);Request body
- modelstringRequired
- The model id.
- inputstring | arrayRequired
- A prompt, or a list of input items for a conversation.
- instructionsstring
- System-level instructions.
- streamboolean
- Return server-sent events. Codex sets it.
- toolsarray
- Tools the model may call.
- max_output_tokensinteger
- The output limit. Also sets the credit held while the request runs.
- reasoningobject
- Reasoning settings, for models that support them.
- storeboolean
- Leave unset or
false. Stored responses are not supported and return400. - previous_response_idstring
- Not supported. Send the full conversation in
input.
Streaming
A stream ends with response.completed, response.incomplete (the reason is in incomplete_details) or response.failed; an error event can end it instead. Each final event carries the final response object, with its usage when the provider reports it. Codex waits for response.completed. See Streaming events.
Models
Each model reads Responses requests in its own way. If a model fails with a Codex-style request, try another. See Codex.