Back to library
AI
best practice

Automate Model Failover with the Default Fallbacks Parameter

Enable server-side fallbacks to bypass model refusals automatically.

Use the `fallbacks: "default"` parameter in the Claude API to automatically route declined requests to Anthropic's recommended alternative models.

Claude

The Scenario

You are building a customer-facing application and want to ensure that if Claude Opus 5 refuses a prompt due to safety filters or capacity, the user still receives a helpful response from a secondary model.

Before & after

The old way

Developers had to manually write retry logic to catch refusal error codes and redirect requests to a second model, taking 30–60 minutes to code and test.

With AI

By using the new `fallbacks: "default"` parameter in your API calls, the system handles model switching automatically in milliseconds. Total implementation time: 5 minutes.

The Prompt

// Add the beta header and fallback parameter to your Claude API request
client.beta.messages.create({
  model: "claude-opus-5",
  max_tokens: 1024,
  messages: [{"role": "user", "content": "[YOUR_PROMPT_HERE]"}],
  fallbacks: "default",
  headers: { "anthropic-beta": "server-side-fallback-2026-07-01" }
});

Anthropic's new server-side fallback feature automatically reroutes requests to recommended fallback models based on the specific refusal category, ensuring higher reliability without extra client-side code.

Source

Claude Platform release notes - Claude Platform Docs
"The fallbacks parameter now supports a "default" mode, which applies Anthropic's recommended fallback models by refusal category."