> ## 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 Completions

> POST /ai/v2/direct/chat/completions — OpenAI-compatible Chat Completions straight to the model you name, with no guardrails, moderation, values-alignment, or routing in between.

**Direct Completions** is the OpenAI-compatible Chat Completions format on a [direct endpoint](https://docs.gloo.com/api-guides/endpoint-types.md): your request goes straight to the `model` you name, and Gloo adds nothing between your prompt and the 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.

Use it when you already have tooling built on the Chat Completions request shape and your application owns its own safety and prompting. If you're starting fresh, prefer [Direct Responses](https://docs.gloo.com/api-guides/direct-responses.md): equally direct, with a more capable request shape and first-class vision and image generation.

For Gloo's guarded pipeline ([guardrails](https://docs.gloo.com/ai-learning-center/gloo-ai-102/guardrails-and-values.md), output moderation, values-alignment (`tradition`), `model_family` selection, [auto-routing](https://docs.gloo.com/getting-started/glossary.md#auto-routing)), use [Completions](https://docs.gloo.com/api-guides/completions-v2.md) instead. The two share a request shape; they differ in what runs around it.

## Quick start

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

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

The request and response shapes mirror the OpenAI Chat Completions API, so existing SDKs and tooling work by pointing the base URL at Gloo. For every parameter, see the [Direct Completions API reference](https://docs.gloo.com/api-reference/completions/direct.md).

## What runs, and what doesn't

Identical to every direct endpoint; see [Endpoint Types](https://docs.gloo.com/api-guides/endpoint-types.md#what-runs-and-what-does-not) for the full list. In short: authentication, entitlement, metering, the model catalog, provider resiliency and [rate limits](https://docs.gloo.com/api-reference/general/limits.md) all still apply; guardrails, output moderation, values-alignment and routing deliberately do not.

## Output limit

| Parameter | Type | Required | Description |
| :- | :- | :- | :- |
| `max_tokens` | integer | No | Maximum output, in tokens. It holds the reasoning as well as the answer. When the model is reasoning, a value below 8,192 is raised to 8,192; a larger one is sent as you set it, up to the model's maximum output. With `reasoning_effort: "none"` on a model that can turn reasoning off (`can_disable: true` in the model catalog), the value is sent as you set it, whichever provider the model comes from. With no value, a reasoning model gets its full output allowance (up to 65,536). A value of `0` or less counts as not set. |
| `max_completion_tokens` | integer | No | The OpenAI name for the same limit. If you send both, `max_completion_tokens` wins. |

A response that reached the limit ends with `finish_reason: "length"`. If that comes with little or no answer text, raise the limit or lower the reasoning effort. See [Set your output limit for reasoning models](https://docs.gloo.com/api-guides/reasoning.md#set-your-output-limit-for-reasoning-models).

## Sampling parameters

`temperature`, `top_p`, `frequency_penalty` and `presence_penalty` are sent to the model when it takes them. If you don't set `temperature`, the model's own default applies. If your requests relied on a default [temperature](https://docs.gloo.com/ai-learning-center/gloo-ai-101/prompting-and-generation.md#temperature), set one yourself, for example `temperature: 0.7`.

Two [model families](https://docs.gloo.com/getting-started/glossary.md#model-family) don't always take `temperature` and `top_p`:

| Models | `temperature` and `top_p` |
| :- | :- |
| **Claude 5**: Opus 5.5, Sonnet 5.5, Haiku 5.5, and the earlier Opus 5, Sonnet 5, Fable 5 and Fable 5.1 | Not applied. These models always reason. |
| **OpenAI GPT-5 and later** | Applied only while reasoning is off: with `reasoning_effort: "none"` on a model that can turn reasoning off (`can_disable: true` in the [model catalog](https://docs.gloo.com/api-reference/get-models/v2.md)), or with no effort on GPT-5.1 to GPT-5.4, which don't reason unless asked. Not sent at any other effort, or on models that always reason, such as GPT-6 Astra and the Pro models without `none`. |

A parameter the model can't use doesn't fail the request. The request runs without it, and the response lists it in `ignored_params`:

```json theme={null}
"ignored_params": {
  "params": ["temperature=0.2"],
  "model": "gloo-anthropic-claude-sonnet-5.5",
  "reason": "These parameters were ignored and did not affect the response: the model does not accept them, or the endpoint serving the model does not support them."
}
```

On a stream, the names arrive in a response header instead: `X-Ignored-Params: temperature, top_p`. The header is sent before the first chunk, so it describes the request as it started; see [Provider failover](https://docs.gloo.com/api-guides/provider-failover.md#what-you-observe).

Match on the names in `params`, not on `reason`, which can change. Only parameters you sent are listed, and the field and header are left out when nothing was ignored. A field whose name isn't a plain parameter name (letters, digits, `_`, `.` or `-`, up to 64 characters) is listed once as `unrecognized_parameter`, and past 32 entries the rest are listed once as `more_parameters`. A `reasoning_effort` the model doesn't run as sent is listed the same way; see [Effort levels](https://docs.gloo.com/api-guides/reasoning.md#effort-levels).

## Reasoning summaries

Send `reasoning_effort` (`none`, `minimal`, `low`, `medium`, `high`, and `xhigh` or `max` on models that take them) to set how much a [reasoning model](https://docs.gloo.com/ai-learning-center/gloo-ai-102/models-that-think.md) thinks. A graded effort also asks for a summary of the model's reasoning. When the model returns one, a non-streamed answer carries it in `choices[0].message.reasoning_content`, and a stream carries it in `delta.reasoning_content`. `none` asks for no reasoning and no summary. The nested form `reasoning: {"effort": ...}` is accepted too; `reasoning_effort` wins if you send both. Send a level the model lists. Another level runs at the nearest level below it that the model lists, or at the model's lowest level when none is below, and is listed in `ignored_params` (`X-Ignored-Params` on a stream). See [Effort levels](https://docs.gloo.com/api-guides/reasoning.md#effort-levels). The [model catalog](https://docs.gloo.com/api-reference/get-models/v2.md) shows which efforts each model takes (`reasoning.effort_levels`) and whether it returns a summary (`reasoning.returns_summary`).

### Claude 5 models

Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5, and the earlier Opus 5, Sonnet 5, Fable 5 and Fable 5.1, return a reasoning summary when you send a `reasoning_effort` other than `none`, on streamed and non-streamed requests.

* **`none` can't turn their reasoning off.** Without `reasoning_effort` these Claude models reason when they decide a request needs it, and return no summary. `none` cannot turn reasoning off: it is listed in `ignored_params` and returns no summary (an answer from a fallback provider may still include reasoning). `minimal` runs as `low` and is listed.
* **They decide how much to reason.** At a low effort on an easy prompt, the model may return no summary. Fable 5.1 often returns a summary only at `xhigh` or `max`.
* **Streamed reasoning can repeat.** If the provider fails after a stream has sent reasoning but no answer text, Gloo can send the request to another provider instead of ending the stream with an error. The new provider's reasoning then arrives in the same stream, starting from the beginning. No chunk marks the switch. If you show reasoning as it arrives, be ready for it to start over, or show only the answer in `delta.content`. Once answer text has been sent, the stream is not switched this way.

The guarded and [grounded endpoints](https://docs.gloo.com/api-guides/endpoint-types.md#grounded-endpoints) return these summaries the same way, streamed and non-streamed. See [Completions](https://docs.gloo.com/api-guides/completions-v2.md#reasoning-summaries).

For examples on every endpoint and in every language, see the [Reasoning tutorial](https://docs.gloo.com/tutorials/reasoning.md#examples-by-endpoint).

### Example

A request to Claude Opus 5.5 with a reasoning effort:

```bash theme={null}
curl -X POST 'https://platform.ai.gloo.com/ai/v2/direct/chat/completions' \
  -H "Authorization: Bearer ${GLOO_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gloo-anthropic-claude-opus-5.5",
    "reasoning_effort": "medium",
    "max_tokens": 8192,
    "messages": [
      { "role": "user", "content": "A train leaves at 9:40 and arrives at 13:05. How long is the trip? Answer in one sentence." }
    ]
  }'
```

The summary comes back beside the answer:

```json theme={null}
{
  "id": "msg_...",
  "object": "chat.completion",
  "created": 1792527248,
  "model": "gloo-anthropic-claude-opus-5.5",
  "provider": "Gloo AI",
  "system_fingerprint": null,
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "The trip takes **3 hours and 25 minutes**.",
        "reasoning_content": "From 9:40 to 13:05 is 3 hours 25 minutes.\n\n"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 45,
    "completion_tokens": 42,
    "total_tokens": 87,
    "prompt_tokens_details": { "cached_tokens": 0, "cache_write_tokens": 0 },
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}
```

With `"stream": true`, the summary arrives before the answer, in chunks whose `delta` has `reasoning_content` and a `null` `content`, followed by the answer in `delta.content`:

```text theme={null}
data: {"id":"msg_...","object":"chat.completion.chunk","created":1792527249,"model":"gloo-anthropic-claude-opus-5.5","choices":[{"index":0,"delta":{"role":null,"content":null,"function_call":null,"refusal":null,"tool_calls":null,"reasoning_content":"From"},"finish_reason":null,"logprobs":null}],"system_fingerprint":null,"provider":"Gloo AI"}

data: {"id":"msg_...","object":"chat.completion.chunk","created":1792527249,"model":"gloo-anthropic-claude-opus-5.5","choices":[{"index":0,"delta":{"role":null,"content":null,"function_call":null,"refusal":null,"tool_calls":null,"reasoning_content":" 9:40 to 13"},"finish_reason":null,"logprobs":null}],"system_fingerprint":null,"provider":"Gloo AI"}

...

data: {"id":"msg_...","object":"chat.completion.chunk","created":1792527249,"model":"gloo-anthropic-claude-opus-5.5","choices":[{"index":0,"delta":{"role":null,"content":"The trip las","function_call":null,"refusal":null,"tool_calls":null},"finish_reason":null,"logprobs":null}],"system_fingerprint":null,"provider":"Gloo AI"}
```

## Images

Models that read images take them as `image_url` content parts, in the Chat Completions shape. Every Claude, Gemini and Grok chat model reads images, as does every OpenAI GPT model except the open-weight GPT OSS models; check `supports_vision` in the [catalog](https://docs.gloo.com/api-guides/supported-models.md) for the others.

```json theme={null}
{
  "model": "gloo-anthropic-claude-sonnet-5.5",
  "messages": [
    { "role": "user", "content": [
      { "type": "text", "text": "What can I cook with what's in this fridge?" },
      { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..." } }
    ]}
  ]
}
```

`url` takes a base64 `data:` URI or a public `https://` link, and an optional `detail` goes next to it. For worked examples, see [Understand Images with Claude](https://docs.gloo.com/tutorials/understand-images.md) (on Direct Responses, the same models) and [Images in Conversations](https://docs.gloo.com/best-practices/images-in-conversations.md).

## When a request fails

Every error follows 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` that says what happened and what to do, and an `X-Gloo-Error-Code` header to branch on. A stream that fails before any output gets a real HTTP status, not `200`. Cases worth handling explicitly:

* **No provider could serve the model:** `503` `provider_unavailable` (`2002`), `retryable: true`. Gloo tries every provider that serves the model first. Retry with exponential backoff. See [Every provider unavailable](https://docs.gloo.com/api-reference/general/errors.md#every-provider-unavailable).
* **A temporary problem on Gloo's side:** `503` `service_unavailable` (`3003`), `retryable: true`, with a `Retry-After` header. Your request and key were not at fault: wait, then retry.
* **The provider declined the request under its content policy:** `400` `provider_content_policy_violation`, with `reasons` when the provider named categories, or a `finish_reason: "content_filter"` ending once output has started. Rephrase the request or choose a different model; do not retry it unchanged. See [Content Policy Refusals](https://docs.gloo.com/api-reference/general/errors.md#content-policy-refusals-direct-endpoints).

For retry budgets and backoff with jitter, see [Error Handling and Retries](https://docs.gloo.com/best-practices/error-handling-and-retries.md).

## Choosing between the direct formats

Use Direct Completions to keep existing Chat Completions tooling on its request shape. For new integrations, and for vision or image generation, use [Direct Responses](https://docs.gloo.com/api-guides/direct-responses.md); only the request shape differs.

For the full comparison across guarded, direct and grounded endpoints, see [Which endpoint should I use?](https://docs.gloo.com/api-guides/endpoint-types.md#which-endpoint-should-i-use).

## Next steps

> [card] [Direct Responses](https://docs.gloo.com/api-guides/direct-responses.md)
>
> The Responses format, straight to the model.

> [card] [Endpoint Types](https://docs.gloo.com/api-guides/endpoint-types.md)
>
> Compare guarded, direct, and grounded endpoints.

> [card] [Supported Models](https://docs.gloo.com/api-guides/supported-models.md)
>
> Model IDs, capabilities, and pricing.

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


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