@@ -33,8 +33,11 @@ type claudeCapabilities struct {
3333 supportsXHigh bool
3434 supportsMax bool
3535 strictSampling bool
36+ // offEffortAtMostHigh marks models that accept effort high or below only
37+ // while thinking is off (disabled or between_tools).
38+ offEffortAtMostHigh bool
3639 // defaultEffort is the effort the model runs at when a request sets none:
37- // medium on Claude Opus 5.5 and high on every other model
40+ // medium on Claude Opus 5.5 and Haiku 5.5 and high on every other model
3841 // (https://platform.claude.com/docs/en/build-with-claude/effort).
3942 defaultEffort Effort
4043}
@@ -50,24 +53,27 @@ func claudeCapabilitiesFor(model string) claudeCapabilities {
5053 capabilities .supportsManual = false
5154 capabilities .defaultThinking = true
5255 capabilities .supportsDisable = false
56+ capabilities .supportsEffort = true
5357 capabilities .supportsXHigh = true
5458 capabilities .supportsMax = true
5559 capabilities .strictSampling = true
5660 case strings .HasPrefix (model , "claude-mythos-preview" ):
5761 capabilities .adaptive = true
5862 capabilities .defaultThinking = true
5963 capabilities .supportsDisable = false
64+ capabilities .supportsEffort = true
6065 capabilities .supportsMax = true
6166 capabilities .strictSampling = true
6267 case strings .HasPrefix (model , "claude-opus-5-5" ),
6368 strings .HasPrefix (model , "claude-sonnet-5-5" ):
6469 // Opus 5.5 cannot turn thinking off at all; Sonnet 5.5 turns it off
65- // with between_tools.
70+ // with between_tools, which takes effort high or below only .
6671 capabilities .adaptive = true
6772 capabilities .supportsManual = false
6873 capabilities .defaultThinking = true
6974 capabilities .supportsDisable = false
7075 capabilities .disableAsBetweenTools = strings .HasPrefix (model , "claude-sonnet-5-5" )
76+ capabilities .offEffortAtMostHigh = capabilities .disableAsBetweenTools
7177 if strings .HasPrefix (model , "claude-opus-5-5" ) {
7278 capabilities .defaultEffort = EffortMedium
7379 }
@@ -77,13 +83,19 @@ func claudeCapabilitiesFor(model string) claudeCapabilities {
7783 capabilities .strictSampling = true
7884 case strings .HasPrefix (model , "claude-opus-5" ),
7985 strings .HasPrefix (model , "claude-sonnet-5" ),
86+ strings .HasPrefix (model , "claude-haiku-5" ),
8087 strings .HasPrefix (model , "claude-opus-4-8" ),
8188 strings .HasPrefix (model , "claude-opus-4-7" ):
8289 capabilities .adaptive = true
8390 capabilities .supportsManual = false
84- if strings .HasPrefix (model , "claude-opus-5" ) || strings .HasPrefix (model , "claude-sonnet-5" ) {
91+ if strings .HasPrefix (model , "claude-opus-5" ) || strings .HasPrefix (model , "claude-sonnet-5" ) || strings . HasPrefix ( model , "claude-haiku-5" ) {
8592 capabilities .defaultThinking = true
8693 }
94+ // Opus 5 and Haiku 5.5 reject disabled thinking with xhigh or max.
95+ capabilities .offEffortAtMostHigh = strings .HasPrefix (model , "claude-opus-5" ) || strings .HasPrefix (model , "claude-haiku-5" )
96+ if strings .HasPrefix (model , "claude-haiku-5" ) {
97+ capabilities .defaultEffort = EffortMedium
98+ }
8799 capabilities .supportsEffort = true
88100 capabilities .supportsXHigh = true
89101 capabilities .supportsMax = true
@@ -120,12 +132,6 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
120132 diagnostics = append (diagnostics , normalizeDiagnostics ... )
121133 }
122134 capabilities := claudeCapabilitiesFor (model )
123- if disabledWithEffort {
124- diagnostics = append (diagnostics , claudeReasoningDiagnostic (
125- "claude_disabled_effort_ignored" ,
126- fmt .Sprintf ("model %q cannot apply effort %q while thinking is disabled; the effort was ignored" , model , intent .Effort ),
127- ))
128- }
129135 if ! intent .HasStrength () {
130136 if intent .IncludeThoughts != nil && capabilities .adaptive && capabilities .defaultThinking {
131137 thinking := & dto.Thinking {Type : "adaptive" }
@@ -147,15 +153,27 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
147153 }
148154
149155 if intent .Mode == ModeDisabled || intent .Effort == EffortNone {
156+ // Effort works without thinking, so a requested level is sent at one
157+ // the model accepts while thinking is off.
158+ outputEffort := Effort ("" )
159+ if disabledWithEffort && (capabilities .supportsDisable || capabilities .disableAsBetweenTools ) {
160+ outputEffort = ClaudeEffort (model , intent .Effort )
161+ if capabilities .offEffortAtMostHigh && (outputEffort == EffortXHigh || outputEffort == EffortMax ) {
162+ outputEffort = EffortHigh
163+ }
164+ diagnostics = append (diagnostics , claudeEffortDiagnostics (model , intent .Effort , outputEffort )... )
165+ }
150166 if capabilities .disableAsBetweenTools {
151167 // between_tools takes no other thinking field and runs at the
152- // default effort, which is within its "high or below" limit.
168+ // default effort or the requested one, both within its "high or
169+ // below" limit.
153170 diagnostics = append (diagnostics , claudeReasoningDiagnostic (
154171 "claude_thinking_disable_as_between_tools" ,
155172 fmt .Sprintf ("model %q rejects disabled thinking; using between_tools, its lowest thinking setting" , model ),
156173 ))
157174 return ClaudeRender {
158175 Thinking : & dto.Thinking {Type : "between_tools" },
176+ OutputEffort : outputEffort ,
159177 EffectiveEffort : EffortNone ,
160178 ClearSampling : capabilities .strictSampling ,
161179 Diagnostics : diagnostics ,
@@ -175,7 +193,6 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
175193 thinking .Display = "omitted"
176194 }
177195 }
178- outputEffort := Effort ("" )
179196 effectiveEffort := capabilities .defaultEffort
180197 if capabilities .supportsEffort {
181198 outputEffort = EffortLow
@@ -193,6 +210,7 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
193210 }
194211 return ClaudeRender {
195212 Thinking : & dto.Thinking {Type : "disabled" },
213+ OutputEffort : outputEffort ,
196214 EffectiveEffort : EffortNone ,
197215 ClearSampling : capabilities .strictSampling ,
198216 Diagnostics : diagnostics ,
@@ -268,7 +286,18 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
268286 }
269287 }
270288 if intent .Mode == ModeUnset {
271- return ClaudeRender {OutputEffort : intent .Effort , EffectiveEffort : intent .Effort , Diagnostics : diagnostics }, nil
289+ // Known models get the effort they accept. They think only when asked,
290+ // so a removed effort leaves none.
291+ effort := intent .Effort
292+ if isKnownClaudeModel (model ) {
293+ effort = ClaudeEffort (model , intent .Effort )
294+ diagnostics = append (diagnostics , claudeEffortDiagnostics (model , intent .Effort , effort )... )
295+ }
296+ effectiveEffort := effort
297+ if effectiveEffort == "" {
298+ effectiveEffort = EffortNone
299+ }
300+ return ClaudeRender {OutputEffort : effort , EffectiveEffort : effectiveEffort , Diagnostics : diagnostics }, nil
272301 }
273302 var raisedMaxTokens * uint
274303 if maxTokens == nil || * maxTokens <= 1024 {
@@ -326,9 +355,8 @@ func RenderClaude(model string, intent Intent, maxTokens *uint, adapterBudgetPer
326355 } else if effectiveEffort == "" {
327356 effectiveEffort = EffortFromBudget (budget )
328357 }
329- outputEffort := Effort ("" )
330- if capabilities .supportsEffort && intent .Effort != "" {
331- outputEffort = normalizeClaudeEffort (intent .Effort , capabilities )
358+ outputEffort := ClaudeEffort (model , intent .Effort )
359+ if outputEffort != "" {
332360 effectiveEffort = outputEffort
333361 }
334362 thinking := & dto.Thinking {Type : "enabled" , BudgetTokens : & budget }
@@ -359,6 +387,25 @@ func claudeReasoningDiagnostic(code string, message string) types.ConversionDiag
359387 }
360388}
361389
390+ // claudeEffortDiagnostics reports a requested effort that is sent at another
391+ // level or removed because the model takes none.
392+ func claudeEffortDiagnostics (model string , requested Effort , sent Effort ) []types.ConversionDiagnostic {
393+ switch {
394+ case requested == "" || requested == EffortNone || requested == sent :
395+ return nil
396+ case sent == "" :
397+ return []types.ConversionDiagnostic {claudeReasoningDiagnostic (
398+ "claude_effort_unsupported" ,
399+ fmt .Sprintf ("model %q does not support effort %q; the effort was removed" , model , requested ),
400+ )}
401+ default :
402+ return []types.ConversionDiagnostic {claudeReasoningDiagnostic (
403+ "claude_effort_adjusted" ,
404+ fmt .Sprintf ("model %q does not support effort %q with the selected thinking mode; using %q" , model , requested , sent ),
405+ )}
406+ }
407+ }
408+
362409// ClaudeUsesManualThinking reports whether an exact numeric budget is rendered
363410// as legacy extended thinking rather than being reduced to adaptive effort.
364411func ClaudeUsesManualThinking (model string , intent Intent ) bool {
@@ -376,6 +423,17 @@ func ClaudeDefaultEffort(model string) Effort {
376423 return claudeCapabilitiesFor (model ).defaultEffort
377424}
378425
426+ // ClaudeEffort returns the effort level the model accepts in place of the
427+ // requested one. It returns empty when no effort is requested or the model
428+ // takes none, which includes models missing from the capability table.
429+ func ClaudeEffort (model string , effort Effort ) Effort {
430+ capabilities := claudeCapabilitiesFor (model )
431+ if ! capabilities .supportsEffort || effort == "" || effort == EffortNone {
432+ return ""
433+ }
434+ return normalizeClaudeEffort (effort , capabilities )
435+ }
436+
379437// ResolveClaudeDefault makes the Claude model's default thinking explicit for
380438// a non-Claude target: no intent becomes adaptive thinking on models that
381439// think by default, and thinking without a strength takes the model's
0 commit comments