Responses
MarkdownThe new OpenAI format: a single input, typed output, tools, and reasoning. Used by Codex CLI.
Full guide
https://api.ailoot.ai/v1/responsescurl https://api.ailoot.ai/v1/responses \
-H "Authorization: Bearer $AILOOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"instructions": "Keep your answers brief.",
"input": "How does TCP differ from UDP?"
}' from openai import OpenAI
import os
client = OpenAI(max_retries=0, base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"])
resp = client.responses.create(
model="gpt-6.1-sol",
instructions="Keep your answers brief.",
input="How does TCP differ from UDP?",
)
print(resp.output_text)import OpenAI from "openai";
const client = new OpenAI({ maxRetries: 0, baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY });
const resp = await client.responses.create({
model: "gpt-6.1-sol",
instructions: "Keep your answers brief.",
input: "How does TCP differ from UDP?",
});
console.log(resp.output_text);{
"id": "resp_67f1…",
"object": "response",
"status": "completed",
"model": "gpt-6.1-sol",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "TCP guarantees delivery and ordering; UDP does not, but is faster…" }
]
}
],
"usage": { "input_tokens": 24, "output_tokens": 61, "total_tokens": 85 }
}Authentication
- Authorizationheaderrequired
The key in the format
Bearer sk-…. The following headers also work:x-api-keyorx-goog-api-key.
Request body
- modelstringrequired
Model ID that supports the Responses format. The catalog contains 53 such IDs: GPT, Claude, DeepSeek, Qwen, Kimi, GLM, MiniMax, and Grok. Gemini models are unavailable in this format.
- inputstring | arrayrequired
Request text or an array of messages and parts (text, images).
- instructionsstringoptional
System instruction.
- streambooleanoptional
SSE event stream; the last event is
response.completed. Billable text is delivered in a single block after the cost is calculated. - max_output_tokensintegeroptional
Maximum number of response tokens, including reasoning. If omitted, Ailoot sets it to 4096 (or less if the model has a lower response limit). Set the limit explicitly for long responses. Requests with
previous_response_idand built-in toolsweb_searchorcode_interpreteruse separate estimates for stored context and tool activity in new text requests; they do not automatically reserve the cost of the full input window. Existing accepted reserves retain their original terms. Image, video and audio output retain a reserve for the full cost of the result. For a supported model and method, if the calculated reserve exceeds the available balance or key limit, Ailoot can reducemax_tokens(max_output_tokensin Responses) to an affordable output length, but never below 256 tokens or the method’s higher minimum, and reports this in the headerX-Ailoot-Max-Tokens-Capped. Capping support is checked for the exact text model and method. It applies to supported Gemini text routes in native Gemini format and Anthropic Messages format, and todeepseek-ai/deepseek-v4.1-flash,meta/llama-3.2-11b-vision-instruct,meta/muse-glimmer-30b,nvidia/ising-calibration-1.5-31b,nvidia/nemotron-3-nano-omni-30b-a3b-reasoning,nvidia/nemotron-3-super-120b-a12b,nvidia/nemotron-3-ultra-550b-a55b,nvidia/nemotron-3.5-content-safety,nvidia/nemotron-3.5-lightning-30b-a3b,nvidia/riva-translate-4b-instruct-v1.1,nvidia/riva-translate-4b-instruct-v2,poolside/laguna-xs-2.1,z-ai/glm-5.3-flashin Chat Completions and Messages formats, where the model supports them. Output for a new text request’s reserve is estimated from a typical response length and the accepted terms. The requested limit is set throughmax_tokens(max_output_tokensin Responses). The requested limit is not automatically the token count used to calculate the reserve, and does not guarantee the actual response length for a model without reliable capping. The default value of 4096 applies only to the corresponding routes; the exact rule depends on the model and method. - reasoningobjectoptional
{"effort": "low" | "medium" | "high"}for reasoning models. - toolsarrayoptional
Functions the model can call.
- textobjectoptional
Response format, for example
{"format": {"type": "json_schema", ...}}. - temperaturenumberoptional
Response randomness, if supported by the model.
Response
- outputarray
Response items: messages (
message), reasoning, and function calls. In the SDK, you can easily accessoutput_text. - statusstring
completed,incomplete(limit reached) orfailed. - usageobject
input_tokens,output_tokens,total_tokens.