Model configuration
Learn about the Claude Code model configuration, including model aliases like opusplan
Available models
For the model
setting in Claude Code, you can either configure:
- A model alias
- A full model name
- For Bedrock, an ARN
Model aliases
Model aliases provide a convenient way to select model settings without remembering exact version numbers:
Model alias | Behavior |
---|---|
default | Recommended model setting, depending on your account type |
sonnet | Uses the latest Sonnet model (currently Sonnet 4) for daily coding tasks |
opus | Uses the most capable Opus model (currently Opus 4.1) for complex reasoning |
haiku | Uses the fast and efficient Haiku model for simple tasks |
sonnet[1m] | Uses Sonnet with a 1 million token context window window for long sessions |
opusplan | Special mode that uses opus during plan mode, then switches to sonnet for execution |
Setting your model
You can configure your model in several ways, listed in order of priority:
- During session - Use
/model <alias|name>
to switch models mid-session - At startup - Launch with
claude --model <alias|name>
- Environment variable - Set
ANTHROPIC_MODEL=<alias|name>
- Settings - Configure permanently in your settings file using the
model
field.
Example usage:
Example settings file:
Special model behavior
default
model setting
The behavior of default
depends on your account type.
For certain Max users, Claude Code will automatically fall back to Sonnet if you hit a usage threshold with Opus.
opusplan
model setting
The opusplan
model alias provides an automated hybrid approach:
- In plan mode - Uses
opus
for complex reasoning and architecture decisions - In execution mode - Automatically switches to
sonnet
for code generation and implementation
This gives you the best of both worlds: Opus’s superior reasoning for planning, and Sonnet’s efficiency for execution.
Extended context with [1m]
For Console/API users, the [1m]
suffix can be added to full model names to
enable a
1 million token context window.
Note: Extended context models have different pricing.
Checking your current model
You can see which model you’re currently using in several ways:
- In status line (if configured)
- In
/status
, which also displays your account information.
Environment variables
You can use the following environment variables, which must be full model names, to control the model names that the aliases map to.
Env var | Description |
---|---|
ANTHROPIC_DEFAULT_OPUS_MODEL | The model to use for opus , or for opusplan when Plan Mode is active. |
ANTHROPIC_DEFAULT_SONNET_MODEL | The model to use for sonnet , or for opusplan when Plan Mode is not active. |
ANTHROPIC_DEFAULT_HAIKU_MODEL | The model to use for haiku , or background functionality |
CLAUDE_CODE_SUBAGENT_MODEL | The model to use for subagents |
Note: ANTHROPIC_SMALL_FAST_MODEL
is deprecated in favor of
ANTHROPIC_DEFAULT_HAIKU_MODEL
.