Source: https://ailoot.ai/docs/en/api/responses/
Canonical: https://ailoot.ai/docs/en/api/responses/
Language: en

[API](https://ailoot.ai/docs/en/) 

# Responses

[Markdown](https://ailoot.ai/docs/en/api/responses/index.md)

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

POST`https://api.ailoot.ai/v1/responses`

Responses

```bash
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?"
  }' 
```

```python
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)
```

```js
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);
```

200 OK

```json
{
  "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

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` | header | required | The key in the format `Bearer sk-…`. The following headers also work: `x-api-key` or `x-goog-api-key`. |

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `model` | string | required | 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. |
| `input` | string \| array | required | Request text or an array of messages and parts (text, images). |
| `instructions` | string | optional | System instruction. |
| `stream` | boolean | optional | SSE event stream; the last event is `response.completed`. Billable text is delivered in a single block after the cost is calculated. |
| `max_output_tokens` | integer | optional | 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. |
| `reasoning` | object | optional | `{"effort": "low" \| "medium" \| "high"}` for reasoning models. |
| `tools` | array | optional | Functions the model can call. |
| `text` | object | optional | Response format, for example `{"format": {"type": "json_schema", ...}}`. |
| `temperature` | number | optional | Response randomness, if supported by the model. |

## Response

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `output` | array |  | Response items: messages (`message`), reasoning, and function calls. In the SDK, you can easily access `output_text`. |
| `status` | string |  | `completed`, `incomplete` (limit reached) or `failed`. |
| `usage` | object |  | `input_tokens`, `output_tokens`, `total_tokens`. |

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.[Contact support](mailto:support@ailoot.ai)

## Ailoot · The company and its project portfolio





Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.





The company and its project portfolio: millions of customers; monthly sales in the billions.





Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
