Chapter 02 · Section V · 10 min read
2.5 Model config: selection, thinking, fallback
Which model to reach for, when extended thinking earns its keep, and how to configure a fallback so a rate-limited primary does not kill your session.
Claude Code lets you pick the underlying model per session, per invocation, or as a default. A little care here — matched to the task — saves cost and often improves results.
Model selection
Set the default in settings:
{
"model": "claude-sonnet-4-6"
}
Override for a single invocation:
claude --model claude-opus-4-7
Or per session via /model.
The Claude 4.x family, roughly:
- Haiku — smallest, fastest, cheapest. Great for shallow tasks: simple edits, quick lookups, straightforward transforms.
- Sonnet — the daily driver. Fast enough for interactive work, capable enough for real code.
- Opus — the deepest. Slower and more expensive, but pulls ahead on complex reasoning, long context, tricky refactors.
The right default for most engineers is Sonnet. Reach for Opus when the task genuinely needs it — big multi-file work, careful architectural reasoning, subtle debugging. Reach for Haiku for pure “do this small thing” prompts where speed matters more than depth.
Thinking tokens
Extended thinking lets the model reason internally before replying. In Claude Code, it is configured via the thinking block:
{
"model": "claude-opus-4-7",
"thinking": {
"budget_tokens": 8000
}
}
Higher budgets = more internal reasoning = better decisions on hard problems, at a cost.
Rough guide:
- 0 (off) — fast interactive work, simple edits.
- ~2k — most day-to-day.
- ~8-16k — tricky refactors, careful review, architectural questions.
- ~32k+ — deep single-shot problems where you have one chance to get it right.
Fallback models
If your primary is rate-limited or returns an error, Claude Code can fall back automatically:
{
"model": "claude-opus-4-7",
"fallback_model": "claude-sonnet-4-6"
}
Two cases this actually helps with:
- Rate limits on Opus during peak hours — session degrades to Sonnet rather than failing outright.
- Reliability for scripted / scheduled work where you would rather get a Sonnet answer than a 429 error.
Do not use fallback to save money — pick the right primary model instead. Fallback is for reliability.
Check your understanding
Quick check
—