v0.10.5

Reasoning Levels

Last updated


How the six llmrouter.Reasoning levels map onto each vendor and what happens when a model cannot honor one.

Levels


The levels map onto each vendor's own mechanism: Claude's thinking budget (4.5 / 4.1) or adaptive-thinking effort (newer models), Gemini's thinking config, OpenAI's reasoning effort.
LevelStringAlias
ReasoningNonenone—
ReasoningLowlowminimal
ReasoningMediummedium (default)—
ReasoningHighhigh—
ReasoningXHighxhighextra
ReasoningMaxmaxultra

Clamping to the model's range


A request outside a model's range is not rejected; it is clamped to the nearest legal value and logged at debug level. Every adapter implementing ReasoningAgent already does this inside Send; call ClampReasoning yourself only to learn the effective level up front:
  1. if limited, ok := agent.(llmrouter.ReasoningAgent); ok {
  2. low, high := limited.ReasoningLimits()
  3. reasoning = llmrouter.ClampReasoning(reasoning, low, high, "openai", "gpt-5.1")
  4. }

deepseek, cloudflare, and compat ignore the level; claude-code passes it to the CLI as an effort and sends none as low.
Clamping beats failing because the caller usually holds one setting shared across models; letting a lower-ceiling model run at its ceiling is closer to what the caller meant than failing the whole request.

Claude model ranges


claude picks the range and the none behavior from the model ID:
Model ID containsRangeSent for none
-4-5, -4-1none–high (thinking budget)no thinking, temperature 0.2
opus-5low–maxnever sent; none clamps to low
sonnet-5none–maxthinking: {"type": "between_tools"}
fable, mythosnone–maxno thinking field
any other IDnone–maxthinking: {"type": "disabled"}


中文