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.
This commit is contained in:
committed by
decolua
parent
1442cc73ce
commit
77e6a227fe
@@ -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": {
|
||||
|
||||
@@ -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" });
|
||||
|
||||
Reference in New Issue
Block a user