All insights

Coding agents

How to Use Opus 4.8 in Claude Code

Select Claude Opus 4.8 by its full model name in Claude Code, confirm the active model, and verify coding changes. Includes the version prerequisite and a separate Python API example.

Illustration for How to use opus 4.8 in claude code

Quick answer: In Claude Code, select Opus 4.8 with /model claude-opus-4-8, or start a session with claude --model claude-opus-4-8. Check the model shown above the prompt to confirm what is active. This model name is for the Anthropic route; other providers may require their own model or deployment identifier. Opus 4.8 requires Claude Code v2.1.154 or later. [1][2]

As of November 9, 2026, Anthropic’s model reference labels Opus 4.8 a legacy model but says it is still available. The opus alias resolves to the newest Opus version on the Anthropic API, so use the full model name when you specifically want 4.8. [3]

Select Opus 4.8 and confirm it is active

  1. In a terminal, check your installed Claude Code version:

    claude --version
    

    Opus 4.8 support requires v2.1.154 or later. If your version is older, update Claude Code using the instructions for your installation method in Anthropic’s setup guide, then check the version again. Native installations update automatically in the background; the update takes effect after you restart Claude Code. [1][4]

  2. Open the repository you want to work in and start Claude Code with claude. At the prompt, enter:

    /model claude-opus-4-8
    

    Select Opus 4.8 if the model picker appears. You can instead start a session with the model specified:

    claude --model claude-opus-4-8
    

    These are the documented selection forms for Claude Code using the Anthropic route. [1][2]

  3. Look at the model label above the prompt. Claude Code’s quickstart says it displays the current model there. [5]

If Opus 4.8 is not listed or the request is rejected, first confirm that your version meets the minimum and that you are using the intended account and provider. The exact model name can vary by provider; an API model ID by itself does not establish that a third-party provider or deployment supports it. [1][3]

Use it for a coding task—and verify the result

Opus 4.8 is one option to try for complex, multi-step repository work, such as a migration, a difficult bug, or a refactor spanning several files. That is task-selection guidance, not a promise that the model will get the change right. A simpler model may be enough for a small edit or quick explanation.

Give Claude Code a bounded request: describe the desired outcome, constraints, and how you will judge success. For example:

Update the date parser to accept ISO-8601 timestamps with timezone offsets. Keep the existing public function signature and avoid unrelated changes. First outline the files you expect to change. Then implement the change, run the relevant tests, and summarize the diff and any remaining edge cases. Do not claim a test passed unless you ran it.

Before accepting the work:

  1. Review the plan and correct misunderstandings before implementation proceeds.
  2. Inspect the diff. In Claude Code, /diff shows changes made during the session. [6]
  3. Run the project’s relevant tests or checks using the commands appropriate to that repository; there is no single test command for every project.
  4. Review failures and edge cases. A confident summary is not proof that the code is correct.

Claude Code or the production API?

Use Claude Code for interactive work in a repository. Use the Claude API when an application or service needs to send model requests programmatically. They are separate access routes: claude-opus-4-8 is the API model ID, and API token pricing is not Claude Code plan pricing. Anthropic’s current model reference says Opus 4.8 is still available. [3][7]

The Messages API endpoint is POST /v1/messages. Here is a minimal Python example using Anthropic’s SDK and API-key environment variable; it prints the text blocks returned by the API. [8][9]

pip install anthropic
export ANTHROPIC_API_KEY="your-api-key"
import os
from anthropic import Anthropic

client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))
message = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=512,
    messages=[
        {"role": "user", "content": "In one sentence, explain what a unit test checks."}
    ],
)

for block in message.content:
    if block.type == "text":
        print(block.text)

Anthropic’s model reference lists Opus 4.8 API pricing at $5 per million input tokens and $25 per million output tokens (USD). These are API token rates, not a quote for Claude Code plan billing. Check current pricing and your account’s access before building around the API. [3][10]

One important version distinction

The opus alias is not a fixed synonym for Opus 4.8: on the Anthropic API, aliases resolve to the newest version in that model family. Specify claude-opus-4-8 when you need that version. Anthropic now describes Opus 4.8 as a legacy model and identifies Opus 5.5 as the current Opus model; that status does not mean Opus 4.8 is unavailable. [3]

Sources

Claude Code: Week 22, May 25–29, 2026

Claude Code model configuration

Claude Opus 4.8 model reference

Claude Code advanced setup

Claude Code quickstart

Claude Code commands

Claude SDKs, CLI, and libraries

Create a Message — Claude API Reference

Anthropic Python SDK

Claude API pricing

Contact us