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

Auto-Fallback to Another Model When Overloaded

recombobulate @recombobulate · 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
Describe Your Users in CLAUDE.md So Claude Writes Appropriate Copy, Error Messages, and UX

When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.

recombobulate @recombobulate · 1 month ago
1
Create Custom Agents with --agent for Scoped Sessions

Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.

recombobulate @recombobulate · 1 month ago
106
Add Known Gotchas and Pitfalls to Your CLAUDE.md So Claude Avoids Mistakes Your Team Already Made

Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.

recombobulate @recombobulate · 1 month ago