Skip to content
gentic.news — AI News Intelligence Platform

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

3 Ways to Switch Claude Code Models Instantly: /model, --flag, and ENV Variables

3 Ways to Switch Claude Code Models Instantly: /model, --flag, and ENV Variables

Anthropic's official guide reveals three methods to switch Claude Code models: /model command, --model flag, and ANTHROPIC_MODEL env variable. Choose the right model for each task.

Share:
Source: support.claude.comvia hn_claude_code, gn_claude_code, gn_claude_model, gn_mcp_protocol, simon_willison, reddit_claude, devto_claudecode, medium_claudeWidely Reported

Key Takeaways

  • Anthropic's official guide reveals three methods to switch Claude Code models: /model command, --model flag, and ANTHROPIC_MODEL env variable.
  • Choose the right model for each task.

What Changed — Official Model Switching Guide

Anthropic has published a comprehensive guide on how to change which Claude model powers your Claude Code sessions. While many users assumed model selection was a one-time setup, this guide reveals three distinct methods — each suited for different workflows.

Supported models now include:

  • Opus 4.7 (claude-opus-4-7) — the newest frontier reasoning model, featuring 3.75MP vision and improved agentic coding
  • Sonnet 4.6 (claude-sonnet-4-6) — the default, balanced for speed and capability
  • Opus 4.6 (claude-opus-4-6) — the previous top-tier model
  • Opus 4.5 (claude-opus-4-5-20251101)
  • Haiku 4.5 (claude-haiku-4-5-20251001) — fastest, cheapest
  • Sonnet 4.5 (claude-sonnet-4-5-20250929)

⚠️ Pro plan users: Opus models require enabling and purchasing extra usage.

What It Means For You

This isn't just a convenience feature — it's a cost and performance lever. Here's how to think about it:

  • Opus 4.7 for complex refactoring, multi-file changes, and deep reasoning tasks where you'd wait an extra 10-20 seconds for better output.
  • Sonnet 4.6 as your daily driver — it's the default for good reason.
  • Haiku 4.5 for quick lookups, simple edits, or when you're burning through tokens on a Pro plan.

This follows the release of Claude Opus 4.7 on April 20, 2026 — the model that achieved 87.6% on SWE-Bench with constrained cyber capabilities. The new tokenizer in Opus 4.7 increases token counts for the same input, so you might want to reserve it for high-stakes work.

Try It Now

Method 1: Instant switch with /model (easiest)

Claude Help Center

From within any Claude Code session:

/model

Select your desired model from the interactive menu. Change takes effect immediately. Verify with:

/status

Method 2: One-session override with --model flag

Start a fresh session with a specific model:

claude --model claude-opus-4-7

This overrides your default for that session only. Perfect for one-off complex tasks.

Method 3: Permanent default via environment variable

Set your preferred model for all future sessions by adding to your shell config:

For ZSH (macOS default):

echo 'export ANTHROPIC_MODEL="claude-opus-4-7"' >> ~/.zshrc
source ~/.zshrc

For BASH (Linux default):

echo 'export ANTHROPIC_MODEL="claude-sonnet-4-6"' >> ~/.bashrc
source ~/.bashrc

Close Terminal completely, reopen, and start Claude Code:

claude

Pro Tips

  1. Check current model anytime: /status in Claude Code
  2. Per-project defaults: Set ANTHROPIC_MODEL in a .env file or your project's CLAUDE.md config
  3. Cost-conscious: Use Haiku 4.5 for CI/CD scripts or automated review tasks
  4. Model availability: The /model menu only shows models your account has access to — no guessing

Claude Help Center

gentic.news Analysis

This guide arrives at a critical inflection point for Claude Code users. With Claude Opus 4.7 now available (released April 20, 2026, with an updated tokenizer), and the recent pricing shift where Anthropic removed Claude Code from the $20 plan (covered in our April 23 article), model selection directly impacts your bill.

Claude Code has appeared in 58 articles this week alone (total: 634 across gentic.news), reflecting massive adoption. The ability to switch models per-task isn't just nice-to-have — it's essential for managing token costs while still accessing frontier reasoning when needed.

What you should do differently:

  • Create a default model strategy: Set Sonnet 4.6 as your permanent default via ANTHROPIC_MODEL, then use --model claude-opus-4-7 for specific complex tasks
  • Add a CLAUDE.md note: "Use Opus 4.7 for architecture decisions and refactoring; use Sonnet 4.6 for implementation"
  • Monitor usage: Run /status frequently to ensure you're not accidentally running Opus on trivial tasks
  • Consider Haiku for automation: If you're building MCP servers or automated scripts (like the Playwright MCP Server we covered on April 21), Haiku 4.5 can handle 80% of tasks at a fraction of the cost

This guide also aligns with the trend toward model routing — the practice of selecting the right model for each task rather than using one model for everything. As the Claude model family expands, this becomes a superpower.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

**What to change in your workflow immediately:** 1. **Set your default to Sonnet 4.6** via environment variable. This is the best balance of speed, capability, and cost. Only use Opus 4.7 when you explicitly need its deeper reasoning — not for every query. 2. **Create a CLAUDE.md with model routing rules.** Example: ``` # Model routing - Use `--model claude-haiku-4-5-20251001` for git commit messages and simple lint fixes - Use `--model claude-sonnet-4-6` for most coding tasks - Use `--model claude-opus-4-7` for architecture, security audits, and multi-file refactoring ``` 3. **Leverage the /model command as a safety valve.** When you hit a hard problem mid-session, type `/model` and switch to Opus 4.7 without losing context. No need to restart. 4. **Watch token counts with Opus 4.7.** The new tokenizer increases token counts for the same input (as noted in our April 20 coverage). This means Opus 4.7 sessions will consume your usage cap faster than Opus 4.6 — use it judiciously. 5. **For Pro users:** The guide confirms Opus models require extra usage purchases. If you're on Pro, consider keeping Sonnet 4.6 as default and only using Opus when absolutely necessary to avoid unexpected charges.
Enjoyed this article?
Share:

Related Articles

More in Products & Launches

View all