Add config for adaptive thinking Fixes #5236
| @@ -300,7 +300,7 @@ claude: | ||
| 300 | 300 | # Otherwise, you'll just waste money on cache misses. |
| 301 | 301 | enableSystemPromptCache: false |
| 302 | 302 | # Enables caching of the message history at depth (if supported). |
| 303 | 303 | # https://docsplatform.anthropicclaude.com/en/docs/en/build-with-claude/prompt-caching |
| 304 | 304 | # -- IMPORTANT! -- |
| 305 | 305 | # Use with caution. Behavior may be unpredictable and no guarantees can or will be made. |
| 306 | 306 | # Set to an integer to specify the desired depth. 0 (which does NOT include the prefill) |
| @@ -311,6 +311,10 @@ claude: | ||
| 311 | 311 | ## 5m: base price x 1.25 |
| 312 | 312 | ## 1h: base price x 2 |
| 313 | 313 | extendedTTL: false |
| 314 | + # Enables adaptive thinking for supported models (Opus 4.6+). | |
| 315 | + # Disable to enforce legacy thinking mode (with thinking budget). | |
| 316 | + # https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking | |
| 317 | + enableAdaptiveThinking: true | |
| 314 | 318 | # -- GOOGLE GEMINI API CONFIGURATION -- |
| 315 | 319 | gemini: |
| 316 | 320 | # API endpoint version ("v1beta" or "v1alpha") |
| @@ -97,6 +97,7 @@ const cachingAtDepth = (() => { | ||
| 97 | 97 | const value = getConfigValue('claude.cachingAtDepth', -1, 'number'); |
| 98 | 98 | return Number.isInteger(value) && value >= 0 ? value : -1; |
| 99 | 99 | })(); |
| 100 | +const enableAdaptiveThinking = getConfigValue('claude.enableAdaptiveThinking', true, 'boolean'); | |
| 100 | 101 | |
| 101 | 102 | /** |
| 102 | 103 | * Cache for cacheable (writing) OpenRouter model IDs. |
| @@ -228,7 +229,7 @@ async function sendClaudeRequest(request, response) { | ||
| 228 | 229 | const isLimitedSampling = /^claude-(opus-4-1|sonnet-4-5|haiku-4-5|opus-4-5|opus-4-6|sonnet-4-6)/.test(request.body.model); |
| 229 | 230 | const useVerbosity = /^claude-(opus-4-5|opus-4-6|sonnet-4-6)/.test(request.body.model); |
| 230 | 231 | const noPrefillModel = /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model); |
| 231 | 232 | const isAdaptiveModel = enableAdaptiveThinking && /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model); |
| 232 | 233 | let fixThinkingPrefill = false; |
| 233 | 234 | // Add custom stop sequences |
| 234 | 235 | const stopSequences = []; |