> For the complete documentation index, see [llms.txt](https://docs.cortecs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cortecs.ai/routing/reasoning.md).

# Reasoning

Reasoning lets a model spend more time working through a request before producing its final answer. This can help with tasks such as coding, mathematics, and complex planning, although more reasoning may also increase response time and token usage. Models with this capability are marked with the **Reasoning** tag in the [filtered model list](https://cortecs.ai/serverlessModels?tags=Reasoning).

A model does not necessarily show its reasoning in the response. Some return reasoning content or a summary alongside the final answer, while others keep it hidden. What you see depends on the model and provider.

## Controlling reasoning

Set `reasoning_effort` in your request to choose how much reasoning to ask for:

```json
{ "reasoning_effort": "medium" }
```

Cortecs aims to support `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. As a starting point, use a lower level when speed matters and a higher level for more demanding tasks. The actual effect on speed, cost, and answer quality depends on the model.

| Requested effort          | General intent                                            |
| ------------------------- | --------------------------------------------------------- |
| `none`                    | Turn thinking off, if the model allows it                 |
| `minimal` or `low`        | Use less reasoning for simpler or time-sensitive requests |
| `medium`                  | Balance reasoning with response time                      |
| `high`, `xhigh`, or `max` | Allow more reasoning for difficult requests               |

### How Cortecs maps effort

Models and providers do not all offer the same levels. If a model does not support the level you request, Cortecs uses the next lower available reasoning level, excluding `none` unless you requested it. If there is no lower reasoning level, it uses the lowest available higher level. These examples show how the mapping works:

| Requested effort | Levels available on the model | Cortecs uses                    | Why                                                         |
| ---------------- | ----------------------------- | ------------------------------- | ----------------------------------------------------------- |
| `medium`         | `low`, `medium`, `high`       | `medium`                        | The requested level is available                            |
| `medium`         | `low`, `high`                 | `low`                           | The next lower level is available                           |
| `minimal`        | `none`, `low`, `high`         | `low`                           | `none` is excluded unless requested                         |
| `minimal`        | `low`, `high`                 | `low`                           | There is no lower level, so the lowest higher level is used |
| `none`           | `none`, `low`, `high`         | `none`                          | Thinking can be turned off                                  |
| `none`           | `low`, `high`                 | `low`                           | Thinking cannot be turned off, so the lowest level is used  |
| `high`           | No adjustable levels          | Ignored                         | The model does not support effort settings                  |
| Not provided     | `low`, `medium`, `high`       | A default level, where possible | No effort was requested                                     |

If you request `none`, Cortecs turns thinking off where the model supports it. When thinking cannot be disabled, Cortecs uses the lowest available reasoning level. If the model does not support adjustable reasoning effort at all, the requested level is ignored.

If you omit `reasoning_effort`, Cortecs tries to give models a consistent default across providers. You can also pass provider-specific settings, such as `chat_template_kwargs` or `output_config`, where supported. Their meaning and effects can vary between providers, so equivalent-looking settings may produce different results.

## Provider behavior

### Anthropic

Anthropic models can use **adaptive thinking**, **extended thinking**, or both, depending on the model. Some models have thinking on by default; others require you to enable it. The standard `reasoning_effort` setting works across these modes when the model supports it.

**Adaptive thinking** lets the model decide how much reasoning a request needs. On supported models, you can use Anthropic's `thinking` and `output_config` settings to choose this mode and adjust its effort:

```python
extra_body={
    "thinking": {"type": "adaptive", "display": "summarized"},
    "output_config": {"effort": "high"}
}
```

If the model supports it, `thinking.display` can be set to `"summarized"` to return a summary of the reasoning or `"omitted"` to hide it. Hiding reasoning content does not turn thinking off.

**Extended thinking** uses a fixed token budget instead of letting the model choose one dynamically. You can provide a custom budget on models that support this mode:

```python
extra_body={
    "thinking": {"type": "enabled", "budget_tokens": 2048}
}
```

Keep the thinking budget below `max_tokens`. Some newer Anthropic models support adaptive thinking only and reject `thinking.type: "enabled"`. Whether thinking can be turned off also varies by model. Where supported, use `reasoning_effort: "none"` or `thinking: {"type": "disabled"}` to disable it. Check [Anthropic's supported-model configuration table](https://platform.claude.com/docs/en/build-with-claude/thinking-troubleshooting#supported-models) before using a provider-specific mode.

### Google Gemini and Vertex AI

Many Gemini reasoning models think by default. Cortecs translates `reasoning_effort` into the control supported by the selected model: a thinking budget for Gemini 2.5 models, or a thinking level for newer Gemini models. For a Gemini 2.5 model that supports a custom numeric budget, you can use a provider-specific setting instead of `reasoning_effort`:

```python
extra_body={
    "thinking": {"type": "enabled", "budget_tokens": 2048}
}
```

Support for turning thinking off depends on the model. For example, some Gemini Flash models allow it, while Gemini Pro models may require at least a small amount of thinking. In that case, `none` requests the lowest available level. See [Google's thinking guide](https://ai.google.dev/gemini-api/docs/generate-content/thinking) for model-specific options.

### OpenAI and Azure OpenAI

OpenAI and Azure OpenAI reasoning models use `reasoning_effort` to control how much work the model does before answering. The supported values vary by model; Cortecs applies the mapping described above when a requested level is unavailable. Azure OpenAI follows the same general behavior for OpenAI models.

These models do not return their internal reasoning text. Reasoning tokens still count toward output usage, so a short visible answer can use more completion tokens than its length suggests. See [Azure OpenAI's reasoning guide](https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning) for more on model support and token usage.

{% hint style="info" %}
Reasoning settings are mapped as accurately as possible, but model and provider behavior can change, and some differences may not be reflected immediately. If you have problems, contact <support@cortecs.ai>.
{% endhint %}
