fix(llms): fix disabled reasoning for Fable 5 error (#11397)

* fix(llms): avoid disabled reasoning for fable 5

* fix(llms): route fable reasoning by family

* Revert "fix(llms): route fable reasoning by family"

This reverts commit 6dd4e5dcf5.

* fix(llms): match claude fable reasoning workaround broadly
This commit is contained in:
Saoud Rizwan
2026-06-09 17:24:34 -07:00
committed by GitHub
parent 1c13edd395
commit 205c5676ff
2 changed files with 21 additions and 1 deletions
@@ -581,10 +581,16 @@ export function buildGatewayReasoningOptions(
explicitBudgetTokens: request.reasoning?.budgetTokens,
})
: request.reasoning?.budgetTokens;
const shouldSendDisabledReasoning =
request.reasoning?.enabled === false &&
// FIXME: temporary OpenRouter compatibility patch for Claude Fable.
// Remove once OpenRouter normalizes disabled reasoning like Vercel does,
// or replace with a systematic policy for models that reject it.
!request.modelId.toLowerCase().includes("claude-fable");
const reasoning: Record<string, unknown> = {
...(request.reasoning?.enabled === true
? { enabled: true }
: request.reasoning?.enabled === false
: shouldSendDisabledReasoning
? { enabled: false }
: request.reasoning?.effort
? { enabled: true }
@@ -1101,6 +1101,20 @@ describe("composeAiSdkProviderOptions: family/provider thinking patches", () =>
context: { family: "kimi-k2.6" },
expect: [{ bucket: "cline", has: { reasoning: { enabled: false } } }],
},
{
name: "cline Claude Fable reasoning.enabled=false uses lowest supported reasoning",
request: {
providerId: "cline",
modelId: "anthropic/claude-fable-5",
reasoning: { enabled: false },
},
expect: [
{
bucket: "cline",
has: { reasoning: { max_tokens: 1024 } },
},
],
},
// OpenRouter owns the reasoning object regardless of Moonshot family.
{
name: "openrouter non-K2.6 Moonshot Kimi reasoning.enabled=false -> reasoning.exclude",