# Reasoning (https://inference.net/docs/api/reasoning)

Reasoning models think through a problem before they answer. The `reasoning_effort` parameter controls how much thinking a model does. Higher effort improves quality on hard problems and uses more tokens and increases latency.

## Set a reasoning effort

Pass `reasoning_effort` on a chat completion request:

<CodeTabs>

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.inference.net/v1",
  apiKey: process.env.INFERENCE_API_KEY,
});

const response = await client.chat.completions.create({
  model: "claude-opus-5",
  max_tokens: 20000,
  reasoning_effort: "high",
  messages: [{ role: "user", content: "Prove that sqrt(2) is irrational." }],
});

console.log(response.choices[0].message.content);
```

```python
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.inference.net/v1",
    api_key=os.environ["INFERENCE_API_KEY"],
)

response = client.chat.completions.create(
    model="claude-opus-5",
    max_tokens=20000,
    reasoning_effort="high",
    messages=[{"role": "user", "content": "Prove that sqrt(2) is irrational."}],
)

print(response.choices[0].message.content)
```

```bash
curl https://api.inference.net/v1/chat/completions \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5",
    "max_tokens": 20000,
    "reasoning_effort": "high",
    "messages": [{"role": "user", "content": "Prove that sqrt(2) is irrational."}]
  }'
```

</CodeTabs>

## Effort levels

The full set of levels is `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. `none` disables reasoning. Each model supports a subset:

| Model                                                                                                                                                           | Supported levels                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `gpt-5.2`, `gpt-5.4`                                                                                                                                            | `none`, `minimal`, `low`, `medium`, `high`, `xhigh` |
| `gpt-5-mini`, `gpt-5-nano`                                                                                                                                      | `none`, `minimal`, `low`, `medium`, `high`          |
| `gpt-5.5`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-6-astra`, `gpt-6-sol`, `gpt-6.1-sol`, `gpt-6-luna`                                              | `none`, `low`, `medium`, `high`, `xhigh`            |
| `claude-fable-5`, `claude-opus-5-5`, `claude-opus-5`                                                                                                            | `low`, `medium`, `high`, `xhigh`, `max`             |
| `claude-opus-4-8`, `claude-opus-4-7`, `claude-haiku-4-5`                                                                                                        | `none`, `low`, `medium`, `high`, `xhigh`, `max`     |
| `claude-opus-4-6`, `claude-sonnet-4-6`                                                                                                                          | `none`, `low`, `medium`, `high`, `max`              |
| `gemini-2.5-flash`, `gemini-2.5-flash-lite`, `gemini-3-flash-preview`, `gemini-3.1-flash-lite`, `gemini-3.5-flash`, `gemini-3.5-flash-lite`, `gemini-3.6-flash` | `none`, `low`, `medium`, `high`                     |
| `glm-5.2-fast`, `nemotron-3-super`, `qwen3.7-plus`                                                                                                              | `none`, `high`                                      |
| `moonshotai/kimi-k3`, `kimi-k3-fast`, `kimi-k3.1-pro`, `deepseek-v4.1-flash`, `deepseek-v4.1-flash-1017`, `deepseek-v4.1-pro`                                   | `none`, `low`, `high`, `max`                        |
| `gemini-2.5-pro`                                                                                                                                                | `minimal`, `low`, `medium`, `high`                  |
| `gemini-3.1-pro-preview`, `gemini-3.7-flash`, `stepfun/step-5-preview`                                                                                          | `low`, `medium`, `high`                             |
| `glm-5.3`, `glm-5.3-flash`, `z-ai/glm-5.3-fast`, `deepseek-v4-pro-0813`                                                                                         | `low`, `high`, `max`                                |
| `minimax-m3.1-flash`                                                                                                                                            | `low`, `medium`, `high`, `xhigh`, `max`             |
| `grok-4.5`, `grok-4.6`                                                                                                                                          | `low`, `medium`, `high`                             |

The API also accepts some levels that are not listed, because they do the same as another level:

- `minimal` on Claude models runs as `low`.
- `none` on `claude-fable-5`, `claude-opus-5-5`, and `claude-opus-5` runs at the default effort. These models always reason.
- `minimal` on `gpt-5.5` and the `gpt-5.6` models, and `xhigh` on `gpt-5-mini` and `gpt-5-nano`, run at the default effort.

A model absent from this table (or from `reasoning_efforts` in `GET /v1/models`) has no first-party effort dial: the gateway forwards `reasoning_effort` for it, but the platform does not validate or guarantee behavior. Several models accept the parameter and silently ignore it (`gpt-4o`, `gpt-4.1`).

You can also discover support programmatically. Use `GET /v1/models` to fill in your client's model configuration ([field mapping](/docs/integrations/overview/#model-settings-from-v1models)). It returns `context_length` and `max_completion_tokens` when the platform knows them, and a `reasoning_efforts` array when the catalog declares the model's levels:

```json
{
  "id": "claude-opus-5",
  "object": "model",
  "owned_by": "system",
  "context_length": 1000000,
  "max_completion_tokens": 128000,
  "reasoning_efforts": ["low", "medium", "high", "xhigh", "max"]
}
```

On OpenAI and Anthropic models, the API rejects an unsupported level before dispatch with a 400 that names the valid values. Other models forward the request, and the serving engine decides:

```json
{
  "error": {
    "message": "reasoning_effort 'xhigh' is not supported by claude-sonnet-4-6. Supported: none, low, medium, high, max.",
    "type": "invalid_request_error",
    "param": "reasoning_effort",
    "code": "unsupported_value"
  }
}
```

<Callout tone="info">

`gpt-4o` and `gpt-4.1` accept `reasoning_effort` and ignore it. They are not reasoning models, so `usage.completion_tokens_details.reasoning_tokens` is always 0.

</Callout>

## Anthropic models: max_tokens must exceed the thinking budget

On Anthropic models, each effort level reserves a thinking budget, and that budget counts toward `max_tokens`. Your `max_tokens` (or `max_completion_tokens`) must be strictly greater than the budget for the level you request:

| Effort    | Thinking budget (tokens) |
| --------- | ------------------------ |
| `none`    | 0                        |
| `minimal` | 1,024                    |
| `low`     | 1,024                    |
| `medium`  | 2,048                    |
| `high`    | 4,096                    |
| `xhigh`   | 8,192                    |
| `max`     | 16,384                   |

For example, `reasoning_effort: "xhigh"` with `max_tokens: 2000` fails, because the 8,192-token budget does not fit. The API rejects it with a 400 that names both numbers:

```json
{
  "error": {
    "message": "max_tokens (2000) must be greater than the 8192-token thinking budget that reasoning_effort 'xhigh' enables on claude-haiku-4-5. Increase max_tokens or lower reasoning_effort.",
    "type": "invalid_request_error",
    "param": "max_tokens",
    "code": "invalid_value"
  }
}
```

Set `max_tokens` to the budget plus the visible output you want. `max_tokens: 20000` leaves room for every level.

<Callout tone="warning">

Do not send Anthropic's native `thinking` parameter to `/v1/chat/completions`. This endpoint does not map or validate it. Use `reasoning_effort` instead; the gateway maps it to a thinking budget for you.

</Callout>

## Where reasoning appears in the response

Models differ in whether they return the reasoning text:

- Anthropic models and `glm-5.2` return the reasoning text in `reasoning_content` on the message.
- `deepseek-v4.1-flash`, `deepseek-v4.1-flash-1017`, and `deepseek-v4.1-pro` think by default and return the reasoning text in `reasoning_content`. Send `reasoning: {"enabled": false}` or `reasoning_effort: "none"` to turn thinking off. While thinking, `deepseek-v4.1-flash` and `deepseek-v4.1-flash-1017` sample at temperature 1.0 whatever you send; with thinking off they keep your temperature.
- OpenAI models do not return reasoning text. You only see the count in `usage.completion_tokens_details.reasoning_tokens`.

```json
{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Assume sqrt(2) = a/b in lowest terms...",
        "reasoning_content": "The user wants a proof by contradiction..."
      }
    }
  ],
  "usage": {
    "completion_tokens_details": { "reasoning_tokens": 412 }
  }
}
```

Reasoning tokens bill at the model's reasoning rate when one is listed, otherwise at the model's output rate. See each model's page in the [model catalog](/models/) for rates.

## Verbosity

The `verbosity` parameter (`low`, `medium`, or `high`) controls how long the visible answer is, independent of how much the model thinks. Only the gpt-5 family supports it.

```json
{
  "model": "gpt-5.4",
  "reasoning_effort": "high",
  "verbosity": "low",
  "messages": [{ "role": "user", "content": "Summarize this contract." }]
}
```

## Notes

- `reasoning: {"enabled": false}` (the OpenRouter-style object) and `reasoning_effort: "none"` are accepted and translated to the model's native reasoning toggle before dispatch. For models that support one, they disable reasoning. Callers that name their own **external** provider or bring their own key (`x-inference-provider` / provider API key headers) keep full control of the request vocabulary: their `reasoning` object is forwarded untouched. Pinning one of our own origins via `x-inference-provider` (e.g. `inference-net`) only selects routing and does not opt out of translation. An explicit `reasoning_effort` or `chat_template_kwargs.enable_thinking` always wins over the `reasoning` object.
- `reasoning_effort` is validated first-party: an unsupported value returns a 400 naming the valid values instead of reaching the provider. Other keys outside the documented schema pass through to the upstream provider without validation, so a typo in one of those fails at the provider, not at the gateway.