Back to library
AI
best practice

Prevent API Refusal Errors with Automatic Model Fallbacks

Use the 'fallbacks' parameter to prevent automated workflow failures.

Implement the 'fallbacks' parameter in your API requests to automatically switch models if Claude Fable 5 refuses a prompt, ensuring continuous operation.

Claude

The Scenario

You are building an automated agent and want to ensure that if a strict safety filter triggers on a prompt, the system automatically tries a secondary model instead of failing.

Before & after

The old way

When a model's safety filter blocked a request, the entire workflow would crash, requiring a human to manually resubmit the prompt to a different model. This downtime could last 5–10 minutes.

With AI

Enable the 'fallbacks' parameter in your API calls to automatically route a blocked request to a different model. This automated switch happens in milliseconds.

The Prompt

// Use this structure in your API request to Anthropic
{
  "model": "claude-fable-5",
  "max_tokens": 1024,
  "messages": [{"role": "user", "content": "[YOUR_PROMPT]"}],
  "fallbacks": ["claude-sonnet-4.6"] 
}

Claude Fable 5 introduces a 'fallbacks' parameter. When the primary model refuses a request due to safety classifiers (returning stop_reason: 'refusal'), the system automatically reruns the prompt on your designated fallback model.

Source

Claude Platform - Claude API Docs
"An opt-in fallbacks parameter... re-runs refused requests on another model, billed at the fallback model's rates."