Skip to main content

Claude Code Model Configuration

Updated this week

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.

  1. Start Claude Code: claude.

  2. Type /model and choose your desired model from the interactive menu.

  3. Your model change takes effect immediately.

Note: You can check your current model anytime by running /status in Claude Code.

Supported Models

  • Opus 4.1, claude-opus-4-1-20250805

  • Opus 4, claude-opus-4-20250514

  • Sonnet 4, claude-sonnet-4-20250514

  • Sonnet 3.7, claude-3-7-sonnet-20250219

  • Haiku 3.5, claude-3-5-haiku-20241022

⚠️ Model Access: When using a Pro plan with Claude Code, you will not be able to use Opus models.

Change Model for Current Session Only

Use the --model flag when starting Claude Code.

  1. Start a fresh Terminal session.

  2. Enter the following commands (depending on the model you’d like to use for that session):

    1. For Opus 4.1: claude --model claude-opus-4-1-20250805

    2. For Opus 4: claude --model claude-opus-4-20250514

    3. For Sonnet 4: claude --model claude-sonnet-4-20250514

    4. For 3.7 Sonnet: claude --model claude-3-7-sonnet-20250219

    5. For 3.5 Haiku: claude --model claude-3-5-haiku-20241022

Note: The Opus models will be unavailable to Pro plan users logged into Claude Code.

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):

  • Opus 4.1: echo 'export ANTHROPIC_MODEL="claude-opus-4-1-20250805"' >> ~/.zshrc

  • Opus 4: echo 'export ANTHROPIC_MODEL="claude-opus-4-20250514"' >> ~/.zshrc

  • Sonnet 4: echo 'export ANTHROPIC_MODEL="claude-sonnet-4-20250514"' >> ~/.zshrc

  • 3.7 Sonnet: echo 'export ANTHROPIC_MODEL="claude-3-7-sonnet-20250219"' >> ~/.zshrc

  • 3.5 Haiku: echo 'export ANTHROPIC_MODEL="claude-3-5-haiku-20241022"' >> ~/.zshrc

For BASH users (Linux):

  • Opus 4.1: echo 'export ANTHROPIC_MODEL="claude-opus-4-1-20250805"' >> ~/.bashrc

  • Opus 4: echo 'export ANTHROPIC_MODEL="claude-opus-4-20250514"' >> ~/.bashrc

  • Sonnet 4: echo 'export ANTHROPIC_MODEL="claude-sonnet-4-20250514"' >> ~/.bashrc

  • 3.7 Sonnet: echo 'export ANTHROPIC_MODEL="claude-3-7-sonnet-20250219"' >> ~/.bashrc

  • 3.5 Haiku: echo 'export ANTHROPIC_MODEL="claude-3-5-haiku-20241022"' >> ~/.bashrc

Step 3) Apply the changes:

  • For ZSH: source ~/.zshrc

  • For 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.

Did this answer your question?