Every way to choose a model in Claude Code
AutoRouter7 min read
As of October 22, 2026, Anthropic's model configuration docs list five ways to set Claude Code's model, in order of priority: /model during a session, claude --model at startup, the ANTHROPIC_MODEL environment variable, the model field in a settings file, and ANTHROPIC_DEFAULT_MODEL for new sessions. Each accepts an alias such as sonnet or opusplan, or a full model name such as claude-opus-5-5. AutoRouter, the Mac app for Codex and Claude Code, appears in /model as one more choice that picks a model for each turn, and it routes only while it is the model selected.
Which setting decides Claude Code's model?
The highest item on that list that is set decides the main session's model. /model also saves your pick: it "saves your choice as the default for new sessions by writing the model field in your user settings." In the picker, Enter switches and saves, and s switches "for this session only." The --model flag and ANTHROPIC_MODEL "apply only to the session you launch with them." The table lists every other place Claude Code takes a model from.
| Option | Where you set it | What it covers | Example |
|---|---|---|---|
/model | In a session | Now, saved as your default | /model sonnet |
--model | Command line | That session | claude --model opus |
ANTHROPIC_MODEL | Environment | Sessions launched with it | ANTHROPIC_MODEL=sonnet claude |
model | User, project or local settings file | You, your project, or you in one project | "model": "opus" |
ANTHROPIC_DEFAULT_MODEL | Environment | New sessions, if nothing above sets a model | export ANTHROPIC_DEFAULT_MODEL=sonnet |
ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_FABLE_MODEL | Environment | What each alias resolves to | export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5 |
model frontmatter | .claude/agents/<name>.md | That subagent | model: haiku |
CLAUDE_CODE_SUBAGENT_MODEL | Environment or settings env | Subagents with no other model set | "CLAUDE_CODE_SUBAGENT_MODEL": "haiku" |
CLAUDE_CODE_SUBAGENT_MODEL_FORCE | Environment or settings env | Every subagent, teammate and workflow agent | "CLAUDE_CODE_SUBAGENT_MODEL_FORCE": "1" |
model frontmatter | .claude/skills/<name>/SKILL.md | The rest of the current turn | model: opus |
--agent or agent | Command line or settings | Main thread runs as that subagent, on its model | claude --agent code-reviewer |
--fallback-model or fallbackModel | Command line or settings | One turn, when the primary model is unavailable | claude --fallback-model sonnet,haiku |
| Organization default model | claude.ai admin console | What Default resolves to (Enterprise) | Set by an admin |
availableModels | Managed settings | Which models people can select | "availableModels": ["sonnet", "haiku"] |
What do the Claude Code model aliases mean?
Aliases "point to the recommended version for your provider and update over time," according to the docs, while a full model name such as claude-opus-5-5 pins one version. On the Anthropic API, as of October 22, 2026, they resolve like this:
| Alias | What it does | Anthropic API model |
|---|---|---|
default | Returns to your account's default | Opus 5.5 on Pro, Max, Team, Enterprise and the API |
best | fable where available, otherwise opus | Fable 5.1 or Opus 5.5 |
fable | For "your hardest and longest-running tasks" | Fable 5.1 |
opus | For "complex reasoning tasks" | Opus 5.5 |
sonnet | For "daily coding tasks" | Sonnet 5.5 |
haiku | For "simple tasks" | Haiku 5.5 |
opus[1m], sonnet[1m] | 1 million token context window | No change, since both models already have one |
opusplan | opus in plan mode, sonnet for execution | Opus 5.5, then Sonnet 5.5 |
Other providers can resolve an alias to an older model: on Amazon Bedrock, sonnet is Sonnet 4.5. Opus 5.5 needs Claude Code v2.1.280 or later, Sonnet 5.5 needs v2.1.284 and Haiku 5.5 needs v2.1.293.
How does opusplan split planning and coding?
opusplan runs opus in plan mode and switches to sonnet to carry out the plan, pairing "Opus's reasoning for planning with Sonnet's efficiency for execution," as the docs put it. Start a session on it, then enter plan mode with /plan:
claude --model opusplan
ANTHROPIC_DEFAULT_OPUS_MODEL and ANTHROPIC_DEFAULT_SONNET_MODEL set the model for each phase. Each plan-mode toggle is a model switch and starts a fresh cache.
How do you set a default model in settings.json?
Add a model key to ~/.claude/settings.json for all your projects, .claude/settings.json for everyone in a project, or .claude/settings.local.json for you in one project. The local file applies over the shared one, so you can run Opus where your team's file sets Sonnet.
{
"model": "sonnet"
}
ANTHROPIC_MODEL outranks every settings file and returns at each launch, whatever you saved with /model. ANTHROPIC_DEFAULT_MODEL (v2.1.236 or later) applies only when no --model flag, ANTHROPIC_MODEL, settings model or organization default picks a model, and Claude Code ignores it when it is set to default, inherit, opusplan or haiku. The family variables take a full model name:
# Sessions launched from this shell start on Sonnet
export ANTHROPIC_MODEL=sonnet
# Keep the opus alias on one version
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
How do you choose a model for Claude Code subagents?
A subagent's model comes from, in order: the model Claude passes when it starts the subagent, the model field in its frontmatter, CLAUDE_CODE_SUBAGENT_MODEL, and then the main conversation's model. The field accepts sonnet, opus, haiku, fable, a full model ID or inherit:
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---
CLAUDE_CODE_SUBAGENT_MODEL is only a default. To run every subagent on one model, also set CLAUDE_CODE_SUBAGENT_MODEL_FORCE to 1 (v2.1.257 or later):
{
"env": {
"CLAUDE_CODE_SUBAGENT_MODEL": "haiku",
"CLAUDE_CODE_SUBAGENT_MODEL_FORCE": "1"
}
}
One setup, worked from the docs: the main session on opus, CLAUDE_CODE_SUBAGENT_MODEL=haiku without the force variable, and the code-reviewer above. A model Claude passes when it starts a subagent would override any row.
| Subagent | Runs on | Why |
|---|---|---|
code-reviewer | Sonnet 5.5 | Its frontmatter outranks the variable |
| General-purpose (built in) | Haiku 5.5 | Nothing else sets a model, so the variable applies |
| Explore | Opus 5.5 | It uses the main model, and the variable alone doesn't change it |
| Plan | Opus 5.5 | It inherits the main model unless the force variable is set |
Inheriting subagents follow /model switches too. The docs put it this way: "Switch to Opus before Claude delegates research or test runs to one of them, and that work runs on Opus too."
How do you check which model Claude Code is using?
Run /status, which shows "version, model, account, and connectivity," or add a status line that prints model.display_name, as in this example from the docs:
{
"statusLine": {
"type": "command",
"command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context\"'"
}
}
/tasks names each subagent's model (v2.1.242 or later). When project or managed settings set the model, the startup header names the file that set it.
Where does AutoRouter fit in Claude Code's /model picker?
AutoRouter, the Mac app for Codex and Claude Code, adds 20+ models to Claude Code's /model picker beside the ones already there, plus one more choice, AutoRouter, which picks a model for each turn. Enabling Claude Code in AutoRouter adds AutoRouter to Claude Code's settings.json after saving a copy of the file, and disabling Claude Code in AutoRouter's settings switches it back.
While AutoRouter is selected, your own rules decide a turn first. Otherwise hard work goes to the most capable model your plans cover, and everything else goes to the model that costs you least among those that clear the quality bar. Claude models run on your Claude plan, and every turn shows its model, what it cost and why. How AutoRouter picks a model for each turn covers the full order.
Picking any other model in /model sends turns straight to it, because AutoRouter routes only while it is the model selected. The built-in options fit when you want one model, or a fixed split such as opusplan, with nothing else installed. AutoRouter is in beta and needs macOS 14 or later, and Node 22.18 or later for Claude Code.
Questions
Why does Claude Code start on a different model than I picked?
Something with higher priority usually sets the model again at launch: a model value in project or managed settings, ANTHROPIC_MODEL in your shell, or an organization default set to override user choices. A pick made with s or --model lasts one session, and a resumed session usually keeps its old model. The docs list every cause.
Does switching models mid-session cost more?
The first request after a switch costs more, because each model has its own prompt cache and that request "reads the entire conversation history with no cache hits," according to the prompt caching docs. Claude Code asks you to confirm a /model switch while the cache is still warm.
Can I run different models in two terminals at once?
Yes. Launch each terminal with its own --model flag, as the docs advise, because /model saves your pick as the default for new sessions.
Which alias should I use for a task?
Anthropic describes sonnet as the model for daily coding, opus for complex reasoning, haiku for simple tasks and fable for the hardest and longest-running work. Which model for which coding task breaks this down by task, and how Claude Code usage limits work covers plan limits.
Does picking a model in /model turn AutoRouter off?
Picking another model sends your turns straight to it, since AutoRouter routes only while it is the model selected. Pick AutoRouter again with /model to go back to a model chosen for each turn.
Sources
- Model configuration, checked October 22, 2026
- Create custom subagents, checked October 22, 2026
- Settings files and precedence, checked October 22, 2026
- All settings, checked October 22, 2026
- CLI reference, checked October 22, 2026
- Commands, checked October 22, 2026
- Environment variables, checked October 22, 2026
- Customize your status line, checked October 22, 2026
- How Claude Code uses prompt caching, checked October 22, 2026
- Extend Claude with skills, checked October 22, 2026