cocodot
← Back to guides
Local card declined for overseas AI? cocodot: one card + one key
Model ComparisonUpdated 2026-10

Claude Sonnet 5 vs Opus 5: Which Should You Use for Coding? (Cost per Finished Task)

Sonnet 5 or Opus 5 for coding? Blogs quote conflicting benchmarks and even conflicting prices. This guide sticks to Anthropic's own spec pages, then gives you a repeatable test and a cost-per-finished-task formula so your own repo decides.

TL;DR: Short answer: make Sonnet 5 your default for coding and escalate to Opus 5 only when a wrong answer costs more than the price gap. On Anthropic's own model pages, both models share the same 1M-token context window, 128K max output, adaptive thinking and a default effort of `high`; the differences are price (official list: Sonnet 5 at $2 / $10, Opus 5 at $5 / $25 per million input / output tokens) and knowledge cutoff (January 2026 for Sonnet 5, May 2026 for Opus 5). Both are now marked legacy — still available, with Sonnet 5.5 and Opus 5.5 as Anthropic's current versions — so check the model pages before you build on either. Ignore benchmark tables that disagree with each other: run ten real tasks from your own repo on both, count first-pass test results and follow-up turns, and divide total spend by tasks actually finished. Opus 5 usually earns its price on ambiguous, multi-file and long agentic work; on scoped edits, tests and explanations it mostly buys nothing. Both are callable on cocodot (mcs-6 and mco-7) through one key.

1. The decision rule in one sentence

Search for this comparison and you will find blogs quoting SWE-bench numbers that contradict each other, and at least one that quotes a different Sonnet 5 price from the one on Anthropic's own page. Rather than pick a side, use a rule that survives any benchmark: escalate to Opus 5 when the cost of a wrong answer is larger than the price difference for that task. A failed unit-test rewrite costs you a re-run; a refactor that silently breaks three services costs you an afternoon. A lot of day-to-day coding falls into the first bucket, which is why Sonnet 5 makes sense as the default. The rest of this guide is about measuring that rule on your own code instead of guessing.

2. What the official spec sheets actually say

Everything in this section comes from Anthropic's model pages at platform.claude.com, checked in October 2026; recheck them before relying on any number. Shared: 1M-token context window, 128K max output on the synchronous Messages API, adaptive thinking, default effort `high`, text and image input with text output, and up to 300K output tokens on the Message Batches API with a beta header. Different: list price ($2 / $10 for Sonnet 5 versus $5 / $25 for Opus 5 per million input / output tokens), reliable knowledge cutoff (January 2026 versus May 2026) and release date (June 30, 2026 versus July 24, 2026). Lifecycle: both pages now label the model legacy, with retirement not sooner than June 30, 2027 for Sonnet 5 and July 24, 2027 for Opus 5. The knowledge cutoff gap matters more than people expect: if your stack uses libraries released in early 2026, Opus 5 has simply seen more of them.

3. Price each finished task, not each token

Per-token price tells you nothing about what a working change costs. Use cost per finished task = total spend on a batch ÷ number of tasks that ended in an accepted change. A task that needed four rounds of corrections, or that you abandoned and fixed by hand, still spent tokens. Illustrative arithmetic: if Sonnet 5 spends $1.20 on ten tasks and finishes six, that is $0.20 per finished task; if Opus 5 spends $2.40 and finishes nine, that is about $0.27 — closer than the list price suggests, and possibly worth it if the three extra finishes were the hard ones. Two hidden variables move this number: output length (both models default to high effort, and thinking shows up in the usage figures, so compare usage.output_tokens with the text you actually see) and context growth in long sessions, where every turn resends history. For monthly budgeting, see /hub/llm-api-monthly-cost-estimate.

No overseas card needed: cocodot's OpenAI-compatible API — switch your base_url to call the models on sale.

Top up via Alipay / WeChat Pay, USDT / USDC · billed per token · switch your base_url to connect

4. A one-afternoon test on your own repo

Pick ten tasks you or your team actually did last month, in three groups: four scoped tasks (add a field, write tests for one module), three cross-file tasks (rename a concept used in several packages, change an interface and its callers) and three fuzzy tasks (a bug report with no reproduction steps). Run each task on both models with the same prompt, the same tool settings and a fresh session. Record four numbers per run: did the test suite pass on the first attempt, how many follow-up turns you needed, total tokens from the usage field, and files touched that should not have been. That last one is the clearest signal on cross-file work — a model that edits unrelated files costs you review time even when tests pass. Ten tasks is small, but it is your code, and it beats any leaderboard built on someone else's.

5. Where Opus 5 earns its price, and where it does not

From the test above, a common pattern is easy to predict. Worth escalating: requirements you cannot state precisely, refactors where five or more files must change consistently, long autonomous agent runs where an early wrong judgment corrupts every later step, and bugs Sonnet 5 has already failed twice. Usually wasted: completions, renames, CRUD endpoints, format conversions, unit tests for code that already exists, and explaining a function. A practical setup is to keep Sonnet 5 as the main model in your editor or agent and switch the model name for a specific task when you hit one of the first group. Because both run on the same key, that switch is a one-line change. If you are weighing Anthropic against OpenAI's flagship instead, see /hub/opus-5-vs-gpt-56-sol.

6. Migration gotchas before you switch

Three details from the official pages catch people out. First, sampling parameters: Anthropic's Sonnet 5 page states that setting temperature, top_p or top_k to non-default values returns a 400 error, so an older script or tool config that sets temperature will break when pointed at Sonnet 5 — remove those fields rather than guessing at values. Second, legacy status: Anthropic recommends migrating to Sonnet 5.5 and Opus 5.5; legacy models stay available until their retirement dates, but plan the move instead of discovering it from an error. Third, pin exact model IDs (claude-sonnet-5, claude-opus-5) in configuration rather than scattering them through code, so a later switch is one edit. If a renamed or retired ID starts returning a model-not-found error, the troubleshooting order is in /hub/api-model-not-found-fix; for overloaded responses during busy hours, see /hub/claude-api-529-overloaded.

7. Caching and long sessions: an honest note

Long coding sessions resend the same system prompt and file context on every turn, so prompt caching matters more than model choice for many teams. Officially, Anthropic lists cache reads at $0.20 per million tokens for Sonnet 5 and $0.50 for Opus 5, with 5-minute cache writes at $2.50 and $6.25 and 1-hour cache writes at $4 and $10 respectively; the Opus 5 page also notes a minimum cacheable prompt of 512 tokens. On cocodot, cache hits are billed at half the input price, and cache writes at 1.25x the input price (2x for the portion written to the 1-hour cache), the same structure as the official pricing. That means if your workload is dominated by cache hits, such as an agent rereading a large codebase all day, going direct to Anthropic is cheaper, and you should do that. Where a gateway helps is the output side, uncached input, and paying when your usual card is not accepted. When the context outgrows the window anyway, see /hub/context-length-exceeded-fix.

8. Calling both models through cocodot

cocodot exposes an OpenAI-compatible endpoint: set base_url to https://cocodot.co/api/ai/v1, send Authorization: Bearer with your key, and set model to mcs-6 (Claude Sonnet 5) or mco-7 (Claude Opus 5); the official names claude-sonnet-5 and claude-opus-5 map to the same models. For Claude Code, export ANTHROPIC_BASE_URL=https://cocodot.co/api/ai, set ANTHROPIC_AUTH_TOKEN to your cocodot key and ANTHROPIC_MODEL to mcs-6 or mco-7; the full setup is in /hub/claude-code. Whether other models, including the 5.5 versions, are available on cocodot and under which names is shown by the public model list at GET https://cocodot.co/api/ai/v1/models. Listed Claude / GPT / Gemini rates are at or below the official list price; check the pricing page for each model's current rate. Top-ups are by Alipay / WeChat Pay, USDT / USDC. The trial credit from email verification is usable after your first top-up, so add a small balance before testing either of these. If you want to confirm you are getting the model you asked for from any gateway, the checks are in /hub/ai-relay-model-downgrade-verify.

Side by side (official values from Anthropic's model pages, checked October 2026)

Claude Sonnet 5Claude Opus 5
Official list price (input / output per M tokens)$2 / $10$5 / $25
Context window / max output1M / 128K1M / 128K
Thinking / default effortAdaptive / highAdaptive / high
Reliable knowledge cutoffJanuary 2026May 2026
StatusLegacy (released June 30, 2026)Legacy (released July 24, 2026)
Best fitScoped features, tests, reproducible bugsAmbiguous specs, cross-file refactors, long agent runs
Model name on cocodotmcs-6 (or claude-sonnet-5)mco-7 (or claude-opus-5)

FAQ

Should I use Claude Sonnet 5 or Opus 5 for coding?

Default to Sonnet 5 for scoped work — features with clear requirements, tests, reproducible bugs, explanations. Escalate to Opus 5 for ambiguous requirements, multi-file refactors and long agent runs, where a wrong answer costs more than the price difference. Confirm with ten real tasks from your own repo.

Is Opus 5 worth it over Sonnet 5?

Only on tasks where it finishes noticeably more often. Officially Opus 5 lists at $5 / $25 versus $2 / $10 per million tokens, but the number that matters is cost per finished task: total spend divided by tasks that ended in an accepted change, including retries.

Why does Claude Sonnet 5 return a 400 error when I set temperature?

Anthropic's Sonnet 5 page states that non-default temperature, top_p or top_k values return a 400 error. Remove those parameters from your request or tool config and steer output with the prompt and the effort setting instead.

Are Sonnet 5 and Opus 5 being retired?

Both are labeled legacy on Anthropic's model pages, with retirement not sooner than June 30, 2027 (Sonnet 5) and July 24, 2027 (Opus 5). Anthropic suggests migrating to Sonnet 5.5 and Opus 5.5; check the deprecations page for current dates.

Can I use both models with one key on cocodot?

Yes. Both mcs-6 (Sonnet 5) and mco-7 (Opus 5) run on the same key and balance, so switching per task is a one-line model change. For other models, including the 5.5 versions, check the public model list.

About cocodot

cocodot is a payment and AI access service for developers and cross-border teams in mainland China. It provides US-BIN virtual cards issued by a licensed institution — used to pay for overseas subscriptions and ad accounts — and an OpenAI-compatible AI API gateway for calling Claude, GPT and Gemini from within mainland China. Both share one wallet, funded by Alipay / WeChat Pay, USDT / USDC and accounted in USD. Fees are listed on the pricing page.

Service scope, pricing and limits →
OpenAI-compatible API, pay in RMBGet API access