Add config for adaptive thinking

Fixes #5236
This commit is contained in:
Cohee
2026-03-03 20:10:39 +02:00
parent 04df80d907
commit 3070cf26cd
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -300,7 +300,7 @@ claude:
# Otherwise, you'll just waste money on cache misses.
enableSystemPromptCache: false
# Enables caching of the message history at depth (if supported).
# https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
# https://platform.claude.com/docs/en/build-with-claude/prompt-caching
# -- IMPORTANT! --
# Use with caution. Behavior may be unpredictable and no guarantees can or will be made.
# Set to an integer to specify the desired depth. 0 (which does NOT include the prefill)
@@ -311,6 +311,10 @@ claude:
## 5m: base price x 1.25
## 1h: base price x 2
extendedTTL: false
# Enables adaptive thinking for supported models (Opus 4.6+).
# Disable to enforce legacy thinking mode (with thinking budget).
# https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking
enableAdaptiveThinking: true
# -- GOOGLE GEMINI API CONFIGURATION --
gemini:
# API endpoint version ("v1beta" or "v1alpha")
+2 -1
View File
@@ -97,6 +97,7 @@ const cachingAtDepth = (() => {
const value = getConfigValue('claude.cachingAtDepth', -1, 'number');
return Number.isInteger(value) && value >= 0 ? value : -1;
})();
const enableAdaptiveThinking = getConfigValue('claude.enableAdaptiveThinking', true, 'boolean');
/**
* Cache for cacheable (writing) OpenRouter model IDs.
@@ -228,7 +229,7 @@ async function sendClaudeRequest(request, response) {
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);
const useVerbosity = /^claude-(opus-4-5|opus-4-6|sonnet-4-6)/.test(request.body.model);
const noPrefillModel = /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model);
const isAdaptiveModel = /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model);
const isAdaptiveModel = enableAdaptiveThinking && /^claude-(opus-4-6|sonnet-4-6)/.test(request.body.model);
let fixThinkingPrefill = false;
// Add custom stop sequences
const stopSequences = [];