Articles / Viewpoints and methods
10 minUsing AI Tools

Claude Opus vs Sonnet: Same Task, Two Runs in Claude Code

Claude Opus vs Sonnet: we ran the same Chinese rewrite and Python task on both in Claude Code, with verbatim outputs, plus plan access, Fable billing and which to pick.

Aaron HuangSenior Brand Manager

Reviewed by Aaron Huang · 2026-11-26

Anthropic positions Claude Opus for long-running agentic coding and knowledge work, and Sonnet as the best combination of speed and intelligence. On the API, Sonnet costs half as much (Opus 5.5: $4 input / $20 output per million tokens; Sonnet 5.5: $2 / $10). We gave both the same two prompts in Claude Code, a Chinese rewrite and a small Python function. Both finished both tasks. Sonnet was 0.9 s and 2.2 s faster; Opus wrote the tighter rewrite and its code rejected one edge case Sonnet's accepted (full-width digits). For everyday edits and small functions, Sonnet is enough. Switch to Opus for long autonomous coding sessions or when edge cases matter.

How we did it: on 2026-11-26, in the Claude Code desktop app, we started subagents with the model option set to opus and to sonnet, ran each prompt once per model with no tools, then ran the Python outputs locally. That is one sample per task, not a benchmark. Model positioning, prices and plan rules come from Anthropic's docs, pricing page and help center, as of 2026-11-26.

How Anthropic describes Opus, Sonnet, Haiku and Fable

From the official models overview and pricing page (checked 2026-11-26).

Item Fable 5.2 Opus 5.5 Sonnet 5.5 Haiku 5.5
Official positioning Demanding reasoning, long-horizon agentic work Long-running agentic coding and knowledge work Best combination of speed and intelligence High-volume, latency-sensitive classification, extraction, routing
Comparative latency Moderate Moderate Fast Fastest
API price (per MTok, input / output) $8 / $40 $4 / $20 $2 / $10 From $0.10 / $0.50
Context window / max output 1M / 128K tokens 1M / 128K tokens 1M / 128K tokens 1M / 128K tokens
Claude Code alias fable opus sonnet haiku
Free plan No No Yes Yes
Pro ($20/month) Usage credits (paid) Yes Yes Yes
Max ($100), Ultra ($200) Up to half of weekly limits Yes Yes Yes

The Claude Code model configuration docs say the default model on Pro, Max, Ultra, Team, Enterprise and the Anthropic API is Opus 5.5, and that the opus, sonnet and haiku aliases resolve to the newest version on the Anthropic API.

How we compared them: one prompt, one run each

The two prompts were written in Chinese. Task 1 asked for a rewrite of a stiff corporate paragraph into the way a Taiwanese engineer talks to a colleague, keeping every fact, adding nothing, in 150 characters or fewer. Task 2, translated from the Chinese original:

Write a Python function parse_duration(s: str) -> int that turns strings like "1h30m15s", "45m", "2h", "90s" into total seconds. Units are only h, m, s, in fixed h→m→s order, each at most once, at least one unit; on bad input (empty string, unknown unit, wrong order, repeated unit, missing number) raise ValueError. End with 5 assert tests (at least 2 testing bad input). Output a single Python code block, no explanation.

The official subagent docs say Claude can pass a model parameter (an alias such as sonnet, opus, haiku or fable) when it starts a subagent. The tool did not show which exact model version each subagent ran, so we only label results opus and sonnet. Times are what the tool reported when each subagent finished, including subagent start-up.

To switch models yourself in Claude Code (commands from the official docs):

/model sonnet
claude --model opus
# subagent definition frontmatter
model: sonnet

Claude Code also has an opusplan alias, which the docs describe as using Opus in plan mode and then switching to Sonnet for execution.

In the claude.ai web or desktop app, per the help center article on changing the model, the current model and effort level appear next to the send button; click the model name to pick another, and use "More models" for the rest. You can switch mid-conversation; the change applies from Claude's next response.

Task 1: the Chinese rewrite

Both outputs kept all four facts (AI is changing how we work, productivity went up, error rate went down, code review time fell 30% on average after three months) plus the "indispensable tool" conclusion, changed no numbers, added nothing new, and stayed under 150 characters. Opus came in at 109 characters, Sonnet at 121.

The difference was tone. Opus dropped the original's "in conclusion" entirely and ended with a casual "honestly, we can't write software without it now." Sonnet kept a shorter "in short" and added "basically," which softens the original's "indispensable." Both toned "greatly improved" down to "noticeably improved."

Task 2: the Python function

Both passed their own asserts when we ran them locally with Python 3.14 (both exited with code 0). The full code of both is in the image below. The core approach was almost identical: one regex, (?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?, with fullmatch, plus a check that at least one unit is present.

Redrawn from the verbatim outputs: parse_duration Python code from opus and sonnet side by side; both pass their own asserts, and full-width input 5m raises ValueError in the opus version but returns 300 in the sonnet version

We then tried inputs the prompt did not mention. 1H, 1h 30m and 1h were rejected by both. Full-width digits split them:

parse_duration("5m")
opus version   → ValueError
sonnet version → 300

Opus compiled its regex with re.ASCII, so \d only matches 0–9. Sonnet's \d matches Unicode digits, and int("5") happily returns 5. Full-width digits are common from Chinese and Japanese input methods. The prompt did not cover them, so Sonnet did not break a rule; Opus just went one step further.

The tests differed too:

  • Opus: 5 asserts, 2 of them on bad input: one all() over "", "10x", "h", "5m5m", and one on wrong order ("30s1h"), covering all five error types in the prompt. Its third assert adds "2h" and "90s" and compares the sum to 7290, which would miss two errors that cancel out.
  • Sonnet: also 5 asserts, with 4 separate valid-input checks (clearer than Opus), but only 1 assert for bad input, checking 6 values including "30" with no unit. Counted by assert statements, that misses the "at least 2 bad-input tests" requirement; counted by inputs, it has 6. Opus meets it either way.

Side-by-side results

Check opus sonnet
Rewrite: reported time 4.6 s 3.7 s
Rewrite: length 109 characters 121 characters
Rewrite: facts kept All four, numbers unchanged All four, numbers unchanged
Rewrite: tone Dropped "in conclusion", added "honestly" Kept "in short", added "basically"
Code: reported time 6.7 s 4.6 s
Code: own asserts 5, all pass 5, all pass
Code: bad-input asserts 2, covering all five error types 1, checking 6 values
Code: full-width "5m" Rejected (ValueError) Returns 300
How to choose When details and edge cases matter When speed matters and the task is simple; results were close

These are two small tasks with one run each. Run the same model again and the wording can change.

Which Claude model to pick

Your situation Pick Why
Editing emails or copy, summaries, small functions Sonnet Close to Opus on our two tasks, faster, half the API price
Letting Claude Code work through a project on its own, large refactors Opus Anthropic positions it for long-running agentic coding; it is Claude Code's default
Code that takes user input where edge cases matter Opus, or Sonnet with the edge cases spelled out in the prompt Only Opus rejected full-width digits in our run
High-volume classification, extraction, routing Haiku Fastest and cheapest per Anthropic
Hard problems Opus still fails at high effort Fable Anthropic suggests Fable when Opus at xhigh or max still falls short; Pro pays with usage credits
Free plan Sonnet or Haiku Free does not include Opus or Fable
How to choose Start with Sonnet; move to Opus when it gets stuck or the task is long and autonomous Both handle everyday work; the gap is in detail and speed

Anthropic's choosing a model guide also notes that tuning effort is often a better lever than switching models. In Claude Code, use /effort; Opus 5.5 and Sonnet 5.5 both default to medium there.

Can Pro use Opus, and how does Fable work?

Yes. Per the pricing page (checked 2026-11-26), Pro is $20/month and includes Opus, Sonnet and Haiku, with limits counted per 5 hours and per week; Max has 5x Pro usage.

Fable is different. Per the help center article Claude Fable models on your plan, on Pro and standard Team seats Fable runs on pay-as-you-go usage credits from the start, outside the plan's limits. Max and Ultra can spend up to 50% of weekly limits on Fable. The earlier promotion that included Fable 5 in weekly limits ended on July 19, 2026, and applied to Fable 5 only.

Common errors

Not logged in · Please run /login

Our first attempt used the CLI directly, claude -p --model opus "<prompt>", and got this line back; claude auth status showed "loggedIn": false. The standalone claude command on this machine was not logged in; being logged in to the Claude Code desktop app does not log in a separate command line. The message asks you to run /login in an interactive session. We did not; we switched models with the subagent model option inside the logged-in app instead.

Requires usage credits next to Fable in /model

The model configuration docs say that, depending on plan and seat, Fable can bill to usage credits instead of plan limits, and the /model picker then shows this label on the Fable row. On Pro this is expected: using Fable spends paid credits. Pick Opus or Sonnet to stay within your plan.

FAQ

What is the difference between Claude Opus and Sonnet?

Anthropic positions Opus for long-running agentic coding and knowledge work and Sonnet as the balance of speed and intelligence; Sonnet is listed as faster and costs half as much on the API. In our runs of the same two prompts, both completed the tasks; Opus was more careful with tone and edge cases, and Sonnet was 0.9 s and 2.2 s faster.

Can I use Claude Opus on the Pro plan?

Yes. The pricing page lists Opus, Sonnet and Haiku on Pro; the Free plan has Sonnet and Haiku only. Claude Code's default model on Pro is Opus 5.5.

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

Type /model sonnet or /model opus in a session, or start with claude --model opus; /model opusplan plans with Opus and executes with Sonnet. In the web app, click the model name next to the send button. A subagent definition can set model: sonnet so simple subtasks run on Sonnet while the main session stays on Opus. New to Claude Code? Start with the Claude Code tutorial: your first bug-fix task, and see how Claude distinguishes prompts, skills, tools and subagents.

Should I use Fable or Opus?

Anthropic recommends starting most work on Opus 5.5 and moving to Fable 5.2 only when Opus at xhigh or max effort still falls short on demanding reasoning or long-horizon agentic work. Fable's API price is double Opus's, and Pro users pay for it with usage credits.

How we wrote this

Sources: Anthropic's models overview, choosing-a-model guide, Claude Code model configuration and subagent docs, the claude.com pricing page, and the help center article on Fable plans, as of 2026-11-26. Team-tested: on 2026-11-26, in the Claude Code desktop app on Windows, subagents with model set to opus and sonnet, two prompts, one run each, no tools; times are as reported by the tool; Python outputs run locally on Python 3.14, plus extra inputs such as full-width digits. Not tested: the exact model version each subagent used (the tool did not show it), Haiku and Fable, long agentic tasks, and run-to-run consistency.