AI编码
dev.to ·
@xiun xiao
编码 Agent 选 Claude Opus 5.5 还是 Sonnet 5.5:Opus 值不值?
作者在 2026-10-20 用 Claude Code 非交互模式,在六个小型 Python 仓库任务上对比 Claude Opus 5.5 与 Sonnet 5.5,仅切换 --model,并用 Agent 未见的测试评分。结果显示两者每次运行均通过全部隐藏测试,Opus 更慢,单任务成本约为 Sonnet 的 2.5 倍。样本规模小,价格取自第三方平台。
AI推荐理由 用 Claude Code 在六个小型 Python 任务上对比 Opus 5.5 与 Sonnet 5.5,以 Agent 未见过的隐藏测试评分,结论是两者全部通过、Opus 更慢且单任务成本约为 2.5 倍。方法可复现,但样本仅六个小任务,且价格来自第三方平台,结论外推需谨慎。
66
正文
Originally published on the QuickSilver Pro blog.
Claude Opus 5.5 costs $1.00 / $5.00 per million tokens on QuickSilver Pro, against $0.50 / $2.50 for Claude Sonnet 5.5. The question for anyone running a coding agent is whether Opus buys anything for that.
We tested it on 2026-10-20 with Claude Code, on six small but real coding tasks, and graded every run with tests the agent never saw. Short answer: on these tasks, no. Both models passed every hidden test in every run. Opus was slower and, per task, cost about two and a half times as much.
How we tested
Agent: Claude Code 2.1.301, non-interactive (claude -p), default settings, with --allowedTools "Read,Edit,Write,Bash,Glob,Grep" so it could read and edit files and run shell commands. The only thing that changed between runs was --model claude-sonnet-5-5 or --model claude-opus-5-5. ANTHROPIC_DEFAULT_HAIKU_MODEL was set to claude-haiku-5-5.
Tasks: six throwaway Python repositories, each with a one-paragraph prompt, a spec or bug report in the repo, and one visible test. Every task had a separate hidden test suite that we ran after the agent finished. Five suites were written by us before any run and checked against our own reference solutions; the sixth is the official Mustache spec suite.
Runs: each task twice per model, same inputs, 24 runs in total.
Graded on: the share of hidden tests passing. Also recorded: wall-clock time, number of API requests, input / cached / output tokens, and cost.
Cost: computed from the token counts of every request each run made, at QuickSilver Pro prices on 2026-10-20 — input, output, cache reads and cache writes each at their own rate.
The tasks:
Two-file bug fix. A shop module whose totals were off by a cent and whose discount was applied twice. The fix needed changes in both files plus a rule from the README that the bug report did not mention (a minimum order for one code). 17 hidden tests.
Implement from a spec. A duration parser ("1h30m", "2 hours and 5 min", "PT1H30M") with a page of rules on separators, unit order and what must be rejected. 57 hidden tests.
Refactor without changing behaviour. Split a long function full of duplicated code into helpers. The hidden tests compared the new output with the original on 300 random inputs and a set of edge cases, and checked that the function actually got shorter. 312 hidden tests.
Add input validation. A sign-up function with a written rule set: per-field error codes, rule order, and fields that interact (a password must not contain the username, but only if the username is valid). 52 hidden tests.
Parser for a config format. Sections, quoted values with escapes, inline comments, line continuation with correct error line numbers, and ${section.key} references with cycle detection. 34 hidden tests.
A Mustache template renderer from scratch, graded against the official Mustache spec test suite: interpolation, sections, inverted sections, comments, partials and delimiter changes. 136 hidden tests.
Results
Averages over two runs per model and task. Cost is per run, at QuickSilver Pro prices on 2026-10-20.
Task
Sonnet 5.5: tests passed
Sonnet 5.5: time
Sonnet 5.5: cost
Opus 5.5: tests passed
Opus 5.5: time
Opus 5.5: cost
1. Two-file bug fix
17/17, both runs
21 s
$0.048
17/17, both runs
37 s
$0.120
2. Duration parser
57/57, both runs
46 s
$0.093
57/57, both runs
62 s
$0.121
3. Refactor
312/312, both runs
30 s
$0.052
312/312, both runs
81 s
$0.156
4. Input validation
52/52, both runs
33 s
$0.056
52/52, both runs
36 s
$0.088
5. Config parser
34/34, both runs
55 s
$0.075
34/34, both runs
77 s
$0.127
6. Mustache renderer
136/136, both runs
82 s
$0.093
136/136, both runs
137 s
$0.438
Average
all passed
45 s
$0.069
all passed
72 s
$0.175
Where the tokens went, averaged over all 12 runs per model:
Per run
Sonnet 5.5
Opus 5.5
Requests to the chosen model
5.8
6.0
Input tokens to the chosen model
141,000
148,000
...of which read from the prompt cache
111,000
110,000
Output tokens
5,200
5,800
Cost of the chosen model's requests
$0.034
$0.074
Safety-check requests (see below)
1.4
4.0
Cost of the safety checks
$0.036
$0.101
Total cost per task
$0.069
$0.175
What the numbers say
Quality was a tie. Neither model failed a single hidden test in 24 runs, including the 136 cases of the official Mustache suite, which include the fiddly rules for whitespace around standalone tags and indented partials. These tasks did not find a ceiling for Sonnet 5.5, so they cannot show Opus clearing it.
Opus did not write much more. The two models used about the same number of requests and output tokens per task. The model-only cost difference (2.2 times) comes almost entirely from Opus's higher per-token price.
Opus checked its own work more, and that is where its extra time and cost went. It ran more shell commands. On the refactor, both Opus runs wrote a throwaway script that compared the old and new function on random inputs; one of the two Sonnet runs did the same, the other relied on the existing test. On the Mustache task, both Opus runs downloaded the official spec test files from GitHub and ran them before finishing — one of them started a sub-agent to do it — which made that task four times as expensive as with Sonnet. (Our hidden tests for that task are the same files, so Opus's score there is not independent. Sonnet passed all 136 without them.)
Opus was slower in every task, from about the same speed on the validation task to 2.7 times as long on the refactor. Averaged over all runs it took 1.6 times as long.
The extra requests you are billed for
Every run also sent requests to Claude Sonnet 5, a model we never selected. We logged one of them: it is Claude Code's own safety check, a "security monitor" prompt that receives the conversation so far and grades the shell command the agent is about to run. Each check sent about 49,000 input tokens and returned a few tokens of output.
Three things about these checks matter for your bill:
They do not appear in Claude Code's own usage summary, which in our runs listed only the model we picked. They are ordinary API requests made with your key, so they are billed like any other.
In our runs they cost about as much as the Sonnet 5.5 work itself ($0.036 against $0.034 per task).
They scale with how many shell commands the agent runs, not with the model you chose. Opus ran more commands, so it triggered almost three times as many checks; the two Opus Mustache runs, which downloaded files from GitHub, sent 9 and 15.
When Opus earns its price, and when Sonnet is enough
Sonnet 5.5 is enough for the kind of work we measured: bug fixes across a couple of files, implementing a function from a written spec, behaviour-preserving refactors, validation rules, parsers of a few hundred lines. It solved all of them, every time, at about 40% of Opus's cost per task and in less time.
Opus 5.5 is worth trying when Sonnet fails a task — and, judging by these runs, when you want the agent to go out of its way to verify its work, as it did by fuzz-testing its refactors and fetching the reference test suite. We did not find a task in this set that Sonnet failed, so we cannot tell you how much more Opus solves on harder work. Treat that as a reason to keep Opus one /model opus away, not to run it by default.
A practical setup: map Claude Code's sonnet alias to claude-sonnet-5-5 and its opus alias to claude-opus-5-5 (see Claude Code with QuickSilver Pro), work in Sonnet, and switch with /model opus for the task where Sonnet keeps going round in circles.
Limits of this test
Six tasks, two runs per model. Small, self-contained Python tasks of 20 seconds to 2.5 minutes each, not a multi-hour change in a large codebase.
Five of the six hidden test suites were written by us, so they reflect our reading of each spec. We checked each against a reference solution before running the agents.
Wall time includes network and server time, and two runs of the same model on the same task differed by as much as 55%. Read the time column as a rough guide.
Claude Code ran with its default settings, including the default effort level for each model.
Run it yourself
The settings we used, pointed at the public endpoint:
export ANTHROPIC_BASE_URL=https://api.quicksilverpro.io
export ANTHROPIC_AUTH_TOKEN=YOUR_QSP_KEY
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-5-5
claude -p "Fix the failing test in tests/" --model claude-sonnet-5-5 --allowedTools "Read,Edit,Write,Bash,Glob,Grep"
claude -p "Fix the failing test in tests/" --model claude-opus-5-5 --allowedTools "Read,Edit,Write,Bash,Glob,Grep"
Enter fullscreen mode
Exit fullscreen mode
Each request shows up in your QuickSilver Pro dashboard with its model, token counts and cost, so you can compare the two models on your own tasks. Prices for every Claude model are in Claude API pricing in 2026.