From 77e6a227fe1ec0688b3bab4ff4bd1de037e7a46d Mon Sep 17 00:00:00 2001 From: Sutarto Jordan Chrisfivo Date: Sat, 5 Sep 2026 21:37:32 +0700 Subject: [PATCH] fix(claude): normalize adaptive auto effort (#3792) Claude adaptive requests without an explicit effort are normalized to output_config.effort: "high" instead of forwarding the unsupported literal value "auto" which Anthropic rejects with HTTP 400. --- open-sse/translator/concerns/thinkingUnified.js | 2 +- tests/translator/thinking-unified.test.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/open-sse/translator/concerns/thinkingUnified.js b/open-sse/translator/concerns/thinkingUnified.js index a3035823..e86dbef7 100644 --- a/open-sse/translator/concerns/thinkingUnified.js +++ b/open-sse/translator/concerns/thinkingUnified.js @@ -246,7 +246,7 @@ function applyFormat(fmt, body, cfg, caps, supportedLevels) { if (canDisable) body.thinking = { type: "adaptive" }; else delete body.thinking; const level = toLevel(eff); - body.output_config = { effort: level === "xhigh" ? "high" : level }; + body.output_config = { effort: level === "xhigh" || level === "auto" ? "high" : level }; break; } case "claude-budget": { diff --git a/tests/translator/thinking-unified.test.js b/tests/translator/thinking-unified.test.js index 93d8b683..fd8f9d28 100644 --- a/tests/translator/thinking-unified.test.js +++ b/tests/translator/thinking-unified.test.js @@ -82,6 +82,16 @@ describe("applyThinking per provider format", () => { // Sonnet 5). Both fields together are the documented adaptive shape. expect(out.thinking).toEqual({ type: "adaptive" }); }); + it("claude adaptive thinking maps auto effort to a supported level", () => { + const out = apply("claude", "claude-opus-4.7", { thinking: { type: "adaptive" } }, "claude"); + expect(out.output_config).toEqual({ effort: "high" }); + expect(out.thinking).toEqual({ type: "adaptive" }); + }); + it("permanently adaptive Claude maps auto effort without adding a thinking switch", () => { + const out = apply("claude", "claude-fable-5-1", { thinking: { type: "adaptive" } }, "claude"); + expect(out.output_config).toEqual({ effort: "high" }); + expect(out.thinking).toBeUndefined(); + }); it("Fable 5.1 → effort without a redundant thinking switch", () => { const out = apply("claude", "claude-fable-5-1", { reasoning_effort: "high" }, "claude"); expect(out.output_config).toEqual({ effort: "high" });