THE BINARY MONSTER JOURNAL / how-to

How to Use Opus 4.6 in Claude Code: Settings and Pinning

Want Claude Code to run on Opus 4.6 specifically? Here is how to select it per session, per launch or per project, how the alias variables work, when Opus is worth the cost, and the mistakes that silently switch models.

Diagram showing how to use Opus 4.6 in Claude Code by pinning the model in a session, launch flag or settings file

If you want to know how to use Opus 4.6 in Claude Code, the short version is this: tell Claude Code the exact model ID, claude-opus-4-6, rather than relying on the generic opus shortcut. Since Opus 4.6 came out in February 2026, Anthropic has released newer Opus models, so the shortcut may no longer land on 4.6. This guide shows where to set the model, how to make the choice stick, when Opus is worth its cost, and the mistakes that quietly switch you to something else.

If you have never run Claude Code before, start with our walkthrough on how to use Claude Code for setup, prompts and a daily workflow, then come back here to control the model.

What Opus 4.6 is and why you might pin it

Claude models come in tiers. Haiku is the smallest and cheapest, Sonnet sits in the middle, and Opus is the most capable. Opus 4.6 launched in early February 2026 with a much larger context window option (up to one million tokens), stronger coding and reasoning, and better handling of long agent tasks. A “token” is a chunk of text, roughly a few characters; the context window is how much text the model can consider at once.

Claude Code is Anthropic’s agentic coding tool. It runs in your terminal, reads your project, edits files and runs commands based on plain-English instructions. It can use several Claude models, and the one you pick changes speed, cost and quality.

Why use Opus 4.6 in Claude Code specifically when newer models exist? A few practical reasons:

  • Consistency. You have prompts, project instructions or a team workflow tuned around how 4.6 behaves, and you do not want results to shift mid-project.
  • Comparison. You want to test a newer model against 4.6 on the same task before switching.
  • Provider availability. Your company’s cloud account or gateway only offers certain model versions.

If none of these apply, the default Opus option is usually the better choice. Older versions are eventually retired, so check that 4.6 is still offered on your plan or provider before building a workflow around it.

How to use Opus 4.6 in Claude Code: four ways to select it

Claude Code reads its model choice from several places. Here they are, from the quickest to the most permanent.

1. The /model command (current session)

Inside a running session, type /model. Claude Code shows a menu of available models. If Opus 4.6 appears in the list, pick it. If it does not, you can usually type the full ID:

/model claude-opus-4-6

This lasts for the session. Close the terminal and it is gone unless you saved it elsewhere.

2. The --model flag (one launch)

When you start Claude Code in the terminal, pass the model directly:

claude --model claude-opus-4-6

This is handy for scripts or for one-off comparison runs where you want to be certain which model answered.

3. The ANTHROPIC_MODEL environment variable (your shell)

An environment variable is a setting your shell passes to programs. Set it once in your shell profile and every launch of Claude Code uses Opus 4.6:

# macOS / Linux (add to ~/.zshrc or ~/.bashrc)
export ANTHROPIC_MODEL="claude-opus-4-6"

# Windows PowerShell (current session)
$env:ANTHROPIC_MODEL = "claude-opus-4-6"

4. The settings.json file (user or project)

For a choice that survives restarts and travels with a project, use a settings file. Your personal settings live in ~/.claude/settings.json. Project settings live in .claude/settings.json inside the repository.

{
  "model": "claude-opus-4-6"
}

After any of these, confirm what you are actually running with /status or by opening /model again. Do not assume.

Layered diagram of the four ways to choose a model in Claude Code and which one overrides the others
The /model command and the --model flag override what your settings file says, so check them first when the wrong model appears.

Making Opus 4.6 stick: aliases and a worked example

The most common complaint is “I chose Opus, but it is not 4.6.” That happens because of aliases. An alias is a short name like opus, sonnet or haiku that Claude Code maps to a specific model behind the scenes. When Anthropic releases a newer Opus, the opus alias can move to it.

You can override what each alias points to with three environment variables. These are the variables people set to bring back a choice between versions in the model menu:

  • ANTHROPIC_DEFAULT_OPUS_MODEL
  • ANTHROPIC_DEFAULT_SONNET_MODEL
  • ANTHROPIC_DEFAULT_HAIKU_MODEL

Worked example: a project that always uses Opus 4.6

Say you maintain a mid-sized web app and your team agreed to stay on Opus 4.6 in Claude Code until a release ships. You want everyone who opens the repo to get the same model, even if they type /model opus out of habit.

  1. In the repository root, create a folder named .claude if it does not exist.
  2. Create .claude/settings.json with this content:
    {
      "model": "claude-opus-4-6",
      "env": {
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6"
      }
    }
  3. Commit the file so teammates receive it.
  4. Open a new terminal in the project, run claude, then /status. The model line should show Opus 4.6.
  5. Type /model opus and check again. Because the alias now maps to 4.6, you stay on it.

The env block applies those variables only when Claude Code runs, so it does not change your wider system. Personal overrides that you do not want to share can go in .claude/settings.local.json, which is meant to stay out of version control.

If you use Bedrock, Vertex or a gateway

Cloud providers use their own model identifiers, which differ from claude-opus-4-6. To use Opus 4.6 in Claude Code through a provider, copy the exact ID from your provider’s model list and use it in the same places. Typing the Anthropic API ID into a provider setup is a frequent cause of “model not found” errors.

Should you always use Opus in Claude Code?

No. Opus is the strongest tier, but it is also the most expensive per token and burns through subscription limits fastest. On a paid plan, that means hitting usage caps sooner; on API billing, it means a bigger bill. Whether you can use Opus at all also depends on your plan, so check what your subscription includes.

TaskReasonable choiceWhy
Planning a refactor across many filesOpusBenefits most from deeper reasoning and long context
Hunting a bug nobody can reproduceOpusNeeds careful reading of logs and code paths
Writing tests for an existing functionSonnetWell-defined, fast, cheaper
Renaming, formatting, small editsSonnet or HaikuOpus adds cost without much gain
Plan first, then implementopusplanUses Opus in plan mode and Sonnet for execution

A practical habit: start a hard task on Opus 4.6, let it write a plan you approve, then switch with /model sonnet for the routine implementation. Switch back if it gets stuck. If you pay through the API, the /cost command shows what the session has used so far.

Balance scale comparing when to use Opus versus Sonnet in Claude Code
Opus earns its cost on planning and hard problems; Sonnet covers most routine edits.

Using the long context and agents with Opus 4.6

Two features came up around the Opus 4.6 launch that change how you work in Claude Code.

The 1M-token context window

Opus 4.6 can handle far more text at once than earlier Opus versions, enough for large parts of a codebase. Access to the largest context size has depended on your account and plan, and has been billed differently from standard context. In practice, a big window does not mean you should fill it. Long sessions get slower and pricier, and the model can lose focus on older details. Use /compact to summarise a long conversation and /clear to start fresh when you change topic.

Subagents and agent teams

Claude Code can hand work to subagents: separate helpers with their own instructions and context, useful for jobs like “review this diff” or “search the codebase for every caller of this function.” You manage them with the /agents command, and each can have its own model setting. That means you can keep the main session on Opus 4.6 while a search-only subagent runs on a cheaper model.

Alongside Opus 4.6, Anthropic also introduced agent teams, where several Claude Code agents work on independent subtasks in parallel. It arrived as an experimental feature, so check the current documentation for how to enable it before relying on it. Parallel agents multiply token use, so they suit large, clearly split tasks rather than everyday edits.

Common mistakes when using Opus 4.6 in Claude Code

  • Using the alias and assuming the version. opus means “current default Opus,” not “4.6.” Use the full ID or override the alias.
  • Conflicting settings. A launch flag or /model choice overrides settings files. If the wrong model shows up, check your shell profile for a forgotten ANTHROPIC_MODEL line and your project and user settings files.
  • Broken JSON. A missing comma or quote in settings.json can make Claude Code ignore the file. Paste it into any JSON validator or check that your editor shows no errors.
  • Editing the wrong file. ~/.claude/settings.json is yours; .claude/settings.json belongs to the project. Make sure you are inside the right folder.
  • Forgetting to restart. Environment variable changes only apply to new terminal windows. Open a fresh one.
  • Running Opus for everything. You hit limits mid-afternoon and lose the model when you need it most. Save Opus for the hard parts.
  • Assuming 4.6 is available forever. Older models are retired over time. If a pinned ID stops working, check which models your account offers now.

Keeping your computer usable during long Opus runs

Long agent sessions create their own small problems: your machine slows down while builds and tests run, and typing detailed prompts gets tiring. A few of our own tools are aimed at exactly these moments. Apart from Golem, they are coming soon, so treat them as things to watch rather than things to install today.

  • CPU Limit (coming soon, Windows) reserves part of your processor so a busy coding agent does not freeze the rest of your desktop. Until then, our guide on how to reduce CPU usage on Windows covers what you can adjust yourself.
  • Hotkey Voice Dictate (coming soon, Windows) turns speech into text from a global hotkey, which suits the long, descriptive prompts Opus handles well.
  • Eve: AI Computer Agent (coming soon, Windows) is a voice-driven desktop assistant designed to drive coding agents, including Claude Code.
  • Xorn: AI Video Editor (coming soon) is built so agents like Claude Code can create and edit videos in a shared visual editor, with source included.
  • Golem: AI Web Browser is available now as a v0.1.4 prerelease for Windows, Linux and macOS, with its own coding agent and browser automation.

For a wider view of how these pieces fit together, see our overview of vibe coding tools and a starter setup, or browse all Software and Utilities.

Quick checklist for using Opus 4.6 in Claude Code

  1. Decide whether you truly need Opus 4.6 or just “the best Opus.”
  2. Pin claude-opus-4-6 (or your provider’s equivalent ID) with /model, --model, ANTHROPIC_MODEL or settings.json.
  3. Override ANTHROPIC_DEFAULT_OPUS_MODEL if you want the opus alias to keep meaning 4.6.
  4. Confirm with /status every time you change something.
  5. Use Opus for planning and hard problems, a cheaper model for routine edits, and clear or compact long sessions.

Frequently asked questions

How do I change Claude Code to use Opus?

Type /model inside a Claude Code session and choose an Opus option, or start Claude Code with claude --model opus. The opus alias follows whatever Anthropic currently treats as its default Opus model. If you need a specific version such as Opus 4.6, use the full model ID claude-opus-4-6 instead, either with --model or in the model key of your settings.json file.

Where do I use Claude Code?

Claude Code runs mainly in a terminal, inside the folder of the project you want to work on. You start it with the claude command and type tasks in plain English. It can also be used through editor integrations such as VS Code and a web version. Wherever you run it, the model settings described here still apply, because they live in Claude Code's own configuration.

Should I always use Opus in Claude Code?

No. Opus models are the most capable in the Claude family, but they cost more per token and use up subscription limits faster. They pay off on planning, large refactors and hard debugging. Routine edits, test fixes and small scripts usually go fine on Sonnet. Many people use Opus for planning and a cheaper model for execution, which the opusplan setting is designed for.

Is there an Opus 5 for Claude Code?

Yes, newer Opus models have been released since Opus 4.6, including 5-series versions during 2026. That is why the plain opus alias may no longer give you Opus 4.6. Run /model or /status in Claude Code to see what your current setup resolves to, and pin claude-opus-4-6 by full ID only if you have a reason to stay on that version.

Can I use Opus 4.6 in Claude Code for free?

Not really. Claude Code needs either a paid Claude subscription or API credits billed per token, and Opus access depends on your plan. You can keep costs down by using Opus only for the hardest steps, clearing long sessions with /clear, and checking usage with the /cost command when you pay through the API. Free trial credits, when offered, run out quickly on Opus.