← Back to blog
Claude Sonnet 5 vs Gemini 3.1 Pro: Price, Context and Coding

Claude Sonnet 5 vs Gemini 3.1 Pro: Price, Context and Coding

Julian Brooks

By Julian Brooks

MyClaw Editorial

MyClaw

Run Best-in-Class AI Agents Now

Run OpenClaw or Hermes Agent on managed MyClaw hosting, so your AI agent stays online, updated, and ready for real work.

Start Hosting

AI Takeaway

  • Which model codes better? Claude Sonnet 5 posts the higher vendor-reported coding scores, including 85.2% on SWE-bench Verified against 80.6% for Gemini 3.1 Pro. The two sets of results were published four months apart under different test setups, so read the gap as a hint, not a verdict.
  • Which one costs less to run? Each lists $2 for every million input tokens on standard prompts. Output is $10 per million on Sonnet 5 and $12 on Gemini 3.1 Pro, and Gemini's rates rise to $4 and $18 once a prompt passes 200K tokens (vendor-stated, October 22, 2026).
  • How do context and output compare? Each takes in close to a million tokens. Sonnet 5 can write up to 128K tokens in one reply, twice the 65,536-token output cap on Gemini 3.1 Pro.
  • Are these models still current? Anthropic now lists Sonnet 5 as an active legacy model with retirement no sooner than June 30, 2027, while Google still labels Gemini 3.1 Pro a public preview. Sonnet 5.5 and Gemini 4 are the newer options in each family.
  • Can MyClaw run this matchup for me? Yes. Both Claude Sonnet 5 and Gemini 3.1 Pro run on MyClaw, so one task can go to each for a direct comparison; the steps sit right before the Conclusion.

Spec Sheet: Claude Sonnet 5 Next to Gemini 3.1 Pro

Claude Sonnet 5 vs Gemini 3.1 Pro pits two models against each other that many teams still run in production despite newer releases. Here is how the official specs line up.

SpecClaude Sonnet 5Gemini 3.1 Pro
Model ID for the APIclaude-sonnet-5gemini-3.1-pro-preview
ReleaseJune 30, 2026February 19, 2026
StatusActive (legacy)Public preview
Input token limit1M1,048,576
Largest single reply128K65,536
Accepted inputsImages plus textPDF, audio, video, images, text
ThinkingAdaptive, default effort highSupported
Knowledge cutoffJanuary 2026January 2025
Standard rate, 1M tokens$2 in / $10 out$2 in / $12 out (up to 200K)

Sources: Anthropic and Google developer documentation, vendor-stated, read October 22, 2026.

Two rows stand out. Sonnet 5's knowledge cutoff is a full year later, which matters when prompts touch recent libraries or events and you are not supplying documents. Gemini 3.1 Pro has a broader input list and is also offered in a custom-tools variant, gemini-3.1-pro-preview-customtools. For a full single-model look at Anthropic's side, see our Claude Sonnet 5 review.

Claude Sonnet 5.5 Review: Benchmarks, Pricing & vs Opus 5.5 | MyClaw.ai

Pricing and What a Long Prompt Really Costs

List Prices From Each Vendor

Price item (per 1M tokens)Claude Sonnet 5Gemini 3.1 Pro
Input$2$2 up to 200K, $4 above
Output$10$12 up to 200K, $18 above
Cache read$0.20$0.20 up to 200K, $0.40 above, plus storage
Discount tierBatch API, 50% offBatch or Flex, $1 in / $6 out up to 200K
Premium tierNone listedPriority, $3.60 in / $21.60 out up to 200K

Sources: Anthropic and Google pricing pages, vendor-stated, read October 22, 2026 (Google's page last updated October 19, 2026).

Anthropic launched Sonnet 5 at $2 and $10 as an introductory rate and had planned a move to $3 and $15 on September 1, 2026. Its pricing page now says that increase will not happen and that $2 and $10 is the standard price. Gemini's output figure includes thinking tokens, so long reasoning runs add to the bill on that side.

Our Own Arithmetic on Two Workloads

To show where the tiers bite, we priced two single requests at standard list rates (our own arithmetic, no caching or discounts):

  • 150K input and 20K output: about $0.50 on Sonnet 5 and $0.54 on Gemini 3.1 Pro. Under the 200K threshold the two sit close together.
  • 500K input and 20K output: about $1.20 on Sonnet 5 and $2.36 on Gemini 3.1 Pro, because Gemini's higher long-prompt rates apply to the whole request.

Gemini 3.1 Pro: Announcing our latest Gemini AI model

The takeaway: if your agent routinely loads whole repositories or large document sets, Sonnet 5's flat pricing is easier to budget. On short and mid-size prompts, quality matters more than price. Our Gemini 3.1 Pro vs 3.5 Flash comparison covers lower-cost options inside Google's lineup.

Coding and Agent Benchmarks

Each vendor published its own numbers at launch. They are shown in separate tables because the dates, test versions and setups differ.

Anthropic-Reported Scores for Claude Sonnet 5

BenchmarkClaude Sonnet 5
SWE-bench Verified85.2%
SWE-bench Pro63.2%
Terminal-Bench 2.180.4%
OSWorld-Verified81.2%
BrowseComp84.7%

Source: Anthropic, vendor-reported, June 30, 2026.

Google-Reported Scores for Gemini 3.1 Pro

BenchmarkGemini 3.1 Pro
SWE-Bench Verified80.6%
SWE-Bench Pro (Public)54.2%
Terminal-Bench 2.068.5%
ARC-AGI-277.1%
GPQA Diamond94.3%
BrowseComp85.9%
MCP Atlas69.2%

Source: Google DeepMind model card, vendor-reported, February 2026.

Read these with care. The Terminal-Bench rows use different versions, so they are not comparable. On the two SWE-bench tests and BrowseComp, the labels match, but each lab ran its own harness at a different time. What the tables do suggest is a pattern: Anthropic leans on coding and computer-use results, while Google highlights reasoning, science and tool-workflow scores. Anthropic's next release moved these numbers again, as our look at the jump to Sonnet 5.5 shows.

I tested Claude 4.5 vs Gemini 2.5 Pro with 9 tough prompts — and there's a  clear winner | Tom's Guide

Context, Output and Multimodal Input

Both models take about one million tokens, so the bigger practical differences are output length and input types.

  • Output length: Sonnet 5's 128K cap leaves room for long patches, migration plans or full reports in one pass, and Anthropic lists up to 300K output on its Batch API with a beta header (vendor-stated). With Gemini 3.1 Pro's 65,536-token ceiling, very long deliverables may need to be split across turns.
  • Input types: Gemini 3.1 Pro reads recordings, clips and PDFs natively, and Google documents grounding with Google Search and Maps. Sonnet 5 handles text and images, with up to 600 images or PDF pages in one request (vendor-stated).
  • Thinking controls: Sonnet 5 uses adaptive thinking with a configurable effort level, while Gemini 3.1 Pro supports thinking with output tokens billed at the standard rate.

If you are weighing Gemini 3.1 Pro against its successor for these capabilities, our guide to what Gemini 4 changed walks through the differences.

Strengths and Trade-offs at a Glance

Claude Sonnet 5Gemini 3.1 Pro
StrengthsHigher vendor-reported coding scores
128K output per reply
Flat pricing at any prompt size
Native video, audio and PDF input
Search grounding built in
Batch and Flex tiers halve standard rates
Trade-offsNow a legacy model
No native audio or video input
No sampling controls such as temperature
Still in preview
Rates rise above 200K tokens
Older January 2025 knowledge cutoff

Both columns draw on the vendor documentation cited above, read October 22, 2026.

Skip the Setup, Run Best-in-Class AI Agents Now

Launch a managed OpenClaw or Hermes Agent workspace in minutes, with always-on hosting, updates, and support handled by MyClaw.

Get Started

Picking Between Sonnet 5 and Gemini 3.1 Pro

Choose Claude Sonnet 5 when:

  • Your agent writes and fixes code across a repository and needs long, complete outputs.
  • Prompts often exceed 200K tokens and you want predictable costs.
  • You need recent knowledge without supplying extra documents.

Choose Gemini 3.1 Pro when:

  • Your inputs include recordings, video or long PDFs.
  • Research tasks benefit from search grounding.
  • You can route work through Batch or Flex and accept slower turnaround for a lower bill.

For new projects, it is worth checking the newer generation as well. Anthropic points Sonnet 5 users to Sonnet 5.5, and Google's Gemini 4 is the step up from Gemini 3.1 Pro. Either may change the picture for your workload, so run your own prompts before you commit. If you stay on the older pair, pin the exact model IDs in your code so a silent alias change does not shift results mid-project, and keep a small set of saved test prompts to re-run whenever either vendor updates its documentation or pricing.

Run Claude Sonnet 5 and Gemini 3.1 Pro on One Task in MyClaw

Published scores can only tell you so much. A quicker way to settle this matchup is handing one real job to each model, and MyClaw makes that simple. It keeps a hosted agent running for you, with OpenClaw or Hermes at its core, and this setup works with most popular models, Claude Sonnet 5 and Gemini 3.1 Pro among them. New to the agent side? Our OpenClaw guide and Hermes agent overview explain how it works.

Get Started
  1. Open your MyClaw agent and pick one real task, such as a bug fix, a report or a document review.
  2. Run it on Claude Sonnet 5 (claude-sonnet-5) and save the result.
  3. Switch to Gemini 3.1 Pro (gemini-3.1-pro-preview), send it the identical request and put both outputs next to each other.

Conclusion

In short, Claude Sonnet 5 and Gemini 3.1 Pro share a $2 input price and similar context windows, but they pull apart quickly. Sonnet 5 offers stronger vendor-reported coding numbers, twice the output length and flat pricing on huge prompts. Gemini 3.1 Pro brings native recording, clip and PDF input, search grounding and a discounted Flex tier. Pick by workload, and test your own prompts on both before deciding.

Skip the Setup, Run Best-in-Class AI Agents Now

Launch a managed OpenClaw or Hermes Agent workspace in minutes, with always-on hosting, updates, and support handled by MyClaw.

Get Started
Claude Sonnet 5 vs Gemini 3.1 Pro: Price, Context and Coding | MyClaw.ai