Skip to main content

Set the reasoning effort

reasoning_effort works the same way on every provider that supports reasoning:
It takes one of routehub.REASONING_EFFORTS: "none", "minimal", "low", "medium", "high" or "xhigh".

Configure Claude’s thinking directly

Pass thinking= to set Claude’s thinking yourself. It wins over reasoning_effort:
Claude 4.7 and later reject temperature, top_p and top_k on every call. RouteHub raises UnsupportedParamsError, or drops them when you pass drop_params=True.

Read reasoning output

reasoning_content (text) and thinking_blocks (Claude’s signed blocks) exist on the message only when the provider returned reasoning, so read them with getattr. DeepSeek’s reasoning_content comes through the same way. In a Claude tool loop with thinking, send thinking_blocks back on the assistant message, as Anthropic requires. Appending message.model_dump(exclude_none=True) does this for you. See Tool calling.

Count reasoning tokens

Thinking tokens are reported in usage.completion_tokens_details.reasoning_tokens and counted in completion_tokens, as OpenAI does:
Gemini’s OpenAI-compatible endpoint bills reasoning in total_tokens only, so RouteHub fills in the difference. An answer that spent its whole max_tokens budget thinking comes back with finish_reason == "length", empty content, and a usage block that adds up.

Check reasoning support

Pass drop_params=True to drop reasoning_effort on models that don’t support reasoning instead of failing.