> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gloo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Direct Responses

> POST /ai/v2/direct/responses — the Responses request shape sent straight to the model you name, with no guardrails, moderation, values-alignment or routing in between. For apps that handle their own safety.

**Direct Responses** is the [direct endpoint](https://docs.gloo.com/api-guides/endpoint-types.md) for the Responses format: `POST /ai/v2/direct/responses` sends your request straight to the `model` you name. It exposes the entire Gloo AI model catalog (text, vision, reasoning, [tool use](https://docs.gloo.com/ai-learning-center/gloo-ai-104/tools-and-mcp.md), and native image generation) through one request and response shape that works the same across every provider.

**Direct endpoints bill the model's published [rate](https://docs.gloo.com/getting-started/pricing.md)** (see the Models page and `GET /platform/v2/models`). Coming from another gateway? Direct endpoints cost what you would pay going straight to the model providers.

It takes the **same request body** as the guarded [Responses](https://docs.gloo.com/api-guides/responses.md) endpoint; the difference is what runs around it. Nothing here applies [guardrails](https://docs.gloo.com/ai-learning-center/gloo-ai-102/guardrails-and-values.md), output moderation or values alignment (`tradition`). (`model_family` and [auto-routing](https://docs.gloo.com/getting-started/glossary.md#auto-routing) are on [Guarded Completions](https://docs.gloo.com/api-guides/completions-v2.md).) Choose this when you want the provider's model as-is and handle safety yourself; choose guarded [Responses](https://docs.gloo.com/api-guides/responses.md) when you want Gloo's safety and values alignment built in. See [Which endpoint should I use?](https://docs.gloo.com/api-guides/endpoint-types.md#which-endpoint-should-i-use) to compare all three endpoint families.

> [!NOTE]
>
> **Already on [Completions V2](https://docs.gloo.com/api-guides/completions-v2.md)?** It remains fully supported and backwards-compatible; see [Moving from Completions to Responses](#moving-from-completions-to-responses).

## Quick start

**URL:** `https://platform.ai.gloo.com/ai/v2/direct/responses`

**Operation:** `POST`

```bash cURL theme={null}
curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/responses' \
  -H "Authorization: Bearer $GLOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gloo-anthropic-claude-sonnet-4.6",
    "input": "Suggest three warm, short welcome messages for first-time church visitors.",
    "max_output_tokens": 16384
  }'
```

```python Python theme={null}
import os
import requests

API_KEY = os.environ["GLOO_API_KEY"]
API_URL = "https://platform.ai.gloo.com/ai/v2/direct/responses"
MODEL = "gloo-anthropic-claude-sonnet-4.6"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}


def output_text(response: dict) -> str:
    """Join the text of every message item in output[]."""
    return "".join(
        part.get("text", "")
        for item in response.get("output", [])
        if item.get("type") == "message"
        for part in item.get("content", [])
        if part.get("type") == "output_text"
    )


r = requests.post(API_URL, headers=HEADERS, json={
    "model": MODEL,
    "input": "Suggest three warm, short welcome messages for first-time church visitors.",
    "max_output_tokens": 16384,
}, timeout=120)
r.raise_for_status()
result = r.json()

print(output_text(result))
print(result["usage"])
```

```typescript TypeScript theme={null}
const API_KEY = process.env.GLOO_API_KEY!;
const API_URL = "https://platform.ai.gloo.com/ai/v2/direct/responses";
const MODEL = "gloo-anthropic-claude-sonnet-4.6";

/** Join the text of every message item in output[]. */
function outputText(response: any): string {
  return (response.output ?? [])
    .filter((item: any) => item.type === "message")
    .flatMap((item: any) => item.content ?? [])
    .filter((part: any) => part.type === "output_text")
    .map((part: any) => part.text ?? "")
    .join("");
}

const res = await fetch(API_URL, {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    model: MODEL,
    input: "Suggest three warm, short welcome messages for first-time church visitors.",
    max_output_tokens: 4096,
  }),
});
if (!res.ok) throw new Error(`Request failed: ${res.status} ${await res.text()}`);
const result = await res.json();

console.log(outputText(result));
console.log(result.usage);
```

Send your API key as a Bearer token, as on the rest of the platform. See [Generate API Keys](https://docs.gloo.com/studio/manage-api-credentials.md). For a step-by-step build with streaming, tools and error handling, follow the [Direct Responses tutorial](https://docs.gloo.com/tutorials/direct-responses.md).

## Why the Responses API

The Responses API is a more capable request shape that the broader ecosystem is standardizing on:

* **One shape for every modality.** Text, image input (vision), and image generation all use the same `input` array and the same typed `output` array, with no separate endpoints or bespoke payloads per capability.
* **OpenAI-compatible.** The request and response formats mirror the OpenAI Responses API, so existing tooling, SDKs, and mental models carry over. Point your base URL at `https://platform.ai.gloo.com/ai/v2/direct`.
* **Typed, structured output.** Responses come back as an `output[]` array of typed items (`message`, `image_generation_call`, reasoning, tool calls) instead of a single opaque `choices[].message.content` string, so they're easier to parse and extensible as new item types arrive.
* **Built for multimodal.** Native image generation and image input are first-class, not bolted on.

## Request format

A minimal request:

```bash theme={null}
curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/responses' \
  -H "Authorization: Bearer $GLOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gloo-anthropic-claude-sonnet-4.6",
    "input": [
      { "role": "user", "content": "Explain prompt caching in two sentences." }
    ]
  }'
```

The Responses API uses `input` instead of `messages`, plus a few renamed fields:

| Responses API | Chat Completions equivalent | Notes |
| :- | :- | :- |
| `input` | `messages` | A string, or an array of input items (`role` + `content`). |
| `instructions` | `system` message | Top-level system / developer instructions (the [system prompt](https://docs.gloo.com/ai-learning-center/gloo-ai-101/prompting-and-generation.md#system-prompt)). |
| `max_output_tokens` | `max_tokens` | Cap on output tokens, reasoning included. Sent as you set it, with no raise for reasoning. |
| `model` | `model` | A Gloo model ID; see [Supported Models](https://docs.gloo.com/api-guides/supported-models.md). |

`model` and `input` are required. A few parameters need a note:

* **`max_output_tokens`:** on a reasoning model it holds the reasoning as well as the answer, so leave room for both. With no value, most reasoning models get their full output allowance (up to 65,536); Claude models and the Gemini Flash-Lite models use the model's default, so set a value for long answers. A response that reached it has `status: "incomplete"`. See [Set your output limit for reasoning models](https://docs.gloo.com/api-guides/reasoning.md#set-your-output-limit-for-reasoning-models).
* **`reasoning`:** see [Reasoning summaries](#reasoning-summaries).
* **`temperature` and `top_p`:** some models don't take them. The request still runs, and the response lists the parameter in `ignored_params`; see [Sampling parameters](https://docs.gloo.com/api-guides/direct-completions.md#sampling-parameters).
* **`image_generation`:** a Gloo field with image options (`quality`, `size`), mapped onto OpenAI's image generation tool for image-capable models. Providers without quality controls ignore it. See [Images In and Out](https://docs.gloo.com/ai-learning-center/gloo-ai-104/images-in-and-out.md).

Sampling (`temperature`, `top_p`), [tools](https://docs.gloo.com/api-guides/tool-use.md), `stream`, [structured output](https://docs.gloo.com/ai-learning-center/gloo-ai-104/structured-output.md) (`response_format`) and `prompt_cache_key` ([Prompt Caching](https://docs.gloo.com/api-guides/prompt-caching.md)) follow the OpenAI Responses request shape. For every parameter, see the [Direct Responses API reference](https://docs.gloo.com/api-reference/responses/v2.md).

Conversation state is managed client-side: send the full conversation in `input` on every request ([Conversations That Remember](https://docs.gloo.com/ai-learning-center/gloo-ai-104/conversations-that-remember.md) shows how, including trimming long histories). `previous_response_id` and `conversation` (OpenAI's server-side conversation chaining) are not supported, and a model's reasoning is not carried from one request to the next. See [Reasoning across turns](#reasoning-across-turns).

> [!WARNING]
>
> **This is a [direct endpoint](https://docs.gloo.com/api-guides/endpoint-types.md): `/ai/v2/direct/responses` does not apply Gloo's guarded pipeline.** Requests call the exact `model` you specify, and none of the following runs:
>
> * Input guardrails and output moderation
> * Values-alignment (`tradition`)
> * `model_family` selection and auto-routing
>
> **Want the same request body with those applied?** Use the guarded [Responses](https://docs.gloo.com/api-guides/responses.md) endpoint at `/ai/v2/guarded/responses`. [Completions V2](https://docs.gloo.com/api-guides/completions-v2.md) and [Grounded Completions](https://docs.gloo.com/api-guides/grounded-completions.md) are guarded too, on the Chat Completions shape.
>
> "Direct" describes this URL, not the Responses format in general: the same format is served by the guarded endpoint above and by [Grounded Responses](https://docs.gloo.com/api-guides/grounded-responses.md), which adds [retrieval-augmented (RAG) generation](https://docs.gloo.com/ai-learning-center/gloo-ai-101/data-and-memory.md#retrieval-augmented-generation-rag) over your own content.

## Response format

Responses return a typed `output[]` array. Each item has a `type`; a normal text answer arrives as a `message` item, a generated image as an `image_generation_call` item.

```json theme={null}
{
  "id": "resp_...",
  "object": "response",
  "model": "gloo-anthropic-claude-sonnet-4.6",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        { "type": "output_text", "text": "Prompt caching reuses processed prompt tokens..." }
      ]
    }
  ],
  "usage": { "input_tokens": 24, "output_tokens": 38, "total_tokens": 62 }
}
```

### Streaming

Set `"stream": true` to receive the response as [Server-Sent Events](https://docs.gloo.com/ai-learning-center/gloo-ai-104/streaming-responses.md). Each event has an `event:` line and a `data:` line carrying a typed JSON payload:

```text theme={null}
event: response.output_item.added
data: {"type":"response.output_item.added","output_index":0,"item":{"id":"msg_...","type":"message","role":"assistant"}}

event: response.content_part.added
data: {"type":"response.content_part.added","item_id":"msg_...","part":{"type":"output_text","text":""}}

event: response.output_text.delta
data: {"type":"response.output_text.delta","item_id":"msg_...","delta":"Prompt "}

event: response.output_text.delta
data: {"type":"response.output_text.delta","item_id":"msg_...","delta":"caching "}

event: response.content_part.done
data: {"type":"response.content_part.done","item_id":"msg_...","part":{"type":"output_text","text":"Prompt caching reuses..."}}

event: response.output_item.done
data: {"type":"response.output_item.done","output_index":0,"item":{"id":"msg_...","type":"message",...}}

event: response.completed
data: {"type":"response.completed","response":{"id":"resp_a1b2c3",...,"output":[...],"usage":{...}}}
```

This is the stream from an OpenAI model served over OpenAI's Responses API. For other models, Gloo converts the stream to this format, with two differences: `response.completed` (or `response.incomplete`) carries the response's top-level fields (`id`, `object`, `status`, `usage` and the request settings), not nested under a `response` key and without `output[]`, and text deltas identify their item by `output_index` rather than `item_id`. Build the answer from the events before the final one.

Key event types to handle:

* `response.output_item.added` / `response.output_item.done`: mark the start and end of each typed item in `output[]` (including `message`, `image_generation_call`, and `function_call`).
* `response.content_part.added` / `response.content_part.done`: mark the start and completion of a content part within an item. `response.content_part.done` is the signal that a message's text is complete, followed by `response.output_item.done`.
* `response.output_text.delta`: incremental text tokens for a `message` item.
* `response.function_call_arguments.delta`: incremental tool-call argument tokens for a `function_call` item.
* `response.completed`: emitted once when the response is finished. For OpenAI models served over OpenAI's Responses API, its `response` object includes the full `output[]` array and `usage`; for other models the payload is the response's top-level fields and `usage`, without `output[]`. An answer cut off at `max_output_tokens` ends with `response.incomplete` instead.

Errors follow the [direct endpoint error contract](https://docs.gloo.com/api-reference/general/errors.md#direct-endpoint-errors): a short `message` you can show your end users, a `developer_message`, and an `X-Gloo-Error-Code` header. A streamed request that fails before any output gets the same HTTP status and body as a non-streamed one (a raised exception in the SDK). A stream that fails after output has started ends with a `response.failed` event, as in OpenAI's Responses API: `response.error.code` is the string error code, and Gloo adds the numeric `gloo_code`, `developer_message` and `retryable`. See [Streaming on the direct endpoints](https://docs.gloo.com/api-reference/general/errors.md#streaming-on-the-direct-endpoints).

## Reasoning summaries

Set `reasoning.effort` to choose how much a [reasoning model](https://docs.gloo.com/ai-learning-center/gloo-ai-102/models-that-think.md) thinks, and `reasoning.summary` (`auto`, `concise` or `detailed`) to get a summary of its reasoning back as a `reasoning` item in `output[]`, before the answer. Without `summary`, OpenAI and Claude models normally return no summary. The request has the same shape on the guarded [Responses](https://docs.gloo.com/api-guides/responses.md) endpoint:

```json theme={null}
{
  "model": "gloo-anthropic-claude-opus-5.5",
  "reasoning": { "effort": "medium", "summary": "auto" },
  "max_output_tokens": 8192,
  "input": "A train leaves at 9:40 and arrives at 13:05. How long is the trip? Answer in one sentence."
}
```

For the response and stream shapes and effort levels by model, see [Reasoning](https://docs.gloo.com/api-guides/reasoning.md#responses); for examples in every language, see the [Reasoning tutorial](https://docs.gloo.com/tutorials/reasoning.md#examples-by-endpoint).

## Multimodal

### Image input (vision)

Pass images as input items alongside text ([Images In and Out](https://docs.gloo.com/ai-learning-center/gloo-ai-104/images-in-and-out.md) walks through it). Any vision-capable model accepts them: every Claude, Gemini and Grok chat model, and every OpenAI GPT model except the open-weight GPT OSS models, and the other models with `supports_vision: true` in the [catalog](https://docs.gloo.com/api-guides/supported-models.md).

```bash theme={null}
curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/responses' \
  -H "Authorization: Bearer $GLOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gloo-google-gemini-3.1-pro",
    "input": [
      { "role": "user", "content": [
        { "type": "input_text", "text": "Describe this image." },
        { "type": "input_image", "image_url": "https://example.com/photo.jpg" }
      ]}
    ]
  }'
```

Images may be supplied as a remote URL or a base64 `data:` URI. Base64 is the most predictable: it works with every model that reads images, and nothing has to fetch the image. To send a file from disk or an upload, encode its bytes:

```json theme={null}
{ "type": "input_image", "image_url": "data:image/jpeg;base64,/9j/4AAQSkZJRg...", "detail": "auto" }
```

* **`detail`** is optional (`"low"`, `"high"` or `"auto"`). GPT models use `"low"` to read a smaller version of the image for fewer input tokens.
* **Formats and counts.** Send JPEG, PNG, GIF or WebP. Gloo sets no limit of its own on the number of images; the model maker's limits apply. The whole request body can be up to 10 MB, and base64 makes a file about a third larger. See [Request size](https://docs.gloo.com/api-reference/general/limits.md#request-size).
* **Cost.** An image is billed as input tokens at the model's input rate, and again on each turn it stays in the conversation you resend.
* **Uploads from people you don't control.** On direct endpoints, safety is your application's responsibility; see [Images and moderation](https://docs.gloo.com/api-guides/endpoint-types.md#images-and-moderation).
* **Switching models.** A conversation that holds an image needs a model that reads images on every turn. See [Switching models mid-conversation](https://docs.gloo.com/best-practices/images-in-conversations.md#switching-models-mid-conversation).

For two worked examples with Claude (a fridge photo to a recipe, a screenshot to suggested replies), follow [Understand Images with Claude](https://docs.gloo.com/tutorials/understand-images.md). For production advice, see [Images in Conversations](https://docs.gloo.com/best-practices/images-in-conversations.md).

### PDF input

Send a PDF as an `input_file` part with the file as a base64 `data:application/pdf;base64,` URI in `file_data`, and an optional `filename`:

```bash theme={null}
# Encode the PDF as one line of base64 (works on macOS and Linux)
PDF_B64=$(base64 < bulletin.pdf | tr -d '\n')

curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/responses' \
  -H "Authorization: Bearer $GLOO_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @- <<EOF
{
  "model": "gloo-anthropic-claude-sonnet-5.5",
  "max_output_tokens": 16384,
  "input": [
    { "role": "user", "content": [
      { "type": "input_text", "text": "Summarize this bulletin in three bullet points." },
      { "type": "input_file", "filename": "bulletin.pdf", "file_data": "data:application/pdf;base64,${PDF_B64}" }
    ]}
  ]
}
EOF
```

* **Base64 only.** `file_id` and `file_url` aren't supported and return `400`; send the file in `file_data`.
* **PDF only.** `file_data` must be a `data:application/pdf;base64,` URI; other file types return `400`.
* **Size.** The PDF counts toward the 10 MB request body limit, after base64 encoding.
* **Models.** Some models can't take a PDF; a request to one returns a `400` that names the model. The PDF's content counts as input tokens.

### Image generation

Image-capable models return a generated image as an `image_generation_call` output item (base64 result). Optional `image_generation` controls (`quality`, `size`) are forwarded to providers that support them.

```bash theme={null}
curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/responses' \
  -H "Authorization: Bearer $GLOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gloo-google-gemini-3-pro-image",
    "input": [
      { "role": "user", "content": [
        { "type": "input_text", "text": "A watercolor painting of a lighthouse at sunset." }
      ]}
    ]
  }'
```

The `image_generation_call` item's `result` field carries the image as a base64-encoded string:

```json theme={null}
{
  "id": "resp_...",
  "object": "response",
  "model": "gloo-google-gemini-3-pro-image",
  "output": [
    {
      "type": "image_generation_call",
      "id": "ig_...",
      "status": "completed",
      "result": "iVBORw0KGgoAAAANSUhEUgAA...<truncated base64 PNG>..."
    }
  ],
  "usage": { "input_tokens": 14, "output_tokens": 1290, "total_tokens": 1304 }
}
```

Decode the base64 `result` to get the image bytes.

### Image generation tool

OpenAI's image generation runs as an `image_generation` **tool** on an OpenAI GPT model. GPT Image models such as `gpt-image-2` are not Gloo model IDs, exactly as on OpenAI's own API: set `model` to a GPT model and attach the tool. The model decides when to draw and can combine the image with text in the same response. The tool's optional `model` field picks the image model that draws, and `quality` and `size` control the image:

```bash theme={null}
curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/responses' \
  -H "Authorization: Bearer $GLOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gloo-openai-gpt-6-luna",
    "input": [
      { "role": "user", "content": [
        { "type": "input_text", "text": "A watercolor painting of a lighthouse at sunset." }
      ]}
    ],
    "tools": [
      { "type": "image_generation", "model": "gpt-image-2", "quality": "low" }
    ]
  }'
```

The generated image arrives as the same `image_generation_call` output item shown above, alongside any `reasoning` and `message` items from the GPT model. **Image editing** works the same way: include an `input_image` part in the conversation and it becomes the tool's edit source.

The tool works the same way here and on the guarded [Responses](https://docs.gloo.com/api-guides/responses.md) endpoint.

#### Models that can use the tool

Use an OpenAI GPT-5 or GPT-6 text model from the catalog, such as `gloo-openai-gpt-6-luna`, `gloo-openai-gpt-5.5` or `gloo-openai-gpt-6-sol`, other than the Pro models listed below. GPT-5.2 Pro, GPT-5.4 Pro and GPT-5.5 Pro run the tool.

These models don't run the tool, and a request that attaches it gets a `400` [error](https://docs.gloo.com/api-reference/general/errors.md#image-generation-errors):

* GPT-5.6 Pro (Sol, Terra and Luna), GPT-6 Pro (Astra, Sol and Luna) and GPT-6.1 Sol Pro.
* The GPT-4.1 models.
* Models from other families: Claude, Gemini text models and open-source models.

To get an image from a Gemini image model such as `gloo-google-gemini-3-pro-image`, call it directly as shown in [Image generation](#image-generation), without `tools`. These models don't take tools, so a request to them with any `tools` gets a `400`.

#### Image models

| Tool `model` | Notes |
| - | - |
| `gpt-image-2` | Default when the tool has no `model`. |
| `gpt-image-2.5-flare` | |
| `gpt-image-2.5-sunburst` | |
| `gpt-image-1.5` | Retiring December 1, 2026: use `gpt-image-2.5-flare` or `gpt-image-2.5-sunburst`. |
| `chatgpt-image-latest` | Retiring December 1, 2026: use `gpt-image-2.5-flare` or `gpt-image-2.5-sunburst`. |
| `gpt-image-1-mini` | Retiring December 1, 2026: use `gpt-image-2.5-flare` or `gpt-image-2.5-sunburst`. |
| `gpt-image-1` | Retired by OpenAI on October 23, 2026. Requests that name it run on `gpt-image-2`. |

A request that names `gpt-image-1` keeps working: it runs on `gpt-image-2`, the newer model in the same family, and is billed as `gpt-image-2`. The response carries the same headers as any [redirected model](https://docs.gloo.com/api-guides/model-lifecycle.md#response-headers-on-a-redirected-request): `X-Gloo-Model-Redirected-From: gpt-image-1`, `Deprecation: true`, and `Sunset: Fri, 23 Oct 2026 00:00:00 GMT`. Set the tool's `model` to `gpt-image-2`, `gpt-image-2.5-flare` or `gpt-image-2.5-sunburst` to stop seeing them.

An image model that doesn't exist gets a `400` that names the image models you can use. See [Image generation errors](https://docs.gloo.com/api-reference/general/errors.md#image-generation-errors) for every case.

#### How image generation is billed

Each image is billed at the rates OpenAI publishes for the image model that drew it, from the tokens that image model reports. Those include the prompt text sent to the image model as well as the image it returns. You pay only for images that come back in the response. The GPT model's own input and output tokens are billed at its catalog rates as usual (see [Supported Models](https://docs.gloo.com/api-guides/supported-models.md) or `GET /platform/v2/models`). Direct endpoints add nothing to these rates.

## Pricing and token spend

The Responses API is billed per token at each model's standard rates, with no separate or premium price for `/responses`. Cost depends only on the `model` you select and the tokens you use:

```
total_cost = input_tokens  × input_rate
           + cached_tokens  × cache_read_rate
           + output_tokens  × output_rate
```

* **Per-model rates.** Input and output rates vary by model. The live rates are on the [Supported Models](https://docs.gloo.com/api-guides/supported-models.md) page and programmatically on `GET /platform/v2/models`.
* **[Prompt caching](https://docs.gloo.com/ai-learning-center/gloo-ai-104/cost-and-speed.md#prompt-caching)** reduces input cost when prompt prefixes repeat: cached tokens are billed at a discounted `cache_read` rate. See [Prompt Caching](https://docs.gloo.com/api-guides/prompt-caching.md).
* **Image input** (images and PDFs you send) counts as input tokens at the model's input rate, with no separate per-image charge. See [Know what each turn costs](https://docs.gloo.com/best-practices/images-in-conversations.md#know-what-each-turn-costs).
* **Image generation** is billed at the image model's published rates, and only for images that are returned. See [How image generation is billed](#how-image-generation-is-billed).
* **Published rate.** Direct endpoints and Grounded Responses bill the published per-model rate exactly. Guarded endpoints and Grounded Completions are priced at that rate plus 6.5% for guardrails, moderation and values alignment.

Track real spend in the [Gloo Studio billing dashboard](https://studio.ai.gloo.com/billing) and [API usage](https://docs.gloo.com/studio/api-usage.md).

## Supported models

The Responses API works across the full Gloo AI catalog (Anthropic, OpenAI, Google, and open-source families), including the multimodal and image-generation models. Use the **Model ID** as the `model` field. The complete, live list (with capabilities and pricing) is on the [Supported Models](https://docs.gloo.com/api-guides/supported-models.md) page.

## Reasoning across turns

Reasoning models can return a `reasoning` item in `output[]` with a summary of how they reasoned. Gloo does not carry a model's reasoning from one request to the next: each request is reasoned from the conversation you send in `input`.

### What comes back

Reasoning items keep their `id` and `summary`. They never include `encrypted_content`, in a non-streamed response or in any streamed event, and that includes requests that ask for `include: ["reasoning.encrypted_content"]`. That `include` value is accepted; it just returns nothing.

### What happens to reasoning you send back

You can still send output items back in `input`, reasoning items included. Gloo removes the reasoning state before calling any model and answers normally.

* **Any `reasoning` item that carries `encrypted_content` is removed**, whatever the value is: an OpenAI blob saved from an earlier response, a value from another provider, or anything else.
* **If the most recent assistant turn loses a reasoning item, every reasoning item in the request is removed**, so the model sees a conversation with no reasoning in it rather than reasoning from older turns only.
* **Items tied to a removed reasoning item are adjusted** so the request stays valid for OpenAI models. In each assistant turn that lost reasoning:
  * a `function_call` is sent without its `id`; its `call_id`, and your `function_call_output` for it, are kept;
  * an assistant `message` is sent without its `id`, with its text kept, or removed if it has no text;
  * hosted and client tool calls OpenAI ties to the reasoning by id (`web_search_call`, `file_search_call`, `image_generation_call`, `code_interpreter_call`, `computer_call`, `local_shell_call`, the [MCP](https://docs.gloo.com/ai-learning-center/gloo-ai-104/tools-and-mcp.md#what-mcp-is) items and similar) are removed, together with your items that answer them;
  * an `item_reference` to anything removed or sent without its id is removed.
* **Requests with no reasoning items are unchanged.**

Removing a hosted tool call removes its results from what the model sees. Text the assistant already wrote from those results stays in the conversation.

### How to tell what was removed

Direct Responses reports removed reasoning in `ignored_params`. `input.reasoning=<n>` is the number of reasoning items removed because they carried `encrypted_content` or went with one that did, and `input.reasoning_paired=<n>` the number of other items removed with them: hosted tool calls, your items answering them, assistant messages with no text and `item_reference` items (omitted when there were none). `input.reasoning` does not count the other reasoning items on a request that is converted for the model, those without `encrypted_content` that did not go with one that did, though those are still not sent to it. Here one reasoning item carrying an OpenAI blob was sent back:

```json theme={null}
{
  "id": "resp_...",
  "object": "response",
  "model": "gloo-openai-gpt-5.4-nano",
  "status": "completed",
  "output": [ ... ],
  "ignored_params": {
    "params": ["input.reasoning=1"],
    "model": "gloo-openai-gpt-5.4-nano",
    "reason": "These parameters were ignored and did not affect the response: the model does not accept them, or this surface does not forward them to the provider."
  }
}
```

On a stream, the names are listed in the `X-Ignored-Params` header without counts, for example `X-Ignored-Params: input.reasoning, input.reasoning_paired`.

A check on a non-streamed response:

```python theme={null}
def reasoning_items_removed(response: dict) -> int:
    """How many reasoning items Gloo removed from this request's input."""
    for entry in (response.get("ignored_params") or {}).get("params", []):
        if entry.startswith("input.reasoning="):
            return int(entry.split("=", 1)[1])
    return 0
```

With the OpenAI Python SDK, pass `response.model_dump()`: `ignored_params` is a Gloo addition, so the SDK keeps it as an extra field rather than a typed attribute.

Direct Responses does not return a `reasoning_carryover` object or an `X-Gloo-Reasoning-Carryover` header. Those are how the guarded [Responses](https://docs.gloo.com/api-guides/responses.md#reasoning-across-turns) and [Grounded Responses](https://docs.gloo.com/api-guides/grounded-responses.md#reasoning-across-turns) endpoints report removals, described next.

#### The `reasoning_carryover` object on Responses and Grounded Responses

It appears only when your `input` contained at least one `reasoning` item, or when you asked for `include: ["reasoning.encrypted_content"]`. Every `reasoning` item you send back is removed and listed in `dropped`, including one sent back exactly as it was received, with no `encrypted_content`. On a non-streamed response the object is a top-level field. Here the first turn's `output` was sent back as received, with one reasoning item:

```json theme={null}
{
  "id": "resp_...",
  "object": "response",
  "model": "gloo-openai-gpt-5.4-nano",
  "status": "completed",
  "output": [ ... ],
  "usage": { ... },
  "reasoning_carryover": {
    "received": 1,
    "carried": 0,
    "dropped": [{ "id": "rs_...", "reason": "not_gloo_state" }],
    "not_sealed": null
  }
}
```

| Field | Meaning |
| :- | :- |
| `received` | The number of `reasoning` items in your `input`. |
| `carried` | The number of reasoning items passed to the model as reasoning state. Always `0`. |
| `dropped` | One entry per removed `reasoning` item, in input order: its `id` (`null` when the item had no string `id`, or one longer than 256 characters) and a `reason`. |
| `not_sealed` | `"unsupported_route"` when you asked for `include: ["reasoning.encrypted_content"]`, otherwise `null`. Gloo returns no reasoning state for you to send back. |
| `paired_removed` | The number of other items removed with that reasoning. Omitted when `0`. |

Reasons in `dropped`:

| `reason` | Meaning |
| :- | :- |
| `not_gloo_state` | The item carried reasoning state Gloo did not issue, such as an OpenAI `encrypted_content` blob, or no reasoning state at all, as in a reasoning item sent back exactly as Gloo returned it. These endpoints convert the conversation for the model, so `reasoning` items are never sent to it. |
| `unsupported_route` | The item carried Gloo-issued reasoning state that this endpoint does not use. |
| `invalid` | The item carried a Gloo reasoning-state value in a format Gloo does not recognize. |

On a stream, the counts arrive in the `X-Gloo-Reasoning-Carryover` response header (for example `received=1, carried=0, dropped=1`), and the object arrives as a top-level field of the final `response.completed` or `response.incomplete` event. See [Responses: Reasoning across turns](https://docs.gloo.com/api-guides/responses.md#reasoning-across-turns).

### What to do

* **Keep sending the full conversation in `input` on every request**: your messages, the assistant's messages, function calls and your function call outputs. You can send output items back as you received them; Gloo removes what it can't carry and tells you.
* **Treat reasoning summaries as display text.** Show them to your users if they help; sending them back does not give the model its earlier reasoning.
* **Restate what the model needs.** If a later turn depends on something only a hosted tool call returned, such as web search results, put it in a message: that call can be removed with its turn's reasoning.
* **Don't build on `encrypted_content`.** Gloo does not return it, and removes it when you send it.

For example, a second turn that sends the first turn's `output` back as it was received, reasoning item included, followed by the next user message:

```json theme={null}
{
  "model": "gloo-openai-gpt-5.4-nano",
  "reasoning": { "effort": "low" },
  "input": [
    { "role": "user", "content": "How many positive integers n below 1000 make n^2 + 3n + 5 divisible by 121? Give the count in one sentence." },
    {
      "id": "rs_...",
      "type": "reasoning",
      "content": [],
      "summary": [{ "type": "summary_text", "text": "**Confirming the solution count** ..." }]
    },
    {
      "id": "msg_...",
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "phase": "final_answer",
      "content": [{ "type": "output_text", "text": "So there are 0 positive integers n < 1000.", "annotations": [], "logprobs": [] }]
    },
    { "role": "user", "content": "Now double that number and say only the result." }
  ]
}
```

The request succeeds. Nothing in it carries `encrypted_content`, so for this OpenAI model nothing is removed: there is no `input.reasoning` entry in `ignored_params`. The model reasons afresh from the conversation.

### Multi-turn behavior

For holding history, trimming and switching models across turns, see [Conversations and Context Windows](https://docs.gloo.com/best-practices/conversations-and-context.md). What changes depends on how the model is served.

**OpenAI models served over OpenAI's Responses API, including its reasoning models.** Gloo passes your input items to OpenAI's Responses API, so all of the rules in [What happens to reasoning you send back](#what-happens-to-reasoning-you-send-back) apply. Before this change, `encrypted_content` you sent back was passed to OpenAI and gave the model its earlier reasoning; now it is removed. A reasoning item without `encrypted_content` is passed on as sent when neither its own turn nor the most recent assistant turn lost a reasoning item.

**All other models.** Gloo converts your conversation into the format the model accepts, and `reasoning` items have never been sent to these models. What the model sees does not change. The difference is that removals are now reported in `ignored_params`, which counts only the `reasoning` items that carried `encrypted_content`, or went with one that did; the others are still not sent to the model. An OpenAI-model request that cannot be passed to OpenAI as sent, for example because the first attempt failed before any output, is served this way too.

### Moving off `encrypted_content` and `previous_response_id`

* **If you sent `encrypted_content` back** to keep OpenAI reasoning across turns: the request still succeeds, and the model now reasons from the conversation alone. Code that stores the blob can stay or go; Gloo removes it either way.
* **If you asked for `include: ["reasoning.encrypted_content"]`**: it returns nothing and you can remove it.
* **If you used `previous_response_id` or `conversation`**: send the earlier turns in `input` instead. Don't send these parameters, or `background: true`: for those OpenAI models they are passed to OpenAI as sent and the request can fail, and for other models they have no effect. Gloo sets `store` on requests to OpenAI itself, so a `store` value you send has no effect either. Where they have no effect, they can be listed in `ignored_params`.

## Moving from Completions to Responses

[Completions V2](https://docs.gloo.com/api-guides/completions-v2.md) (`/ai/v2/guarded/chat/completions`) is **fully supported and backwards-compatible**: existing integrations keep working unchanged, and it remains the home of auto-routing and `model_family` selection. Guardrails, output moderation and `tradition` have already reached the Responses shape on the guarded [Responses](https://docs.gloo.com/api-guides/responses.md) endpoint, and RAG [grounding](https://docs.gloo.com/ai-learning-center/gloo-ai-103/the-generation-step.md#grounded-vs-ungrounded-generation) on [Grounded Responses](https://docs.gloo.com/api-guides/grounded-responses.md).

The Responses shape suits new work better: it is the OpenAI-compatible standard and makes multimodal (vision + image generation) first-class. Apart from the URL, the migration is mostly a rename:

| Completions V2 | Responses API |
| :- | :- |
| `POST /ai/v2/guarded/chat/completions` | `POST /ai/v2/guarded/responses` |
| `messages` | `input` |
| `system` role message | `instructions` |
| `max_tokens` | `max_output_tokens` |
| `tradition` | `tradition` (unchanged, on the guarded endpoint) |
| `choices[].message.content` (string) | `output[]` (typed items) |

> [!WARNING]
>
> **The URL is the one row that is not a rename.** Completions V2 applies guardrails, output moderation and `tradition`; this page's endpoint applies none of them. `POST /ai/v2/guarded/responses` is the like-for-like destination: it keeps the governance layer while changing the request shape. Move to `POST /ai/v2/direct/responses` only if dropping that layer is a decision you are making deliberately, and the body stays identical either way.

```json theme={null}
// Completions V2
{
  "model": "gloo-anthropic-claude-sonnet-4.6",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "Hello" }
  ],
  "max_tokens": 256
}
```

```json theme={null}
// Responses API (equivalent)
{
  "model": "gloo-anthropic-claude-sonnet-4.6",
  "instructions": "You are a helpful assistant.",
  "input": [
    { "role": "user", "content": "Hello" }
  ],
  "max_output_tokens": 256
}
```

> [!TIP]
>
> **On a reasoning model, check the limit when you move.** Chat Completions raises a `max_tokens` below 8,192 so the model has room to think; Responses sends `max_output_tokens` as you set it. Size it for the reasoning as well as the answer: see [Set your output limit for reasoning models](https://docs.gloo.com/api-guides/reasoning.md#set-your-output-limit-for-reasoning-models).

`tradition`, guardrails and output moderation are available now on the guarded [Responses](https://docs.gloo.com/api-guides/responses.md) endpoint, and grounded (RAG) responses on [Grounded Responses](https://docs.gloo.com/api-guides/grounded-responses.md). Auto-routing and `model_family` selection remain on [Completions V2](https://docs.gloo.com/api-guides/completions-v2.md), and grounding with citation metadata on [Grounded Completions](https://docs.gloo.com/api-guides/grounded-completions.md). Choose this page's direct endpoint when your application owns its own safety and prompting.

## Next steps

> [card] [Direct Responses tutorial](https://docs.gloo.com/tutorials/direct-responses.md)
>
> Build it step by step: first request, streaming, multi-turn, tools and error handling.

> [card] [API reference](https://docs.gloo.com/api-reference/responses/v2.md)
>
> Every request and response field, with a live playground.

> [card] [Tool Use](https://docs.gloo.com/api-guides/tool-use.md)
>
> Let the model call your functions.

> [card] [Grounded Responses](https://docs.gloo.com/api-guides/grounded-responses.md)
>
> RAG-grounded answers in the Responses API format.

For model IDs and live pricing see [Supported Models](https://docs.gloo.com/api-guides/supported-models.md); to cut cost and latency on repeated prefixes see [Prompt Caching](https://docs.gloo.com/api-guides/prompt-caching.md); for routing, values-alignment and backwards-compatibility see [Completions V2](https://docs.gloo.com/api-guides/completions-v2.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.