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

# Reasoning

> Control how much a model thinks with reasoning_effort.

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:

<CodeGroup>
  <Metadata text="reasoning/basic_request" />

  ```typescript TypeScript theme={"system"}
  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);
  ```

  <Metadata text="reasoning/basic_request" />

  ```python Python theme={"system"}
  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)
  ```

  <Metadata text="reasoning/basic_request" />

  ```bash cURL theme={"system"}
  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."}]
    }'
  ```
</CodeGroup>

## 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`, `gpt-5.5`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5-mini`, `gpt-5-nano` | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`        |
| `claude-fable-5`, `claude-opus-5`, `claude-opus-4-8`, `claude-opus-4-7`, `claude-haiku-4-5`                 | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` |
| `claude-opus-4-6`, `claude-sonnet-4-6`                                                                      | `none`, `minimal`, `low`, `medium`, `high`, `max`          |
| `glm-5.2`                                                                                                   | `none`, `low`, `medium`, `high`                            |

You can also discover support programmatically. `GET /v1/models` 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 theme={"system"}
{
  "id": "claude-opus-5",
  "object": "model",
  "owned_by": "system",
  "context_length": 1000000,
  "max_completion_tokens": 128000,
  "reasoning_efforts": ["none", "minimal", "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 theme={"system"}
{
  "error": {
    "message": "reasoning_effort 'xhigh' is not supported by claude-sonnet-4-6. Supported: none, minimal, low, medium, high, max.",
    "type": "invalid_request_error",
    "param": "reasoning_effort",
    "code": "unsupported_value"
  }
}
```

<Note>
  `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.
</Note>

## 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 theme={"system"}
{
  "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.

<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.
</Warning>

## 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.
* OpenAI models do not return reasoning text. You only see the count in `usage.completion_tokens_details.reasoning_tokens`.

```json theme={"system"}
{
  "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. See each model's page 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 theme={"system"}
{
  "model": "gpt-5.2",
  "reasoning_effort": "high",
  "verbosity": "low",
  "messages": [{ "role": "user", "content": "Summarize this contract." }]
}
```

## Notes

* `reasoning: {"enabled": false}` is accepted as a no-op on models served on the Inference.net cluster. Use `reasoning_effort: "none"` to disable reasoning.
* Request keys outside the documented schema pass through to the upstream provider without validation. A typo in a parameter name fails at the provider, not at the gateway.
