Skip to main content

What are Model Aliases in Claude Code

Model aliases are shortcuts in Claude Code that let you switch between different AI models without needing to know the full model names or version numbers. They provide a convenient way to select the right model for your task, whether you need speed, intelligence, or a massive context window.

How to Use It

You can use model aliases with the /model command during a session, with the --model flag at startup, or by setting the ANTHROPIC_MODEL environment variable.

  • Switch models mid-session: /model opus
  • Start with a specific model: claude --model sonnet


Why Use Model Aliases

Model aliases simplify my workflow by letting me quickly switch between models depending on the task. I use opusplan for complex planning, sonnet for everyday coding, and switch to purely using Sonnet when approaching the limit with my Claude Max 5X subscription.

Benefits:

  • Convenience - Short, easy-to-remember names for models.
  • Flexibility - Quickly switch between models for different tasks.
  • Future-Proof - Aliases automatically point to the latest model versions.
  • Efficiency - Use special aliases like opusplan for cost-effective workflows.


Available Model Aliases

Model aliasBehavior
defaultRecommended model setting, depending on your account type
sonnetUses the latest Sonnet model (currently Sonnet 4) for daily coding tasks
opusUses the most capable Opus model (currently Opus 4.1) for complex reasoning
haikuUses the fast and efficient Haiku model for simple tasks
sonnet[1m]Uses Sonnet with a 1 million token context window for long sessions
opusplanSpecial mode that uses opus during plan mode, then switches to sonnet for execution


Environment Variables for Alias Control

You can control which specific model an alias points to by using environment variables. These variables require the full model name.

Env varDescription
ANTHROPIC_DEFAULT_OPUS_MODELThe model to use for opus, or for opusplan when Plan Mode is active.
ANTHROPIC_DEFAULT_SONNET_MODELThe model to use for sonnet, or for opusplan when Plan Mode is not active.
ANTHROPIC_DEFAULT_HAIKU_MODELThe model to use for haiku, or background functionality.
CLAUDE_CODE_SUBAGENT_MODELThe model to use for subagents.

See Also: Model Comparison|Plan Mode|Configuration