This guide shows you three ways to change which Claude model you're using with Claude Code: the quick /model command for instant changes, the --model flag for one-time session changes, and environment variables to set your preferred model as the permanent default.
Easiest method: Use /model command
The simplest way to change models is to use the /model command directly within Claude Code. This works immediately without restarting your terminal.
Start Claude Code:
claudeType
/modeland choose your desired model from the interactive menu.Your model change takes effect immediately.
Note: You can check your current model anytime by running /status in Claude Code.
Supported models
Sonnet 4.6,
claude-sonnet-4-6Opus 4.6,
claude-opus-4-6Opus 4.5,
claude-opus-4-5-20251101Haiku 4.5,
claude-haiku-4-5-20251001Sonnet 4.5,
claude-sonnet-4-5-20250929
⚠️ Model access: When using a Pro plan with Claude Code, you will only be able to use Opus models after enabling and purchasing extra usage.
Change model for current session only
Use the --model flag when starting Claude Code.
Start a fresh Terminal session.
Enter the following commands (depending on the model you’d like to use for that session):
For Sonnet 4.6:
claude --model claude-sonnet-4-6For Opus 4.6:
claude --model claude-opus-4-6For Opus 4.5:
claude --model claude-opus-4-5-20251101For Haiku 4.5:
claude --model claude-haiku-4-5-20251001For Sonnet 4.5:
claude --model claude-sonnet-4-5-20250929
Change default model for all future sessions
Step 1) Check your shell type by running: echo $SHELL
/bin/zsh→ You're using zsh (macOS default)/bin/bash→ You're using bash (Linux default)
Step 2) Add model setting to your shell config:
For ZSH users (macOS)
Spnnet 4.6:
echo 'export ANTHROPIC_MODEL="claude-sonnet-4-6"' >> ~/.zshrcOpus 4.6:
echo 'export ANTHROPIC_MODEL="claude-opus-4-6"' >> ~/.zshrcOpus 4.5:
echo 'export ANTHROPIC_MODEL="claude-opus-4-5-20251101"' >> ~/.zshrcHaiku 4.5:
echo 'export ANTHROPIC_MODEL="claude-haiku-4-5-20251001"' >> ~/.zshrcSonnet 4.5:
echo 'export ANTHROPIC_MODEL="claude-sonnet-4-5-20250929"' >> ~/.zshrc
For BASH users (Linux)
Sonnet 4.6:
echo 'export ANTHROPIC_MODEL="claude-sonnet-4-6"' >> ~/.bashrcOpus 4.6:
echo 'export ANTHROPIC_MODEL="claude-opus-4-6"' >> ~/.bashrcOpus 4.5:
echo 'export ANTHROPIC_MODEL="claude-opus-4-5-20251101"' >> ~/.bashrcHaiku 4.5:
echo 'export ANTHROPIC_MODEL="claude-haiku-4-5-20251001"' >> ~/.bashrcSonnet 4.5:
echo 'export ANTHROPIC_MODEL="claude-sonnet-4-5-20250929"' >> ~/.bashrc
Step 3) Apply the changes:
For ZSH:
source ~/.zshrcFor BASH:
source ~/.bashrc
Step 4) Close Terminal completely, then reopen it.
Step 5) Start Claude Code in a fresh Terminal session: claude.
Now your chosen model will be the default for all future Claude Code sessions.
