From 205c5676ff548c0f74716dddac23cfeb22fd2645 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Tue, 9 Jun 2026 17:24:34 -0700 Subject: [PATCH] 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 6dd4e5dcf5628635bbf4a41bf2b8cf3964f45bb9. * fix(llms): match claude fable reasoning workaround broadly --- .../src/providers/routing/anthropic-compatible.ts | 8 +++++++- .../src/providers/routing/provider-options.test.ts | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/sdk/packages/llms/src/providers/routing/anthropic-compatible.ts b/sdk/packages/llms/src/providers/routing/anthropic-compatible.ts index 6f15144120..41b3a63998 100644 --- a/sdk/packages/llms/src/providers/routing/anthropic-compatible.ts +++ b/sdk/packages/llms/src/providers/routing/anthropic-compatible.ts @@ -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 = { ...(request.reasoning?.enabled === true ? { enabled: true } - : request.reasoning?.enabled === false + : shouldSendDisabledReasoning ? { enabled: false } : request.reasoning?.effort ? { enabled: true } diff --git a/sdk/packages/llms/src/providers/routing/provider-options.test.ts b/sdk/packages/llms/src/providers/routing/provider-options.test.ts index 615909be04..df9a4c6a7c 100644 --- a/sdk/packages/llms/src/providers/routing/provider-options.test.ts +++ b/sdk/packages/llms/src/providers/routing/provider-options.test.ts @@ -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",