Commit 27ef4af
authored
🤖 fix: enable reasoning for Claude Opus 4.5 (#754)
## Summary
Fixes missing reasoning traces in the UI when using Claude Opus 4.5.
## Problem
Opus 4.5 supports two separate but complementary parameters for
reasoning:
1. **`effort`** (new in Opus 4.5): Controls how eagerly Claude spends
tokens across ALL output (text, tool calls, and thinking). Values:
`low`, `medium`, `high`.
2. **`thinking`** (extended thinking): Enables visible reasoning traces
with a token budget. This is what makes the "Thinking..." UI appear.
We were only passing `effort`, which controls token spend but **doesn't
enable the reasoning traces to be returned from the API**. The
`thinking` parameter must also be set for reasoning to be visible.
## Solution
For Opus 4.5, now pass both parameters:
```typescript
{
anthropic: {
thinking: {
type: "enabled",
budgetTokens: 20000, // Enables visible reasoning traces
},
effort: "high", // Controls token spend eagerness
}
}
```
## How these parameters interact
From [Anthropic's
docs](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking#effort-with-extended-thinking):
> The effort parameter works alongside the thinking token budget when
extended thinking is enabled. These two controls serve different
purposes:
> - **Effort parameter**: Controls how Claude spends all
tokens—including thinking tokens, text responses, and tool calls
> - **Thinking token budget**: Sets a maximum limit on thinking tokens
specifically
>
> The effort parameter can be used with or without extended thinking
enabled.
| Configuration | Behavior |
|---------------|----------|
| `effort` only | Controls token spend, no visible reasoning |
| `thinking` only | Shows reasoning with default budget |
| `effort` + `thinking` | Shows reasoning WITH token spend control |
## Testing
- Verified reasoning traces now appear in UI when using Opus 4.5
- `make typecheck` passes
_Generated with `mux`_
Signed-off-by: Thomas Kosiewski <tk@coder.com>1 parent 08e02a6 commit 27ef4af
File tree
6 files changed
+50
-40
lines changed- src
- browser
- components
- utils/thinking
- common
- types
- utils/ai
6 files changed
+50
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
54 | 52 | | |
55 | 53 | | |
56 | 54 | | |
| |||
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
119 | | - | |
| 117 | + | |
120 | 118 | | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
| 122 | + | |
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
98 | | - | |
99 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 41 | | |
49 | 42 | | |
50 | 43 | | |
| |||
59 | 52 | | |
60 | 53 | | |
61 | 54 | | |
62 | | - | |
63 | | - | |
| 55 | + | |
64 | 56 | | |
65 | 57 | | |
66 | 58 | | |
| |||
72 | 64 | | |
73 | 65 | | |
74 | 66 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 67 | | |
81 | 68 | | |
82 | 69 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
38 | | - | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
50 | | - | |
| 58 | + | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| 65 | + | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
98 | 103 | | |
99 | | - | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
107 | 121 | | |
108 | 122 | | |
109 | | - | |
| 123 | + | |
110 | 124 | | |
111 | 125 | | |
112 | 126 | | |
| |||
0 commit comments