$ recombobulate _
home / tips / auto-fallback-to-another-model-when-overloaded
0

Auto-Fallback to Another Model When Overloaded

bagwaa @bagwaa · Mar 26, 2026 · Configuration
auto-fallback-to-another-model-when-overloaded

Nothing kills a CI pipeline like a model being temporarily overloaded and your automated task failing silently. The --fallback-model flag tells Claude Code to automatically switch to a backup model if your primary one can't handle the request.

claude -p --fallback-model sonnet "Analyse this codebase for security vulnerabilities"

If the default model (say, Opus) is overloaded, Claude Code transparently retries with Sonnet instead of failing. Your script gets an answer either way.

You can pair it with --model to set both the primary and fallback explicitly:

# Try Opus first, fall back to Sonnet if overloaded
claude -p \
  --model opus \
  --fallback-model sonnet \
  "Generate a comprehensive test suite for the auth module"

This is a print-mode-only flag, designed for automation scenarios where you'd rather get a slightly less powerful response than no response at all. In interactive sessions, you can switch models on the fly with /model instead.

For CI/CD pipelines, this single flag can be the difference between a green build and a blocked deploy queue. Combined with --max-budget-usd and --max-turns, you get a robust, cost-controlled, failure-resistant automation setup.

A fallback model is like a generator for your pipeline. You hope you never need it, but you're glad it's there.


via Claude Code CLI Reference

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago