Thinking configuration model
src/utils/thinking.ts defines three runtime states:
adaptiveenabledwith an explicit token budgetdisabled
Default behavior
shouldEnableThinkingByDefault() enables thinking unless one of two conditions applies:
MAX_THINKING_TOKENSis set to0- settings explicitly set
alwaysThinkingEnabledtofalse
Provider-aware support
Thinking support is model-aware and provider-aware.modelSupportsThinking() in src/utils/thinking.ts behaves conservatively on third-party providers:
- first-party and Foundry: all Claude 4+ models are treated as thinking-capable
- Bedrock and Vertex: only Opus 4+ and Sonnet 4+ are treated as thinking-capable by default
modelSupportsAdaptiveThinking() explicitly allowlists the 4.6 Opus and Sonnet families in this snapshot.
Ultrathink
ultrathink is a real runtime concept, not just prompt wording.
The source provides:
isUltrathinkEnabled()hasUltrathinkKeyword()findThinkingTriggerPositions()
- the
ULTRATHINKbuild feature - the
tengu_turtle_carbonGrowthBook flag
Why the trigger utilities exist
The presence of keyword-detection helpers means the UI and runtime can respond to the literal wordultrathink rather than merely forwarding it as normal user text.
That is stronger evidence than a system prompt comment would be.
Budget implications
Thinking is tied to token budgets. The main loop imports helpers such asgetMaxThinkingTokensForModel() and consults model capability checks before attaching thinking config to requests.
So the runtime decision is:
- does this model support thinking?
- does it support adaptive thinking?
- is thinking enabled by settings or env?
- what token budget is available for this turn?