Add config for adaptive thinking Fixes #5236

3070cf26cd9c1bc10e47f32163afdc804a9e1add

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +7 -2Showing whitespace changes
default/config.yaml+5 -1
@@ -300,7 +300,7 @@ claude:
300300 # Otherwise, you'll just waste money on cache misses.
301301 enableSystemPromptCache: false
302302 # Enables caching of the message history at depth (if supported).
303303 # https://docsplatform.anthropicclaude.com/en/docs/en/build-with-claude/prompt-caching
304304 # -- IMPORTANT! --
305305 # Use with caution. Behavior may be unpredictable and no guarantees can or will be made.
306306 # Set to an integer to specify the desired depth. 0 (which does NOT include the prefill)
@@ -311,6 +311,10 @@ claude:
311311 ## 5m: base price x 1.25
312312 ## 1h: base price x 2
313313 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
314318# -- GOOGLE GEMINI API CONFIGURATION --
315319gemini:
316320 # API endpoint version ("v1beta" or "v1alpha")
src/endpoints/backends/chat-completions.js+2 -1
@@ -97,6 +97,7 @@ const cachingAtDepth = (() => {
9797 const value = getConfigValue('claude.cachingAtDepth', -1, 'number');
9898 return Number.isInteger(value) && value >= 0 ? value : -1;
9999})();
100+const enableAdaptiveThinking = getConfigValue('claude.enableAdaptiveThinking', true, 'boolean');
100101
101102/**
102103 * Cache for cacheable (writing) OpenRouter model IDs.
@@ -228,7 +229,7 @@ async function sendClaudeRequest(request, response) {
228229 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);
229230 const useVerbosity = /^claude-(opus-4-5|opus-4-6|sonnet-4-6)/.test(request.body.model);
230231 const noPrefillModel = /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model);
231232 const isAdaptiveModel = enableAdaptiveThinking && /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model);
232233 let fixThinkingPrefill = false;
233234 // Add custom stop sequences
234235 const stopSequences = [];