# Thinking effort

Catalog and provider configuration: [model catalog overview](https://fzkuji.github.io/OpenProgram/docs/reference/design/providers/models/overview.html).

## Provider parameters

| Provider | Parameter | Type | Values |
| --- | --- | --- | --- |
| Anthropic | `output_config.effort` | string | low, medium, high, xhigh, max; 3 to 5 by model |
| Anthropic, older models | `thinking.budget_tokens` | token count | continuous |
| OpenAI Responses | `reasoning.effort` | string | minimal, low, medium, high, xhigh |
| OpenAI Chat | `reasoning_effort` | string | low, medium, high |
| Google Gemini | `thinkingConfig.thinkingBudget` | token count | continuous |
| DeepSeek V4 | `reasoning_effort` | string | minimal, low, medium, high, max |
| DeepSeek R1 | none | none | always reasons at full force |
| OpenRouter | the underlying model's | same | from `supported_parameters` |

## Levels

```
ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh" | "max"
```

Plus `off`. Framework names, unrelated to any API's. The picker shows only what the model supports.

## From picker to request

1. `get_thinking_config_for_model` (`interfaces/server/thinking_effort.py`) builds the options from the model's `thinking_levels`.
2. `_normalize_thinking` (`runtime/conversation/session_settings/session_config.py`) checks the choice against `VALID_THINKING`; it is stored per conversation branch. New branches inherit once; switching restores that branch’s choice.
3. `reasoning_from_config` hands it to the turn as `SimpleStreamOptions.reasoning`, kept inside the model's levels by `normalize_reasoning_level` (below).
4. The provider's `stream_simple()` calls `translate_reasoning(provider, model, level)` and writes the answer into its request field, for example `{"output_config": {"effort": "high"}}`.

## A level the model lacks

A level saved for another model, or asked for with `--effort`, may not be in the model's `thinking_levels`. `normalize_reasoning_level` (`thinking_spec.py`) sends the nearest one it has:

- the next stronger level, else the next weaker: `minimal` on a model that starts at `low` sends `low`;
- a name outside the ladder: the model's default.

Follows Pi's `clampThinkingLevel`. Falling back to the default could turn the lightest effort into a middle one; `translate_reasoning` already maps Anthropic's `minimal` to `low` the same way.

## Which levels a model shows

`list_models_for_provider()` in `models/listing/listing.py` takes the first that answers. The picker and `list_enabled_models` read through it.

| Order | Source | Example |
| --- | --- | --- |
| 1 | `thinking_levels` from Fetch: the provider's own models API | Anthropic capabilities, Codex's per-model picker |
| 2 | `model_overrides` in `provider.json` `thinking` | Opus 4.5: 3 levels |
| 3 | Provider-wide `effort_map` or `budget_map` | DeepSeek V4: 5 levels |
| 4 | No spec: OpenAI-compatible fallback, `effort_string` with low, medium, high | groq, mistral, openrouter |
| 5 | Reasoning model still without levels: built-in ladder of `minimal` (not on gpt-5.5), low, medium, high, `xhigh` if supported, max | an override with an empty map |

A model with `reasoning=false` has no levels and no picker.

## Level to API value

`thinking_spec.translate_reasoning` answers the first match:

| Case | Answer |
| --- | --- |
| `wire_format` missing or `none` | `None` |
| Level `off` (or `none`) | the override's `off` (`null`: `None`), else its map's, else the provider map's: `none` on OpenAI Responses, so thinking off sends `effort: "none"` as Pi and Codex do, instead of leaving the server at its default effort. Models older than `none` (o-series, gpt-5 to gpt-5-pro) map it to `null`. `off` is never a picker level |
| Model override with an empty map | `None`: reasons, but no effort parameter is sent |
| Level in the override's map | that value |
| Provider map's value for the level is in the override's values | that value, so Anthropic's `minimal` becomes `low` |
| Otherwise under an override | the default effort if the map has it, else the map's first value |
| `effort_string` | provider `effort_map`, else `default_effort` |
| `budget_tokens` | provider `budget_map`, else `8192` |

The framework passes depth and lets the API choose token use. Gemini and older Anthropic models need a count, hence `budget_map`.

## Finding out what a model supports

| Provider | Method | Precision |
| --- | --- | --- |
| anthropic | `GET /v1/models/{id}`, `capabilities.effort.{level}.supported` | each level |
| deepseek | model id: `v4` reasons with effort, `reasoner` or `r1` without | reasoning, effort |
| openai_codex | OpenAI models API plus model id (o1, o3, o4, gpt-5) | reasoning |
| openai_completions | model id (o1, o3, o4, gpt-5) | reasoning |
| openai_responses | OpenRouter `supported_parameters` contains `reasoning` | reasoning |
| google | model name | reasoning |

models.dev supplies `reasoning` too. Where only that is known, levels come from the provider map.

**How Fetch uses probes**

- Each provider folder may have a `probe_thinking.py` exposing `probe()`.
- During enrichment, `models/listing/fetchers/__init__.py` calls it through `_load_probe` when an entry has no `reasoning`.
- A provider without a probe, or a probe that fails, does not affect Fetch.
- Probes are read-only. `model_overrides` is edited by hand.

## Levels by model

| Provider | Model | Levels | Source |
| --- | --- | --- | --- |
| anthropic | claude-opus-4-8, claude-fable-5 | low to max (5) | override |
| anthropic | claude-sonnet-4-6 | low, medium, high, max | override |
| anthropic | claude-opus-4-5 | low, medium, high | override |
| deepseek | v4-flash, v4-pro | minimal, low, medium, high, max | provider map |
| openai-codex | gpt-5.5 | low, medium, high, xhigh, max (sent as xhigh) | override |
| minimax-cn, openrouter | models with reasoning | low, medium, high | fallback |

**Files**

| File | Holds |
| --- | --- |
| `models/providers/adapters/<provider>/provider.json` | `thinking` key: `wire_format`, maps, `model_overrides`. A standalone `thinking.json` still loads with a deprecation warning. |
| `models/providers/adapters/<provider>/probe_thinking.py` | Reasoning probe for Fetch |
| `models/providers/settings/thinking_spec.py` | Loading, `translate_reasoning`, `derive_thinking_levels`, fallback |
| `models/providers/catalog/models.py` | Fills thinking fields on built-in models at load |
| `models/providers/types.py` | `ThinkingLevel`, `SimpleStreamOptions.reasoning` |
| `interfaces/server/thinking_effort.py` | Picker, `apply_thinking_effort` |
| `models/listing/listing.py` | The one derivation entry |
| `models/listing/fetchers/__init__.py` | Fetch enrichment |
| `models/providers/adapters/anthropic/list_models.py` | Levels from capabilities |
| `runtime/conversation/session_settings/session_config.py` | `VALID_THINKING`, `reasoning_from_config` |

## Implementation status

Not built: trying a model with no information from max downward, skipping on a 400 and caching the result.
