Comparison · Chat & code models
Claude Sonnet 5 vs Claude Opus 4.8
Claude Sonnet 5 or Opus 4.8? Anthropic puts Sonnet 5 close to Opus 4.8 at half the per-token price. Differences, API parameters and when to keep Opus.
Specs side by side
| Claude Sonnet 5 | Claude Opus 4.8 | |
|---|---|---|
| Vendor | Anthropic | Anthropic |
| Type | Chat & code | Chat & code |
| Released | 2026-06 | 2026-05 |
| Context window | 1,000,000 tokens | 1,000,000 tokens |
| Max output | 128,000 tokens | 128,000 tokens |
| Endpoints | /v1/chat/completions · /v1/messages | /v1/chat/completions · /v1/messages |
Price per token
| Claude Sonnet 5 | Claude Opus 4.8 | |
|---|---|---|
| Input / 1M tokens | $3.24 | $5.40 |
| Output / 1M tokens | $16.20 | $27.00 |
| Cached input / 1M | input rate | $0.675 |
| 1,000 replies (1,500 in + 400 out) | $11.34 | $18.90 |
Prices exclude taxes and are charged from your prepaid USD balance. Both models work through the same key, in the OpenAI-compatible /v1/chat/completions endpoint. Failed generations cost nothing.
For most tasks, use Claude Sonnet 5: it is newer, costs exactly half of Opus 4.8's rate, and Anthropic says its results are close to Opus 4.8. It also has the same 1M-token context and the same 128K-token replies. Keep Claude Opus 4.8 where your prompts, parsers and tests were built around its outputs, or where your own data shows it does better. Both work in Claude Code through Jantaris.
Key differences
- Price. Claude Sonnet 5 costs $3.24 / $16.20 per 1M tokens, Claude Opus 4.8 costs $5.40 / $27.00 per 1M tokens. Opus is 2 times more on both input and output.
- Cache. Opus 4.8 has a separate cached-input rate on Jantaris: 1/8 of its input rate, which is 1/4 of Sonnet 5's input rate. Sonnet 5 bills repeated context as regular input.
- Level. Anthropic calls Sonnet 5 its most agentic Sonnet: it plans, drives a browser and terminal, and works longer on its own. According to Anthropic, its results are close to Opus 4.8.
- Release. Opus 4.8 came out in May 2026 as the successor to Opus 4.7, Sonnet 5 in June 2026.
- Parameters. Sonnet 5 rejects non-default
temperature,top_pandtop_kwith a 400 error, and has adaptive thinking on by default. Opus 4.8 also uses adaptive thinking, with effort set to high by default, and rejects the old fixed thinking-token budget. - Tokenizer. Anthropic says Sonnet 5 has a new tokenizer that produces about 30% more tokens than Sonnet 4.6 from the same text. I have no such measurement for Opus 4.8, so compare the cost of whole requests, not just the rate.
- Shared. 1,000,000 tokens of context, replies up to 128K tokens, both endpoints:
/v1/chat/completionsand/v1/messages.
When to pick Claude Sonnet 5
- Your default model in Claude Code: tests, fixes, new features, code review.
- Debugging old, tangled code down to the root cause.
- Agents that call tools and APIs in a loop many times a day.
- Reports, emails and documentation written in bulk.
When to pick Claude Opus 4.8
- Production pipelines with prompts and tests tuned on Opus 4.8.
- Tasks where your own tests show a clear advantage for Opus.
- Conversations where you add
systemmessages later in the thread, which Anthropic allows on Opus 4.8. - Long sessions where the same large context comes back on every request and hits the cache.
- An A/B test before moving to a newer model such as Claude Opus 5.5.
Cost in practice
The per-token rate differs by exactly 2 times, but the per-request bill can differ by a different factor, because the models may split text into tokens differently and think for different lengths. In my tokenizer test (published in Polish on promptowy.com), Sonnet 5 needed about 56% more tokens than OpenAI models on the same Polish text. Opus 4.8 was not part of that measurement. The easiest check is your own: send a typical document to both models with max_tokens: 1 and compare the usage field.
The second exception is caching. When most of the input is a cache read, for example in a long agent session that sends the same repository on every step, input on Opus 4.8 can come out cheaper than on Sonnet 5. Output is still 2 times more on Opus. The usage panel shows your cache share. For short, varied requests, moving to Sonnet 5 usually halves the bill. In Claude Code I keep Sonnet as the default and switch to the newest Opus with /model for the hardest parts. Setup and per-token costs are in Claude Code cost on pay-per-token, and the newer Opus is compared in Claude Opus 5.5 vs Sonnet 5.
FAQ
Sonnet 5 or Opus 4.8: which one codes better?
Anthropic says Sonnet 5 is close to Opus 4.8, and both handle everyday work in Claude Code. I have no independent head-to-head test of this pair, so for a critical task run both on the same code.
How much more does Opus 4.8 cost than Sonnet 5?
Exactly 2 times on input and output: $5.40 / $27.00 per 1M tokens versus $3.24 / $16.20 per 1M tokens. The exception is cached input, which Opus 4.8 bills at a separate, lower rate.
Why do I get a 400 error after switching to Sonnet 5?
Usually because of temperature, top_p or top_k. Sonnet 5 rejects non-default values for these fields, so remove them from the request.
Do both work in Claude Code?
Yes, through the Anthropic-compatible /v1/messages endpoint. Set the Jantaris base URL and key as described in the Claude Code docs, then switch models with /model.
Is Opus 4.8 still worth using?
Yes, if your pipelines are tuned on it and working. Test newer models alongside it on the same data before you switch production.









