docs
API

Responses

Markdown

The new OpenAI format: a single input, typed output, tools, and reasoning. Used by Codex CLI.

Full guide
POSThttps://api.ailoot.ai/v1/responses
Responses
curl 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?"
  }' 
200 OK
{
  "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-key or x-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_id and built-in tools web_search or code_interpreter use 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 reduce max_tokens (max_output_tokens in Responses) to an affordable output length, but never below 256 tokens or the method’s higher minimum, and reports this in the header X-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 to deepseek-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-flash in 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 through max_tokens (max_output_tokens in 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 access output_text.

  • statusstring

    completed, incomplete (limit reached) or failed.

  • usageobject

    input_tokens, output_tokens, total_tokens.

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.Contact support