The short version
- Claude Code picks its model from a fixed order: /model in the session beats --model, which beats ANTHROPIC_MODEL, which beats the model key in settings.
- opusplan plans with Opus and executes with Sonnet, so the strongest model is used only for planning.
- Effort is a separate dial from the model, and the CLAUDE_CODE_EFFORT_LEVEL environment variable overrides every other way of setting it.
- Use full model names or the ANTHROPIC_DEFAULT_*_MODEL variables when a pipeline needs a pinned version, because aliases move to the latest release.
- Managed settings can allow-list or deny models, and a fallback chain of up to three models covers overload but not rate limits.
On this page
- The short version
- Which model aliases does Claude Code have?
- How do I set the model, and which setting wins?
- What is opusplan and when should I use it?
- How does effort work, and how is it different from the model?
- Which model do subagents use?
- How do I pin a model version for CI or a team?
- How do I restrict which models people can use?
- What happens when the model is overloaded?
- Other variables worth knowing
- A sensible starting setup
- Conclusion
- Questions people ask
To change the model in Claude Code, type /model <alias> in a session, start it with claude --model <alias>, or set "model" in a settings file. A reasonable setup for many teams is a cheaper default for daily work, opusplan for bigger changes, and a separate effort level that you raise only for hard tasks. This article covers the aliases, the order in which settings win, effort, subagent models, fallbacks and how to lock models down for a team.
Everything below comes from the Claude Code model configuration and subagent documentation. Version numbers are given where the docs state a minimum.
Which model aliases does Claude Code have?
An alias is a short name that resolves to the newest model of that family. You can use it anywhere a model name is accepted.
| Alias | What it does |
|---|---|
default | Clears any override and returns to the default for your account |
best | Same model as fable where Fable is available, otherwise the same as opus |
fable | Fable, for the hardest and longest-running tasks |
opus | Latest Opus, for complex reasoning |
sonnet | Latest Sonnet, for daily coding |
haiku | Fast, efficient Haiku, for simple tasks |
sonnet[1m], opus[1m] | The same models with a 1M-token context window; no effect where the model already has 1M natively |
opusplan | Opus in plan mode, then Sonnet for execution |
What an alias points to depends on your provider. On the Anthropic API, opus is Opus 5.5, sonnet is Sonnet 5.5 and haiku is Haiku 5.5. On Amazon Bedrock and Google Cloud's Agent Platform, opus is Opus 5.5 but sonnet and haiku resolve to 4.5 versions. On Microsoft Foundry, opus is Opus 4.6 and sonnet and haiku are 4.5 versions. If you run a mixed estate, check what each alias means on each provider before you write a runbook.
The docs list minimum Claude Code versions for the newest models: v2.1.280 for Opus 5.5, v2.1.284 for Sonnet 5.5, v2.1.293 for Haiku 5.5 and v2.1.257 for Fable 5.1. claude update upgrades an old install.
How do I set the model, and which setting wins?
There are five places, listed from highest priority to lowest:
- In a session:
/model <alias|name>, or/modelalone for the picker. - At startup:
claude --model <alias|name>. - The environment variable
ANTHROPIC_MODEL. - The
modelfield in a settings file. ANTHROPIC_DEFAULT_MODEL, which only sets the default for new sessions.
claude --model opus/model sonnet{
"permissions": { "allow": ["Bash(npm run lint)"] },
"model": "opus"
}Two details catch people out. In the picker, Enter switches and saves your choice as the model field in your user settings, while s switches for this session only. Typing /model <name> directly behaves like Enter. And in non-interactive mode (-p), /model applies to the current session only and is never saved (v2.1.205 or later).
ANTHROPIC_DEFAULT_MODEL (v2.1.236 or later) is the weakest. A new session uses it only when --model, ANTHROPIC_MODEL, any model value in a settings file (including a saved /model choice) and any organization default are all absent. It is ignored if set to default, inherit, opusplan or haiku.
Resumed sessions (--resume, --continue, /resume) restore the model saved in the transcript, except on Bedrock, Agent Platform and Foundry, where it is not restored. The --model flag and ANTHROPIC_MODEL override the restored model.
What is opusplan and when should I use it?
opusplan is a hybrid alias. Plan mode runs on opus, and when you approve the plan and execution starts, Claude Code switches to sonnet.
claude --model opusplanThe reasoning is cost. Choosing an approach, finding the files and spotting risks is where a stronger model earns its price. Applying a plan that is already written is often fine on Sonnet. If you already use plan mode, opusplan makes the model split automatic.
Both phases use the context window of their alias. /model opusplan[1m] asks for the 1M window on both phases where they do not already have it; it needs v2.1.265 or later, and on earlier versions you use --model or the model setting. If your admin has restricted models with availableModels and the newest Opus is excluded but an older one is allowed, planning uses the newest permitted Opus.
How does effort work, and how is it different from the model?
Effort is a separate dial that controls how much the model reasons before it acts. The levels are low, medium, high, xhigh and max on Fable 5.1, Fable 5, Opus 5.5, Sonnet 5.5, Haiku 5.5, Opus 5, Sonnet 5, Opus 4.8 and Opus 4.7. Opus 4.6 and Sonnet 4.6 have no xhigh. If a level is not supported, Claude Code uses the highest supported level at or below it, so xhigh runs as high on Opus 4.6. Models not in those lists do not support effort.
Defaults: high on effort-capable models, except Opus 5.5, Sonnet 5.5 and Haiku 5.5, which start at medium, and Opus 4.7, which starts at xhigh.
The resolution order, first match wins:
- The
CLAUDE_CODE_EFFORT_LEVELenvironment variable - A level picked in the session (
/effort, the/modelpicker) --effortat launch- Settings: a saved per-model level or the
effortLevelkey - The model's default
claude --effort xhigh
export CLAUDE_CODE_EFFORT_LEVEL=auto # send no effort level (unset also works)/effort # interactive slider
/effort high # set directly
/effort auto # clear the saved level for the active model
/effort status # show the current levelmax is accepted by the environment variable and /effort but not by the effortLevel settings key, which takes only low, medium, high or xhigh. max applies to the current session unless you set it through the environment variable. A top-level effortLevel in user settings does not apply to Opus 5.5, although it does in project, local and managed settings. Skill and subagent frontmatter can also set effort, which applies while that skill or subagent runs; the environment variable still takes precedence over it.
A practical pattern: leave the default alone, raise effort for the one task that needs it, then drop back with /effort auto.
Which model do subagents use?
Subagents that inherit the main conversation's model follow the session's model at the time they start, so a /model switch reaches them. Switch to Opus before delegating and they run on Opus.
To keep a helper cheap, set model in its definition. It accepts sonnet, opus, haiku, fable, a full ID such as claude-opus-5-5, or inherit:
---
name: code-reviewer
description: Reviews code for quality and best practices
model: haiku
---Since v2.1.251 a subagent's model is resolved in this order:
- The
modelparameter on the Agent tool call (aliases only) - The
modelin the subagent's definition - The
CLAUDE_CODE_SUBAGENT_MODELenvironment variable - The main conversation's model
Setting CLAUDE_CODE_SUBAGENT_MODEL alone does not change the built-in Explore and Plan subagents. To force one model onto every subagent, also set CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 (v2.1.257 or later). While it is on, the model field in definitions is ignored and Claude cannot pass a model when starting a subagent:
{
"env": {
"CLAUDE_CODE_SUBAGENT_MODEL": "haiku",
"CLAUDE_CODE_SUBAGENT_MODEL_FORCE": "1"
}
}Run /tasks while a subagent is running to see the model, and its effort level if set, on its row (v2.1.242 or later).
How do I pin a model version for CI or a team?
Aliases move. When a newer Sonnet replaces Sonnet 5.5, sonnet follows. For a pipeline that must behave the same next month, pin one of two ways: use the full model name (for example claude-opus-5-5), or set the matching variable so the alias keeps meaning what you chose:
ANTHROPIC_DEFAULT_OPUS_MODELANTHROPIC_DEFAULT_SONNET_MODELANTHROPIC_DEFAULT_HAIKU_MODELANTHROPIC_DEFAULT_FABLE_MODEL
Pinning has a cost: you also have to notice when a pinned model is retired and move on purpose.
How do I restrict which models people can use?
In managed settings, availableModels is an allow-list. Entries can be a family (sonnet), a version prefix (claude-sonnet-4-5) or a full ID. A prefix also matches later IDs that extend it, so claude-fable-5 permits Fable 5 and 5.1.
{
"availableModels": ["sonnet", "haiku"],
"enforceAvailableModels": true
}- The list applies everywhere a user can name a model:
/model,--model,ANTHROPIC_MODEL, themodelsetting, the model restored on resume, subagent and teammate models, skill and command models, and/fast. - A blocked
/modelchoice is rejected. A blocked--model,ANTHROPIC_MODELormodelvalue is replaced at startup with a warning, and a blocked subagent runs on a fallback model. enforceAvailableModels(v2.1.175 or later) applies the list to the Default option too. Without it, themodelsetting is only an initial selection and users can still pick Default in/model.deniedModels(v2.1.283 or later) blocks listed models even ifavailableModelspermits them, andavailableModelsMatch: "exact"makes each ID permit only the version it names. Both are read from managed settings only; set elsewhere, they are ignored with a warning.- In managed settings, the
availableModelslist applies alone; user, project and local entries cannot extend it. Earlier versions ignore the newer keys, so also setrequiredMinimumVersionto keep them from starting.
What happens when the model is overloaded?
You can give Claude Code a fallback chain:
claude --fallback-model sonnet,haiku{
"fallbackModel": ["claude-sonnet-5", "claude-haiku-4-5"]
}The flag overrides the setting, and chains are capped at three models after duplicates are removed. Fallback triggers on overloaded, unavailable or non-retryable server errors. It does not trigger on authentication, billing, rate-limit, request-size or transport errors, so it will not rescue you when you hit a plan limit. The switch lasts for the current turn only, entries outside availableModels are dropped, and fallback applies to subagents from v2.1.247. Because a fallback model may differ from the one you chose, look at the model in use when a run behaves oddly.
Other variables worth knowing
CLAUDE_CODE_DISABLE_1M_CONTEXT=1removes the[1m]variants from the picker and treats models with a 1M default as 200K.MAX_THINKING_TOKENS=0turns thinking off on the Anthropic API, except on Opus 5.5, Sonnet 5.5, Haiku 5.5 and the Fable models, where it cannot be turned off.CLAUDE_CODE_AUTO_COMPACT_WINDOWsets the auto-compact window in tokens, such as200000, and takes precedence over/autocompact.
A sensible starting setup
- Set
"model": "sonnet"in user settings for daily work. - Use
/model opusplanbefore a large, unclear change. - Keep effort at the default and use
/effortfor one hard task, then/effort auto. - In CI, pin with a full model name and set
CLAUDE_CODE_EFFORT_LEVELexplicitly. - For a team, publish
availableModelsandenforceAvailableModelsin managed settings, with arequiredMinimumVersion.
Conclusion
Model choice in Claude Code is a stack of settings: the session beats the flag, which beats the environment, which beats the file. Learn that order and the effort order, pin versions where repeatability matters, and let opusplan spend the stronger model on planning. Most surprises come from one layer silently overriding another, so check /effort status and the picker before you blame the model.
Atlas, a team of AI engineers built on Claude Code, gives each engineer its own session with a model and effort suited to its role. Fallback chains are coming to Atlas, built in, so they will need no setup. Until then, set one yourself in Claude Code as shown above.
Questions people ask
How do I change the model in Claude Code?
Type /model followed by an alias such as sonnet or opus in a session, start with claude --model <alias>, or set the model field in a settings file. The session choice beats the flag, which beats ANTHROPIC_MODEL, which beats the settings file.
What does opusplan do in Claude Code?
It uses Opus while you are in plan mode and switches to Sonnet when execution starts. You set it with /model opusplan or claude --model opusplan.
What is the difference between model and effort in Claude Code?
The model is which Claude answers; effort is how much it reasons, from low to max on models that support it. They are set separately, and CLAUDE_CODE_EFFORT_LEVEL overrides every other way of setting effort.
Does the fallback model help when I hit a usage limit?
No. Fallback applies on overload, unavailability or non-retryable server errors, not on authentication, billing, rate-limit or request-size errors. Chains are capped at three models.
How do I stop a team from using certain models?
Set availableModels in managed settings, add enforceAvailableModels to cover the Default option, and use deniedModels to block specific versions. Add requiredMinimumVersion so older installs that ignore the newer keys cannot start.
Sources
Researched and drafted with Claude, then checked against the sources above. Atlas is an independent product, not affiliated with Anthropic or OpenAI. Claude and Claude Code are trademarks of Anthropic; Codex is a product of OpenAI.