Skip to content

Thinking Level

The thinking_level setting is a provider-scoped preference (auto, none, minimal, low, medium, high, xhigh) configured in /config > Models > Text Samplers & Parameters or /personal config. The UI labels xhigh as Extra high. Provider helpers in thinkingControl.ts translate the preference into each API’s fields and accepted values; providers without request-side controls remain unaffected.

Stored in saved_provider_configs.thinking_level and user_saved_provider_configs.thinking_level, the setting defaults to auto and restores automatically when switching active providers.

TomoriBot interprets thinking levels before converting them to vendor fields:

LevelIntended behavior
autoFollows the provider or model default behavior.
noneDisables thinking if supported; otherwise selects the provider’s lowest safe setting.
minimalRequests the lowest enabled reasoning effort.
lowRequests light reasoning effort.
mediumRequests balanced reasoning effort.
highRequests deep reasoning effort.
xhighRequests effort above high where supported, using the provider’s native name; otherwise retains the existing high ceiling or on/off control.

When a turn sets forceReason = true (such as invoking /respond with reasoning enabled), TomoriBot upgrades an effective level of auto or none to high for that individual generation request. The stored configuration row remains unmodified.

For providers accepting numeric token budgets rather than named effort strings, TomoriBot maps non-empty levels using defaults from src/utils/provider/thinkingControl.ts:

  • low: 1,024 tokens (DEFAULT_LOW_BUDGET_TOKENS)
  • medium: 4,096 tokens (DEFAULT_MEDIUM_BUDGET_TOKENS)
  • high: 8,192 tokens (DEFAULT_HIGH_BUDGET_TOKENS)

minimal requests one token before model-specific minimums apply. xhigh retains the existing high budget for the Google 2.5 path.

Gemini behavior branches by model family:

  • Gemini 2.5: Maps to numeric thinkingBudget. auto sends -1. none sends 0 for Flash models and clamps to 128 for Pro models (which cannot disable thinking). Flash-Lite clamps upward to 512.
  • Gemini 3 / 3.1: Maps to enum thinkingLevel (MINIMAL, LOW, MEDIUM, HIGH). auto omits the configuration. none and minimal map to MINIMAL only for Flash releases known to accept it (an allow-list in thinkingControl.ts) and to LOW everywhere else, because Pro models and Gemini 3.7 Flash onward reject MINIMAL while every Gemini 3 model accepts LOW.
  • xhigh uses HIGH on the Gemini 3 path; no unsupported enum is sent.
  • Assistant prefill interaction: Gemini suppresses internal thought tags when continuing assistant prefills, emitting reasoning tokens directly into visible response text. The prefill resolver (resolvePrefillBlocker in src/utils/chat/assistantPrefill.ts) permits server prefills on Gemini only when thinking resolves to thinkingBudget: 0 or thinkingLevel: MINIMAL.

Claude models listed in the profile table in thinkingControl.ts map to adaptive thinking. Each family rejects another family’s off switch with HTTP 400, so an unlisted model receives no thinking fields until its profile is added:

  • auto: thinking: { type: "adaptive" }
  • low / medium / high: thinking: { type: "adaptive" } paired with output_config: { effort }
  • minimal uses low effort. xhigh uses the profile’s accepted output_config.effort: xhigh on newer families, or max on the 4.6 families and Mythos Preview. Anthropic documents different supported effort levels by model; the existing profile table owns this mapping.
  • none: thinking: { type: "disabled" } on most models. Sonnet 5.5 uses { type: "between_tools" } instead, and Opus 5.5 and Fable cannot stop thinking, so they get adaptive thinking at effort: "low".
  • temperature and top_p are omitted whenever thinking is on. Opus 4.7 and later, Sonnet 5 and later, and Haiku 5.5 reject them in every mode, so those models never receive them.

Maps directly to OpenRouter’s reasoning effort parameter:

  • auto: Omits reasoning.
  • none: reasoning: { effort: "none" }.
  • low / medium / high / xhigh: reasoning: { effort }; minimal uses low.

OpenRouter accepts xhigh in its unified reasoning interface. Its routed model and provider determine the available reasoning controls.

  • Expression initialization: Disables thinking so classification output does not compete with reasoning for the response budget.
  • Thinking toggle: V4 models (deepseek-flash and its aliased codenames, deepseek-v4-pro) think at high effort when the switch is omitted, so auto keeps that default and none sends thinking: { type: "disabled" }. low, medium, and high send thinking: { type: "enabled" } with a matching reasoning_effort (DeepSeek folds medium into high). The retired deepseek-chat and deepseek-reasoner codenames are sent as deepseek-flash and follow the same mapping.
  • Extra-high effort: Sends reasoning_effort: "max" with thinking enabled. DeepSeek’s effort mapping aliases a native xhigh request to high, so sending max is required to reach its higher tier. minimal uses low effort.
  • Tool replay constraint: When thinking is enabled, DeepSeek returns HTTP 400 if a replayed assistant tool-call turn omits reasoning_content. TomoriBot enforces the presence of this key (requiresReasoningContentReplay), supplying an empty string fallback ("") when no reasoning was captured.
  • Degradation ladder protection: Parameter degradation lists thinking in mandatoryBodyKeys for DeepSeek, preventing the adapter from dropping thinking while retaining tools (which would produce tool responses that cannot be replayed).

Maps to Z.ai’s thinking flag:

  • auto: Omits thinking.
  • none: thinking: { type: "disabled" }.
  • minimal / low / medium / high / xhigh: thinking: { type: "enabled" }; these levels do not select distinct budgets.
  • Temperature and penalty parameters are omitted when thinking is active.
  • auto omits thinking controls.
  • Ollama: A hostname containing ollama or port 11434 selects the boolean think field. none sends false; every other explicit level sends true.
  • Other OpenAI-compatible endpoints, including CLIProxyAPI: Receive reasoning_effort for explicit levels. minimal maps to low; none, low, medium, high, and xhigh pass through. The endpoint must support the requested value; TomoriBot does not infer its upstream model’s effort capabilities.

The streaming and structured-output custom transports use the same helper. CLIProxyAPI model-name overrides such as (medium) take precedence over the body field, so use an unmodified model ID when TomoriBot should control effort.

NIM serves diverse model families behind one interface. Because different architectures read different parameters, non-auto levels send multi-switch payloads:

  • chat_template_kwargs: { enable_thinking: boolean, thinking: boolean }
  • reasoning_effort: "low" | "medium" | "high"
  • none sends reasoning_effort: "low" rather than "none" because NIM rejects "none" with HTTP 400 on gpt-oss and Llama.
  • minimal maps to low and xhigh maps to high, retaining this adapter’s supported effort range.

The active profile sets the default: GLM 4.6 enables thinking for auto, while Xialong disables it. none disables thinking on both; minimal, low, medium, high, and xhigh enable it without distinct effort budgets. The per-request forceReason override also applies.

GLM represents disabled thinking with /nothink and enabled thinking with <think></think> in its chat template. Xialong appends /nothink to user turns and closes its assistant thinking block when thinking is disabled; when enabled, it opens <think> for generation. Kayra and Erato use story templates and ignore the saved thinking level. No NovelAI text model calls tools.

  • Response parsing: For models outputting thinking tokens (such as Gemma 4 on KoboldCPP), GemmaThinkingParser strips thought blocks from delta.content and routes them to thoughts before tool parsing runs.
  • Thought log suppression: Thought logs are suppressed in channels governed by channel rules.
  • src/constants/thinkingLevels.ts: Thinking level values and localization keys.
  • src/utils/provider/thinkingControl.ts: Provider mapping implementations (buildGoogleThinkingConfig, buildAnthropicThinkingRequest).
  • src/utils/chat/assistantPrefill.ts: Assistant prefill gating against thinking states (resolvePrefillBlocker).
  • src/providers/deepseek/deepseekStreamAdapter.ts: replay policy and mandatory thinking field.
  • src/providers/openaiCompatible/openaiCompatibleMessageBuilder.ts: reasoning_content history replay.