Claude Code picks a model for you, but it is not always the one you want. A quick bug fix does not need the biggest model, and a hard architecture change may need more than the default.
This guide shows every way to change the model in Claude Code: the /model picker, the --model flag, environment variables and settings files. It also covers the model aliases, the opusplan hybrid mode, effort levels, the 1M context window and fallback models. Everything follows Anthropic’s Claude Code documentation as of December 2026.
- Switch now: type
/model sonnet(oropus,haiku,fable) in a session. - Picker:
/modelwith no argument. Enter saves it as your default, s switches for this session only. - One launch:
claude --model opus - Permanent:
"model": "sonnet"in~/.claude/settings.json, orANTHROPIC_MODEL. - Hybrid:
opusplanplans with Opus and codes with Sonnet. - Effort:
/effortor the left/right arrows in/model. Current models default tomedium.
Claude Code Model Aliases
You can set the model with a short alias or a full model name. Aliases always point to the recommended version for your provider, so you do not have to remember version numbers.
| Alias | What it does |
|---|---|
default |
Goes back to the default for your account type |
sonnet |
Latest Sonnet, for daily coding |
opus |
Latest Opus, for complex reasoning |
best |
Same model as opus |
haiku |
Fast, cheap Haiku for simple tasks |
fable |
The Fable model, for the hardest and longest tasks |
opusplan |
Opus in plan mode, Sonnet when it executes |
sonnet[1m], opus[1m] |
Ask for the 1M context window on models that do not have it by default |
On the Anthropic API the aliases resolve to the newest models. Other providers can lag behind:
| Provider | opus | sonnet | haiku |
|---|---|---|---|
| Anthropic API | Opus 5.5 | Sonnet 5.5 | Haiku 5.5 |
| Amazon Bedrock | Opus 5.5 | Sonnet 4.5 | Haiku 4.5 |
| Google Cloud Agent Platform, Microsoft Foundry | Opus 5.5 | Sonnet 5.5 | Haiku 4.5 |
The fable alias resolves to Fable 5.2 in most setups. If your provider maps an alias to an older model, select the full model name or pin it with an environment variable (shown below).
Your version matters too. Sonnet 5.5 needs Claude Code v2.1.284 or later, Opus 5.5 needs v2.1.280, Haiku 5.5 needs v2.1.293 and Fable 5.2 needs v2.1.321. Run claude update if a model is refused. Our install and update guide has the details.
Change the Model in a Session
- Type
/modeland press Enter. The picker lists your models; on the Anthropic API each row also shows a price label. - Choose a row with the arrow keys. For models that support effort, use left and right to move the effort slider.
- Press Enter to switch and save it as the default for new sessions. Or press s to switch for this session only and keep your saved default.
- Or skip the picker: type
/model sonnet,/model opusor a full name such as/model claude-haiku-5-5. Typing a name works like pressing Enter, so it also saves the default.
The new model applies from your next message. A switch also reaches subagents that inherit the main model, so switching to Opus before Claude delegates research means that work runs on Opus too. To keep a subagent on a smaller model, set model in its definition; our subagents guide shows how.
If you run several terminals at once, launch each with its own --model flag. Switching with /model saves a default that the next session picks up.
All Ways to Set the Model (Priority Order)
Claude Code checks these sources in order. The first one that sets a model wins:
| Priority | Method | Example | Lasts |
|---|---|---|---|
| 1 | /model in a session |
/model opus |
Now, and saved as default (unless you press s) |
| 2 | Launch flag | claude --model sonnet |
That session only |
| 3 | Environment variable | ANTHROPIC_MODEL=opus |
Sessions launched with it |
| 4 | Settings file | "model": "opus" |
Every session using that file |
| 5 | Default for new sessions | ANTHROPIC_DEFAULT_MODEL=sonnet |
New sessions when nothing else is set |
A settings file example:
{
"model": "opus"
}
Put it in ~/.claude/settings.json for all your projects, or in .claude/settings.json to share it with your team. Our Claude Code settings guide explains every scope.
A project or managed setting reapplies at every new session. Running /model overrides it for now, but the project value comes back next time.
Which Model Is the Default?
When nothing sets a model, the default setting depends on your account:
- Pro, Max, Ultra, Team, Enterprise and the Anthropic API: Opus 5.5.
- Amazon Bedrock, Google Cloud and Claude Platform on AWS: Opus 5.5.
- Microsoft Foundry: Sonnet 5.5.
An organization admin can set an organization default model, which replaces the account default. Fable is never the default on any plan, so you always pick it yourself.
Use opusplan for Planning and Coding
opusplan is a hybrid alias. In plan mode it uses Opus for reasoning and architecture. When you approve the plan and Claude starts editing, it switches to Sonnet for the implementation.
/model opusplan
This gives you Opus-quality plans while most of the token-heavy file editing runs on the cheaper model. To ask for the 1M window where it is not the default, use /model opusplan[1m] (needs v2.1.265 or later).
If you want Claude to decide mid-task when to consult a second model, the docs point to the advisor tool instead.
Use Fable for the Hardest Tasks
Fable models are the most capable models in Claude Code, built for tasks larger than one sitting. Select Fable 5.2 with:
/model fable
# or at launch
claude --model fable
Older versions are available by ID, for example /model claude-fable-5-1. Tips from the docs: describe the outcome rather than the steps, hand it ambiguous problems such as outage debugging, and skip extra “please verify” reminders because it checks its own work.
Depending on your plan and seat, Fable usage can bill to usage credits instead of your plan limits. The picker then shows “Requires usage credits” on the Fable row, and Claude Code asks for consent before it bills.
In non-interactive -p mode it does not ask. More on the model itself in our Fable 5.2 guide.
Set the Effort Level
Effort controls how much the model thinks on each step. Lower is faster and cheaper; higher reasons more deeply.
| Level | Use it for |
|---|---|
low |
Quick changes you review yourself, renames, first sketches |
medium |
Default on Fable 5.2, Opus 5.5, Sonnet 5.5 and Haiku 5.5; most feature work |
high |
Bug fixes in existing code where edge cases matter |
xhigh |
Deeper reasoning at higher token cost |
max |
Hard problems such as security reviews; can overthink, applies to the current session only |
/effortopens a slider;/effort highsets it directly;/effort autoclears your saved level.- In
/model: use the left and right arrows. - At launch:
claude --effort high. - Environment:
CLAUDE_CODE_EFFORT_LEVEL=high, which overrides every other source. - One turn only: put the word
ultrathinkin your prompt. Phrases such as “think hard” are just normal text.
Claude Code saves the level per model, so Opus and Sonnet can each keep their own. If you move from Opus 5 to Opus 5.5, start at medium: Anthropic says Opus 5.5 at medium matches or beats Opus 5 at high on coding evaluations.
1M Context and Auto-Compact
Fable models, Sonnet 5 and later, Haiku 5.5 and Opus 4.7 and later run with a 1 million token context window by default. You do not need the [1m] suffix for them.
By default, though, those sessions compact near 400K tokens to keep long sessions cheaper. To use the full window on the current model, run /autocompact 1M. To keep sessions at 200K, set CLAUDE_CODE_DISABLE_1M_CONTEXT=1. Our Claude Code context window guide covers /compact and /context in depth.
Pin Versions and Set Fallback Models
Aliases move to new versions over time. To stay on one version, use a full model name or pin the alias:
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"
The Haiku variable also sets the model used for background tasks. opusplan uses the Opus and Sonnet variables for its two phases.
For outages, configure a fallback chain. When the main model is overloaded or unavailable, Claude Code tries the next model for that turn only, then goes back to the main model on your next message.
Pass a comma-separated list with --fallback-model; chains are capped at three models. Rate limit, billing and authentication errors never trigger a fallback.
Which Model Should You Use?
| Task | Model | Effort |
|---|---|---|
| Renames, small edits, quick questions | haiku or sonnet | low |
| Everyday features and tests | sonnet | medium |
| Bug hunting, refactors, reviews | opus | medium or high |
| Big plans, then implementation | opusplan | medium |
| Long autonomous tasks, root-cause investigations | fable | medium or higher |
Usage limits matter on subscriptions: bigger models use your allowance faster. See Claude Code pricing and our best Claude model for coding comparison.
Troubleshooting
New sessions start on a different model
Common causes from the docs: you pressed s or used --model (session only), a project or managed setting or ANTHROPIC_MODEL overrides you, Claude Code could not write ~/.claude/settings.json, or you resumed a session, which usually keeps the model it was saved on.
“Model isn’t recognized, did you mean…”
You likely mistyped the ID. Change it to the suggestion wherever you set the model. A mistyped value in --model or settings only fails on the first request.
“Claude Code does not support this model”
Your version is too old for that model. Run claude update.
A model is missing from the picker
Your organization may restrict models with availableModels, or your plan may not include it. A grayed-out Fable row shows the reason.
The resumed session uses the old model
That is expected. Pass --model when you resume to choose another. Our resume guide explains the exceptions.
FAQ
How do I change the model in Claude Code?
Type /model and pick one, or type /model sonnet directly. Use claude --model opus to start a session on a model.
What model does Claude Code use by default?
Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and the API. Microsoft Foundry defaults to Sonnet 5.5.
What is opusplan in Claude Code?
An alias that uses Opus in plan mode and Sonnet when Claude carries out the plan.
How do I change the model for one session only?
Open /model and press s on the row, or launch with --model.
Does /model change the model for subagents?
Yes, for subagents that inherit the main model. Subagents with their own model setting keep it.
How do I use Haiku in Claude Code?
Run /model haiku or /model claude-haiku-5-5. Haiku 5.5 has a 1M window and costs more per token above 100K-token prompts.
Can I use non-Claude models in Claude Code?
Not officially. Community proxies exist; see our Claude Code Router guide.




