diff --git a/src/adapters/anthropic.ts b/src/adapters/anthropic.ts index 7d49e7ca70..19a6747d5a 100644 --- a/src/adapters/anthropic.ts +++ b/src/adapters/anthropic.ts @@ -935,9 +935,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 ab91ee8f05..7e31501a6c 100644 --- a/tests/anthropic-reasoning.test.ts +++ b/tests/anthropic-reasoning.test.ts @@ -68,6 +68,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("forwards Responses JSON Schema output format to Anthropic", async () => {