Verified July 27, 2026

Claude Fable 5 in the Vercel AI SDK

The integration is three lines. The production-readiness is entirely in how you handle the fourth outcome: not an answer, not an error, a refusal.

The short answer

Supported on both routes. Use anthropic('claude-fable-5') with the provider package, or the string 'anthropic/claude-fable-5' through AI Gateway. Set effort under providerOptions.anthropic. Then configure a fallback — fallbacks: 'default' on the provider, or a models array under providerOptions.gateway — because a safety refusal returns as a successful response with stop_reason refusal, not as a thrown error.

Support status

Fully supported on both routes, verified July 27, 2026. The Anthropic provider package added claude-fable-5 together with the fallbacks API parameter, and the provider docs list effort with the five levels — low, medium, high, xhigh and max — noting that xhigh is available on the Claude 5 series and the recent Opus models. AI Gateway added Fable 5 with the same model string, unified observability and failover across Anthropic, Bedrock and Vertex, and pricing that mirrors the provider with no markup and no platform fee on inference, including on bring-your-own-key requests.

Setup

Install, name the model, set effort, then decide what happens on a refusal.

  1. 1

    Install and authenticate

    Install ai together with @ai-sdk/anthropic, and set ANTHROPIC_API_KEY for the direct route. On AI Gateway, authenticate with AI_GATEWAY_API_KEY, or rely on Vercel's OIDC token when deploying on Vercel so no key sits in your environment at all.

  2. 2

    Name the model for your route

    Direct: pass anthropic('claude-fable-5') as the model. Gateway: pass the string 'anthropic/claude-fable-5' instead. The gateway string form works identically across the AI SDK, Chat Completions, Responses and Messages API shapes, which matters if you are migrating an existing client rather than starting fresh.

  3. 3

    Set effort in providerOptions

    Add providerOptions with an anthropic object carrying effort, typed as AnthropicLanguageModelOptions so a typo is a compile error rather than a silent default. Do not set temperature, topP or topK at the top level of generateText or streamText — this model rejects sampling parameters.

  4. 4

    Configure a fallback before you ship

    On the direct route, set fallbacks to 'default' to use Anthropic's recommended fallback model, or to an array naming your own. On AI Gateway, add a models array under providerOptions.gateway listing the models to retry on, such as Opus 4.8 followed by Sonnet 5. Gateway fallbacks work across every API format it serves.

Gotchas

The first one is the reason this page exists.

  • An old provider version can reject the fallback response itself

    A reported issue on @ai-sdk/anthropic 3.0.71 has the provider rejecting a usage iteration entry of type fallback_message, failing the whole turn with a type validation error. In other words, turning on fallbacks on an older provider version can break the very requests the fallback was meant to save. Upgrade the provider at the same time you enable fallbacks.

  • A refusal is a successful response

    Fable 5's safety classifiers can decline requests, including occasional false positives on ordinary coding and debugging work. The refusal comes back as a success with stop_reason refusal, reporting which classifier declined. Your try/catch never fires, your error monitoring stays quiet, and your users see an empty or evasive answer. Branch on the stop reason explicitly.

  • Your starter template sets temperature

    temperature is a top-level option on generateText and streamText and appears in most AI SDK examples. Fable 5 rejects it, along with topP and topK. Because it sits at the top level rather than inside providerOptions, it is easy to miss when you are auditing your Anthropic-specific config.

  • Long-horizon work versus serverless timeouts

    This model is built for long-running work, and a single high-effort turn can exceed the default execution window of a serverless function. Stream rather than buffer, raise maxDuration on the route, and make sure your client can survive a reconnect — a turn that times out server-side still bills for the tokens it generated.

Cost notes

AI Gateway mirrors provider pricing with no markup and charges no platform fee on inference, so routing through it is a cost-neutral way to get failover and usage reporting — including on BYOK requests. Beyond that, effort is your main lever and fallbacks are your main surprise: a request that Fable 5 declines and Opus 4.8 answers is billed at Opus rates, so a workload with a meaningful refusal rate has a blended cost you should measure rather than assume. In RAG-shaped applications, the 1M context window is what quietly dominates the bill, because retrieved context is input tokens on every single call.

Handle refusals before they reach users

What triggers a refusal, what the response looks like, and the difference between server-side and client-side fallback — all in one place.

FAQ