Coding · Updated 2026-07-04 · By Ge Gao

How to Use Sonnet 5 in Claude Code

Sonnet 5 is the default Claude Code model for Pro users. How to install Claude Code, check or switch models with /model, and get the most out of agentic coding.

If you're on a Claude Pro plan, Sonnet 5 is already the default model in Claude Code — you don't need to change anything. If you're on another plan or using the API, switching takes one command: /model. Here's the full setup, from zero.

A disclosure that doubles as a credential: this site's build scripts, tests and content pipeline are maintained in Claude Code sessions running Sonnet 5. What follows is the workflow we actually use, not a rewritten changelog.

Step 1: Install Claude Code

Claude Code is Anthropic's terminal coding agent. Install it with npm (Node 18+):

npm install -g @anthropic-ai/claude-code

Then run claude inside a project folder and log in with your Claude account. A Pro subscription (~$20/month) includes Claude Code usage; heavy users graduate to Max. The official docs cover native installers and IDE extensions if you'd rather not use npm.

Step 2: Check which model you're on

Inside a session, type:

/model

This shows the active model and lets you switch. Pro accounts default to Sonnet 5. If the interactive picker doesn't list it as a preset (a known quirk shortly after launch), you can set it explicitly by ID:

claude --model claude-sonnet-5

Choosing a model with /model persists in your settings, so future sessions start on it.

Step 3: Put Sonnet 5's agentic strength to work

Sonnet 5 was built for exactly what Claude Code does — long, tool-heavy, autonomous runs. A few habits that pay off immediately:

When to switch up to Opus 4.8

Sonnet 5 handles the large majority of coding sessions, and tool makers' own benchmarks (Cursor's CursorBench, Cognition's FrontierCode) put it at or near Opus level. But on the hardest problems — gnarly concurrency bugs, long-horizon multi-repo work — /model up to Opus 4.8 and accept the higher usage burn. Our Opus 4.8 vs Sonnet 5 comparison covers the trade-off, including why Sonnet 5's lower sticker price doesn't always mean a cheaper job.

Prefer a GUI over the terminal? Cursor runs Sonnet 5 too — many developers keep both.

Frequently asked questions

Is Sonnet 5 the default model in Claude Code?

Yes, for Pro plan users — Anthropic made Sonnet 5 the Claude Code default at launch (June 30, 2026). On other plans or the API, select it with /model or start with claude --model claude-sonnet-5.

Do I need the API to use Sonnet 5 in Claude Code?

No. A Claude Pro or Max subscription includes Claude Code usage with Sonnet 5. The API is an alternative for usage-based billing, at $3 / $15 per million tokens (intro $2 / $10 until August 31, 2026).

How do I switch between Sonnet 5 and Opus 4.8 in Claude Code?

Type /model in a session and pick the model, or pass --model claude-sonnet-5 (or an Opus model ID) when launching. The choice is saved to your settings for future sessions.

Is Claude Code free with the Sonnet 5 free plan?

No — Claude Code is included from the Pro plan (~$20/month) upward. The claude.ai Free plan covers chat on the web and apps, not Claude Code. See what the free tier does include in our guide to using Sonnet 5 free.

Does Sonnet 5 work in Cursor, Windsurf and other editors too?

Yes. Cursor, Windsurf, Cline, Zed and GitHub Copilot all added Claude Sonnet 5 within days of launch. See our best AI coding assistants ranking for how they compare.