Use API Fallbacks to Handle Model Refusals Automatically
Automate model switching when prompts trigger safety refusals.
Implement the 'fallbacks' parameter in the Claude API to automatically rerun requests on a secondary model if they are refused by Fable 5's safety classifiers.
The Scenario
Your application needs high reliability, and you want to ensure that if a safety classifier blocks a prompt on Fable 5, the system automatically tries a different model.
Before & after
Developers manually check error logs for 'stop_reason: refusal' and then manually resubmit the request to a different model. This manual intervention can take 5-10 minutes per failure.
Enable the 'fallbacks' parameter in your API call. This automatically redirects the request to a secondary model in under a second if the primary model refuses the prompt.
The Prompt
Review this Claude API request structure and show me how to implement the 'fallbacks' parameter to handle 'refusal' stop reasons: [PASTE_YOUR_API_CODE_OR_JSON]
Claude Fable 5 introduces safety classifiers that may return a 'refusal' stop reason. The opt-in fallback parameter allows your application to remain resilient without manual oversight.
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."
