diff --git a/src/adapters/anthropic.ts b/src/adapters/anthropic.ts index 60b27d43a0..674bd7c037 100644 --- a/src/adapters/anthropic.ts +++ b/src/adapters/anthropic.ts @@ -872,9 +872,10 @@ export function createAnthropicAdapter(provider: OcxProviderConfig, cacheRetenti // output, so high effort needs the same total-token headroom as budget thinking or a // default 8192-token request can spend everything on thought and return empty text. body.thinking = { type: "adaptive" }; - body.output_config = { effort: adaptiveEffort(parsed.options.reasoning) }; + const effort = adaptiveEffort(parsed.options.reasoning); + body.output_config = { effort }; const explicitMaxOut = parsed.options.maxOutputTokens; - const wantBudget = reasoningBudget(parsed.options.reasoning); + const wantBudget = reasoningBudget(effort); const floor = wantBudget + OUTPUT_HEADROOM; // Preserve explicit caller limits as-is; for omitted limits use the adaptive ceiling // so effort=max (budget=32k) still leaves OUTPUT_HEADROOM tokens for visible output. diff --git a/tests/anthropic-reasoning.test.ts b/tests/anthropic-reasoning.test.ts index 03ea3809dd..3e510c36f6 100644 --- a/tests/anthropic-reasoning.test.ts +++ b/tests/anthropic-reasoning.test.ts @@ -67,6 +67,7 @@ describe("anthropic extended-thinking gate", () => { test("adaptive-thinking model maps unsupported 'minimal' effort to 'low'", async () => { const b = await bodyOf(parsed("minimal", {}, "claude-fable-5")); expect(b.output_config).toEqual({ effort: "low" }); + expect(b.max_tokens).toBe(12_288); }); test("adaptive-thinking model resizes max_tokens for high effort (issue #246)", async () => {