Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/adapters/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/anthropic-reasoning.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Loading