brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: --fallback-model keeps a run going when the main model is overloaded

CLI
~/tips/tip-claude-fallback-model-chain

claude --fallback-model sonnet,haiku

Switches Claude Code to a backup model automatically when the main one is overloaded.

An overloaded model should not be the reason a long job stops halfway.

--fallback-model takes one model or a comma-separated list. When the primary model is overloaded or unavailable, for example a retired one, Claude Code tries the next in line.

claude --fallback-model sonnet,haiku

The list is tried in order, so put the one you would accept first. If you want this for every session, the fallbackModel setting stores the chain, and the flag overrides it for one run.

For unattended jobs that is the setting I would care about most. For a session where I am watching, I would rather see the error and choose myself.

A chain makes more sense than a single fallback because the second choice can fail too. It does not fix a bad prompt or a rate limit that applies to you, only the case where a model is not available right now.

The caveat is obvious but easy to forget: a fallback is a different model. A smaller one may answer the same prompt differently, so read the result before you trust it.

Further reading: CLI reference – Claude Code docs, Model configuration – Claude Code docs, On this site: claude -p lets you pipe text into Claude Code from a script, On this site: pipe a log straight into claude -p instead of pasting it

More CLI tips printf 'GET /\r\n' | hexdump -C hexdump -C -s 512 -n 64 disk.img wget --limit-rate=2m https://example.com/big-file.iso wget --spider https://example.com/file.zip rg 'apiKey' -g '!*.min.js' -g '!package-lock.json' All CLI tips (46) All topics

Link