How to switch Sonnet and Opus in Claude Code
Understand /model, model aliases, full model IDs, provider differences, and cost impact in Claude Code. Covers setup, expected behavior, and common fixes.
Short answer
When switching Sonnet, Opus, or another model in Claude Code, prefer the supported /model entry point or the official model configuration path.
Model aliases, full model IDs, and provider mappings are not always identical. A marketing name shown in a web UI is not always the API-recognized model ID.
If you use a third-party gateway, use the model ID shown by that gateway or provider documentation.
When this matters
- You want to switch between cheaper and stronger models
- You see Sonnet / Opus / Haiku aliases but do not know what to enter
- You use a third-party Base URL or model gateway
- You want to control Claude Code token cost
- You see model not found or model selection does not take effect
Three layers of model names
| Layer | Meaning |
|---|---|
| Display name | Human-friendly name shown in a UI |
| Alias | Short name or shortcut inside a tool |
| Model ID | The identifier actually recognized by the API |
What matters for a successful request is whether the current provider recognizes the Model ID.
Recommended practice
- Confirm which models the current provider supports.
- Use Claude Code
/modelor the official model configuration path. - If you use a third-party gateway, copy the available model ID from its model plaza.
- Consider model choice and cost together.
- Do not guess model names by hand.
About BetterToken
Copy the exact Model ID from the model plaza. Update the Model ID in your configuration and restart Claude Code. To switch during a session, use /model YOUR_MODEL_ID.
Model choice affects quality, speed, and cost. Usage records help you compare actual consumption across models.
Related docs
- Why Claude Code uses so many tokens
- How to configure API Key and Base URL in Claude Code
- Claude Code permissions and hooks
- OpenAI-compatible API vs Anthropic-compatible API

