Claude Code’s default model is Sonnet — specifically the latest Sonnet release for your provider (Sonnet 5 on the Anthropic API as of mid-2026). Sonnet is fast, handles most coding workloads well, and keeps costs reasonable across long sessions. If you haven’t changed anything, that’s what you’re running.
Changing the model takes one command: /model opus inside a session, or claude --model opus at launch. The rest of this guide covers when each model is actually worth switching to, what the shorthand aliases resolve to across different providers, and how to use Novita AI’s endpoint to access a wider set of open-weight models at lower per-token cost.
What Is the Default Model in Claude Code?
When you launch Claude Code without specifying a model, it starts on the sonnet alias, which resolves to the latest Sonnet release for your provider. On the Anthropic API (the default endpoint), that means Claude Sonnet 5 as of mid-2026. Free and Pro plan users both land on Sonnet 5 by default.
The logic is straightforward: Sonnet offers the best balance of speed and capability for everyday coding work. It handles file edits, multi-step refactors, test generation, and most repository-scale tasks without the extra latency or cost that comes with Opus. For the majority of sessions, switching to a heavier model doesn’t produce meaningfully better results.
If your organization has set an org-wide default model in Claude Code’s admin console, that overrides the system default and takes effect the next time you launch a session. You can still override it per-session with /model or the --model flag.
Available Models and Aliases
Claude Code uses aliases rather than full model IDs for day-to-day model selection. An alias like sonnet always points to the recommended version for your provider, so you don’t have to update your config each time a new model releases.
| Alias | What it selects | Best for |
|---|---|---|
sonnet | Latest Sonnet (Sonnet 5 on Anthropic API) | Default — fast, capable, and efficient for most coding work |
opus | Latest Opus (Opus 4.8 on Anthropic API) | Complex architectural reasoning, large codebase analysis |
haiku | Latest Haiku (Haiku 4.5) | Simple, quick tasks where speed matters more than depth |
fable | Claude Fable 5 | Long-running autonomous sessions, ambiguous or open-ended tasks |
best | Fable 5 if available, otherwise latest Opus | Highest available capability without manually specifying |
opusplan | Opus for planning, Sonnet for execution | Getting Opus’s reasoning on architecture without paying Opus rates for every step |
sonnet[1m] | Sonnet with 1M token context window | Very long sessions or large codebases that need extended context |
opus[1m] | Opus with 1M token context window | Complex long-context tasks that need Opus reasoning |
default | Clears any override; returns to account default | Resetting to the system default after testing other models |
Aliases update over time. To pin to a specific release — for reproducibility or to avoid unexpected behavior after a model update — use the full model ID instead:
claude --model claude-sonnet-5
claude --model claude-opus-4-8
Current Claude models (Anthropic API)
| Model | API ID | Context | Input cost | Output cost |
|---|---|---|---|---|
| Claude Fable 5 | claude-fable-5 | 1M tokens | $10/MTok | $50/MTok |
| Claude Opus 4.8 | claude-opus-4-8 | 1M tokens | $5/MTok | $25/MTok |
| Claude Sonnet 5 | claude-sonnet-5 | 1M tokens | $2/MTok* | $10/MTok* |
| Claude Haiku 4.5 | claude-haiku-4-5-20251001 | 200k tokens | $1/MTok | $5/MTok |
*Sonnet 5 introductory pricing through August 31, 2026; standard rate is $3/$15 per MTok.
All models have a 1 million token context window except Haiku 4.5, which tops out at 200k. For most coding work, context window size only becomes the deciding factor when you’re loading entire repositories or running very long agentic sessions.
How to Change the Model in Claude Code
There are four ways to configure the model, in order of priority:
1. During a session: /model
Type /model with no argument to open the interactive picker. Type /model <alias> to switch immediately:
/model opus
/model sonnet
/model haiku
/model fable
From Claude Code v2.1.153 onward, /model saves your choice as the default for future sessions. If you only want to switch for the current session, press s in the picker instead of Enter. Typing /model <alias> directly saves the choice (equivalent to Enter).
2. At launch: --model flag
Pass --model when you start Claude Code to apply the selection for that session only:
claude --model opus
claude --model haiku
claude --model claude-sonnet-5 # full model ID, pins to a specific version
This doesn’t affect the saved default and doesn’t persist to the next launch.
3. Environment variable: ANTHROPIC_MODEL
Set ANTHROPIC_MODEL to apply a model for the duration of a shell session or script:
export ANTHROPIC_MODEL="opus"
Like --model, this is session-scoped and doesn’t write to your settings file.
4. Settings file (permanent default)
To set a permanent default, add the model field to your Claude Code settings file (usually ~/.claude/settings.json):
{
"model": "opus"
}
This applies every time you launch Claude Code from that machine unless overridden by a --model flag or ANTHROPIC_MODEL env var.
Per-alias environment variables
If you want the opus alias to resolve to a specific version across any environment, set ANTHROPIC_DEFAULT_OPUS_MODEL. The same pattern applies for other families:
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-8"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"
export ANTHROPIC_DEFAULT_FABLE_MODEL="claude-fable-5"
This is useful in CI/CD or team setups where you want reproducible model resolution without pinning full model IDs everywhere.
Choosing the Right Model for Coding
The model tier you need depends more on task type than complexity alone.
Stick with Sonnet (default) for:
- Daily coding tasks — implementing features, writing tests, refactoring
- Iterative sessions where you’re reviewing diffs and asking follow-up questions
- Most multi-file edits where the codebase fits in the context window
- Cases where speed matters (Sonnet responds noticeably faster than Opus)
Sonnet’s main limitation is reasoning depth on genuinely ambiguous architectural questions. It tends to pick the first reasonable approach rather than evaluating alternatives. For decisions where getting the tradeoff wrong costs significant refactor time, upgrading to Opus is worth it.
Switch to Opus for:
- Root-cause debugging where the problem isn’t obvious
- Architecture decisions: choosing between design patterns, evaluating refactor strategies, identifying where technical debt will bite you
- Large codebase analysis where you need Opus to hold more context in working memory
- Multi-hour autonomous sessions where accumulated context degradation is a factor
Opus 4.8 costs 2.5x more than Sonnet 5 per token, and it’s slower. For short tasks, the difference in reasoning quality often doesn’t justify the cost. The opusplan alias is a practical middle ground: it uses Opus during the planning phase (where deeper reasoning pays off) and drops to Sonnet for implementation (where throughput matters more).
Use Haiku for:
- Code formatting, comment cleanup, simple variable renames
- Tasks where you want fast responses for minimal changes
- High-volume scripted use cases where token cost matters most
Haiku 4.5 is the fastest model and the cheapest at $1/$5 per MTok, but it won’t match Sonnet or Opus on multi-step reasoning or complex codebases.
Use Fable 5 for:
- Outage debugging and incident investigation
- Long, open-ended agentic runs where you want the model to investigate before acting
- Ambiguous problems where you’d normally break the work into multiple sessions
Fable 5 is not the default because most coding sessions don’t need it. It’s slower and costs twice as much as Opus. Where it earns its keep is in genuinely complex, sustained work: it verifies its own outputs more thoroughly, handles tool-call sequences without losing the thread, and makes fewer decisions that require corrective prompting. For typical feature work, it’s overkill.
Model Selection on Bedrock, Vertex, and Other Providers
Aliases resolve differently depending on which API provider you’re using. If you’re routing Claude Code through Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry, the alias resolution is older by default:
| Provider | opus alias resolves to | sonnet alias resolves to |
|---|---|---|
| Anthropic API (default) | Opus 4.8 | Sonnet 5 |
| Claude Platform on AWS | Opus 4.7 | Sonnet 4.6 |
| Amazon Bedrock | Opus 4.6 | Sonnet 4.5 |
| Google Cloud Agent Platform | Opus 4.6 | Sonnet 4.5 |
| Microsoft Foundry | Opus 4.6 | Sonnet 4.5 |
To get newer models on Bedrock, Vertex, or Foundry, either use the full model ID explicitly or set the ANTHROPIC_DEFAULT_OPUS_MODEL / ANTHROPIC_DEFAULT_SONNET_MODEL environment variables to the provider-specific model ARN or deployment name for the version you want.
How to Access More Models via Novita AI
Claude Code reads ANTHROPIC_BASE_URL to determine which API endpoint to send requests to. Point it at Novita AI’s Anthropic-compatible endpoint to use open-weight models — including DeepSeek, Qwen, GLM, Kimi, and MiniMax variants — while keeping Claude Code’s agentic workflow intact.
This is useful when:
- You want to try a specific open-weight model (Qwen3-Coder, GLM-4.7, MiniMax M2.7) against your actual codebase
- Per-token cost is a constraint and you’re running high-volume agentic sessions
- You’re benchmarking model quality on your own tasks before committing to API spend
Setup
- Sign up at novita.ai to get free trial credits.
- Go to Key Management, create a new key, and copy it.
- Set these environment variables before launching Claude Code:
macOS / Linux:
export ANTHROPIC_BASE_URL="https://api.novita.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="<your Novita API key>"
export ANTHROPIC_MODEL="minimax/minimax-m2.7"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="minimax/minimax-m2.7"
Windows (Command Prompt):
set ANTHROPIC_BASE_URL=https://api.novita.ai/anthropic
set ANTHROPIC_AUTH_TOKEN=<your Novita API key>
set ANTHROPIC_MODEL=minimax/minimax-m2.7
set ANTHROPIC_DEFAULT_HAIKU_MODEL=minimax/minimax-m2.7
Windows (PowerShell):
$env:ANTHROPIC_BASE_URL = "https://api.novita.ai/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "<your Novita API key>"
$env:ANTHROPIC_MODEL = "minimax/minimax-m2.7"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "minimax/minimax-m2.7"
Launch Claude Code normally after setting the variables. The /model picker will reflect the Novita-hosted models you’ve configured rather than the Anthropic alias list.
A note on ANTHROPIC_BASE_URL vs model selection
ANTHROPIC_BASE_URL changes where requests go, not which Anthropic model answers them. When pointing at Novita AI, the model name you set in ANTHROPIC_MODEL should be a Novita-hosted model ID (like minimax/minimax-m2.7 or deepseek/deepseek-v4-flash), not an Anthropic alias like sonnet or opus. Anthropic aliases only resolve correctly against Anthropic’s own endpoint.
Representative models available on Novita AI
| Model | Novita model ID | Strength |
|---|---|---|
| MiniMax M2.7 | minimax/minimax-m2.7 | Agentic tool-calling, 97% tool accuracy |
| DeepSeek V4 Flash | deepseek/deepseek-v4-flash | Fast and cost-efficient for iterative tasks |
| Qwen3-Coder 480B | qwen/qwen3-coder-480b-a35b-instruct | Code generation, large context |
| GLM-4.7 | zai-org/glm-4.7 | Coding and agentic tasks |
Check novita.ai/llm-api for the current model list and verified model IDs before configuring — model availability and naming can change.
FAQ
What is the default model in Claude Code?
Sonnet — specifically the latest Sonnet release for your API provider. On the Anthropic API, this is Claude Sonnet 5 as of mid-2026. If your organization has set an org-wide default, that takes precedence.
How do I switch the model in Claude Code?
The fastest way is /model <alias> during an active session. To set it permanently, add "model": "opus" (or your preferred alias) to your settings file at ~/.claude/settings.json. Use --model at launch for a one-off session override.
What does the opusplan alias do?
It uses Opus during Claude Code’s planning phase and switches to Sonnet for execution. This gives you Opus’s deeper reasoning on architectural decisions without paying Opus rates for every file edit during implementation. It’s a good default if you find yourself regularly wanting Opus for the “figure out what to do” part but not the “write the code” part.
Can I pin to a specific model version?
Yes. Pass the full model ID instead of an alias: claude --model claude-sonnet-5 or claude --model claude-opus-4-8. For a permanent pin, add the full ID to your settings file or set ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5 in your environment.
Does the model affect Claude Code’s tools and capabilities?
No. All models have access to the same Claude Code tool set: file reading and editing, bash execution, web search, MCP, and the rest. The model tier affects reasoning quality, not which tools are available.
Can I use different models for different projects?
Yes. Add a model field to a project-level settings file (.claude/settings.json in your project root). That overrides your user-level default for sessions started in that directory. You can also use ANTHROPIC_MODEL in a project-specific .env file or script.
What happens if the model I selected is deprecated or unavailable?
Claude Code shows a warning at startup naming the requested model and the substituted one. The session starts on the system default. To avoid unexpected substitutions, switch to the current recommended alias or update your setting to a non-deprecated model ID.
Recommended Articles
- Use MiniMax M2.7 in Claude Code via Novita AI
- Claude Code CLI Documentation: Setup, Slash Commands, and LLM API Integration
- Use Qwen3-Coder-480B-A35B-Instruct in Claude Code: A Practical Guide
Sources checked July 10, 2026: Claude Code model configuration docs, Anthropic models overview, Novita AI LLM API.
