Claude Sonnet 5 vs Gemini 3.1 Pro Preview
Both are 2026 frontier models priced almost identically on input tokens ($2.00/M provider price, each) but diverge sharply on output cost, modality support, and agentic benchmark scores. Sonnet 5 is the newer release (June 2026 vs February 2026) and leans into reasoning-effort control with five levels; Gemini 3.1 Pro Preview mandates reasoning and adds native audio/video input. The gap that matters most for most buyers: Sonnet 5's agentic index is more than double Gemini's.
Spec vs spec
| Spec | Claude Sonnet 5 | Gemini 3.1 Pro Preview |
|---|---|---|
| Context window | 1M | 1.0M |
| Max output | 128K | 66K |
| Input modalities | text, image, file | audio, file, image, text, video |
| Output modalities | text | text |
| Released | Jun 30, 2026 | Feb 19, 2026 |
| Reasoning | optional | always on |
Pricing
Per 1M tokens. Provider price plus the flat 3% fee — the sum is what you pay.
anthropic/claude-sonnet-5
Input · 1M tokens
$2.00 + 3%$2.06
Output · 1M tokens
$10.00 + 3%$10.30
Cache read · 1M tokens
$0.200 + 3%$0.206
Cache write · 1M tokens
$2.50 + 3%$2.58
FEE — FLAT, EVERY MODEL3%
google/gemini-3.1-pro-preview
Input · 1M tokens
$2.00 + 3%$2.06
Output · 1M tokens
$12.00 + 3%$12.36
Cache read · 1M tokens
$0.200 + 3%$0.206
Cache write · 1M tokens
$0.375 + 3%$0.386
FEE — FLAT, EVERY MODEL3%
One workload, priced on both
10M input + 2M output tokens at each model's price, flat 3% fee included.
anthropic/claude-sonnet-5Cheaper
$41.20
$40.00 provider + 3%
google/gemini-3.1-pro-preview
$45.32
$44.00 provider + 3%
Pricing math on a real workload
Provider list price is nearly a tie on input: $2.00/M for both. Output is where they split — Sonnet 5 is $10.00/M, Gemini 3.1 Pro Preview is $12.00/M. On OpenKey (provider price × 1.03 flat fee), that's Sonnet 5 at $2.06/M in, $10.30/M out, and Gemini at $2.06/M in, $12.36/M out.
Run the numbers on a 10M-input / 2M-output workload: Sonnet 5 costs $40.00, Gemini 3.1 Pro Preview costs $44.00. That's a $4 gap per run, and it scales linearly — at 100 runs a month you're looking at $400 saved by defaulting to Sonnet 5, assuming similar token counts. Cache pricing differs too: Sonnet 5's cache write is $2.50/M vs Gemini's $0.375/M, so if your workload leans on cached context reuse, Gemini's cache economics flip the picture.
Coding and agent benchmarks
On Artificial Analysis benchmarks, Sonnet 5 leads across the board: intelligence index 53.4 vs 46.5, coding index 71.5 vs 68.8, and agentic index 46.7 vs 21.4 — more than double Gemini's score. That agentic gap is the one to weigh heavily if you're building tool-calling loops, multi-step agents, or autonomous coding workflows.
Gemini has its own benchmark trail from Design Arena, scoring well on specific categories like SVG generation (rank 2, 70.3% win rate) and ASCII art (rank 4, 63.4% win rate), plus solid results on HTML slides (rank 5-6). But on general fullstack and web app agent tasks it ranks mid-pack (13-16), and on Android-native or mobile app agent work it drops to rank 22-25. Sonnet 5 has no Design Arena entries in this dataset, so direct category-by-category comparison there isn't possible — lean on the Artificial Analysis numbers instead.
Context window and output limits
Gemini 3.1 Pro Preview edges out on context length: 1,048,576 tokens vs Sonnet 5's 1,000,000 — a 0.95 ratio, meaning the practical difference is under 5% and won't change your architecture decisions. Max output tokens is where the real gap sits: Sonnet 5 allows 128,000 tokens per completion, double Gemini's 65,536. If your task generates long structured output — full codebases, long-form reports — Sonnet 5's ceiling gives you more headroom before you need to chain requests.
Modality differences
Sonnet 5 accepts text, image, and file input. Gemini 3.1 Pro Preview accepts all of that plus audio and video, output for both is text-only. If your pipeline needs to process video frames or audio transcripts directly rather than pre-converting to text, Gemini is the only one of the two that can ingest it natively. For pure text/code/image workloads, the modality difference doesn't matter — the decision comes down to price and benchmarks instead.
Reasoning control
Sonnet 5 gives you five reasoning-effort levels (low, medium, high, xhigh, max) and reasoning is optional — you can turn it off entirely. Gemini 3.1 Pro Preview supports three levels (low, medium, high) and reasoning is mandatory, you can't disable it. If you need fine-grained control over latency-vs-quality tradeoffs, or want to skip reasoning for simple calls to save cost, Sonnet 5's flexibility matters. Both default to medium effort.
Which model for which job
| Use case | Pick | Why |
|---|---|---|
| Coding agents / autonomous dev tools | Claude Sonnet 5 | Agentic index of 46.7 vs 21.4 — more than double |
| Video or audio content analysis | Gemini 3.1 Pro Preview | Only one of the two with native audio and video input |
| Long structured output generation | Claude Sonnet 5 | 128,000 max output tokens vs Gemini's 65,536 |
| High-volume output-heavy workloads on a budget | Claude Sonnet 5 | $40.00 vs $44.00 on a 10M-in/2M-out workload |
| Heavy cache-reuse pipelines | Gemini 3.1 Pro Preview | Cache write at $0.375/M vs Sonnet 5's $2.50/M |
| Fine-grained reasoning-effort tuning | Claude Sonnet 5 | Five effort levels including optional off, vs Gemini's mandatory three |
Questions
- Which is cheaper for a typical workload?
- Claude Sonnet 5, by a small but consistent margin. On a 10M-input/2M-output workload it costs $40.00 versus $44.00 for Gemini 3.1 Pro Preview — a $4 gap driven entirely by output pricing ($10.30/M vs $12.36/M on OpenKey after the 3% fee).
- Which model is better for coding?
- Claude Sonnet 5. Its Artificial Analysis coding index is 71.5 versus Gemini 3.1 Pro Preview's 68.8, and the agentic index gap is much wider: 46.7 versus 21.4. For agent-driven coding tasks specifically, Sonnet 5 is the clear pick.
- Does either model support audio or video input?
- Only Gemini 3.1 Pro Preview. It accepts text, image, file, audio, and video input. Claude Sonnet 5 is limited to text, image, and file — no audio or video support.
- How do context windows compare?
- Nearly identical. Gemini 3.1 Pro Preview has 1,048,576 tokens of context, Claude Sonnet 5 has 1,000,000 — a ratio of 0.95, so under 5% difference. Max output tokens differ more: Sonnet 5 allows 128,000, Gemini caps at 65,536.