Skip to content

Commit 52c62ea

Browse files
committed
🤖 fix: enable visible reasoning for Opus 4.5 by adding thinking parameter
Opus 4.5 requires both parameters to show reasoning traces in the UI: - thinking: { type: 'enabled', budgetTokens } - enables visible reasoning - effort: controls how tokens are spent across all output Previously we only passed effort, which controls token spend but doesn't enable the reasoning traces to be returned from the API. _Generated with mux_ Change-Id: I3aa6492d8028fd6ddebaac2123cedd07ae32d4f9 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent f8e7690 commit 52c62ea

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/common/utils/ai/providerOptions.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,29 @@ export function buildProviderOptions(
9393
const isOpus45 = modelName?.includes("opus-4-5") ?? false;
9494

9595
if (isOpus45) {
96-
// Opus 4.5: Use effort parameter for reasoning control
96+
// Opus 4.5: Use effort parameter AND thinking to enable visible reasoning
97+
// effort controls HOW MUCH thinking happens (token spend)
98+
// thinking enables the reasoning traces to be returned
9799
const effort = ANTHROPIC_EFFORT[effectiveThinking];
100+
const budgetTokens = ANTHROPIC_THINKING_BUDGETS[effectiveThinking];
98101
log.debug("buildProviderOptions: Anthropic Opus 4.5 config", {
99102
effort,
103+
budgetTokens,
100104
thinkingLevel: effectiveThinking,
101105
});
102106

103107
const options: ProviderOptions = {
104108
anthropic: {
105109
disableParallelToolUse: false, // Always enable concurrent tool execution
106110
sendReasoning: true, // Include reasoning traces in requests sent to the model
111+
// Enable thinking to get visible reasoning traces
112+
// budgetTokens sets the ceiling; effort controls how eagerly tokens are spent
113+
...(budgetTokens > 0 && {
114+
thinking: {
115+
type: "enabled",
116+
budgetTokens,
117+
},
118+
}),
107119
// Use effort parameter (Opus 4.5 only) to control token spend
108120
// SDK auto-adds beta header "effort-2025-11-24" when effort is set
109121
...(effort && { effort }),

0 commit comments

Comments
 (0)