Gemini 3.1 Pro vs Claude Sonnet 4.6 API costs for developers

By TechCompare · Updated · How we check

Gemini 3.1 Pro is more economical on standard base and cached costs. Claude Sonnet 4.6 is preferred if you need Anthropic's coding and instruction-following strengths or its pricing fits your prompts above Gemini's 200,000-token tier boundary.

Google: Gemini 3.1 Pro Preview

Google AI Studio's own price

Input
$2
Output
$12
Cached
$0.20

per 1M tokens

Batch availableFlex available

Price checked 2026-12-02

A newer version is out: Gemini 4 Carbon

Anthropic: Claude Sonnet 4.6

Anthropic's own price

Input
$3
Output
$15
Cached
$0.30

per 1M tokens

Price checked 2026-12-02

A newer version is out: Claude Sonnet 5.5

Cost Comparison

Based on 100,000 input tokens (50% cached), 5,000 output tokens, and 100 requests.Prices come live from OpenRouter at each maker's own price where it's listed. Temporary deals are left out.

Loading model prices

For complex coding and agentic reasoning, Gemini 3.1 Pro and Claude Sonnet 4.6 are the top contenders. Their cost structures depend heavily on prompt caching efficiency.

Compare token rates for Claude Sonnet 4.6, a coding workhorse, and Gemini 3.1 Pro, a reasoning model.

Side-by-side specs

SpecGemini 3.1 Pro (<=200k)Claude Sonnet 4.6
Input Cost (per M)
$2.00 (better on this spec)
$3.00
Output Cost (per M)
$12.00 (better on this spec)
$15.00
Cached Input (per M)Cached input is text the provider has already processed. It costs less than fresh input.
$0.20 (better on this spec)
$0.30
Batch API input / output (per M)
$1.00 / $6.00
None

How they differ

For prompts up to 200,000 tokens, Gemini 3.1 Pro costs $2.00 per million input tokens and $12.00 per million output tokens, with a 90% cache discount to $0.20/M. Its rates rise to $4.00/M input, $18.00/M output, and $0.40/M cached input above 200,000. Claude Sonnet 4.6 is priced at $3.00 per million input tokens and $15.00 per million output tokens, with cached input at $0.30/M.

Verdict

For prompts up to 200,000, Gemini charges $2.00/M input and $12.00/M output against Sonnet's $3.00 and $15.00, so it wins both base rows by 33% on input and 20% on output. Gemini wins cached input at $0.20/M against Sonnet's $0.30/M. Both discounts are 90%. Sonnet's edges are its tool use and instruction following, and both models offer a 1M context window. Above 200,000, Gemini's standard rates rise to $4.00/M input and $18.00/M output, so check the long-context tier before choosing.

Which should you pick?

Choose Gemini 3.1 Pro (<=200k)

Long-context processing up to 1M tokens, native multimodal input, and lower costs for prompts up to 200,000 tokens.

Choose Claude Sonnet 4.6

State-of-the-art multi-file code editing, tool use, and agentic loops.

Frequently asked questions

Does Gemini 3.1 Pro or Claude Sonnet 4.6 cost less for long-context coding?
Prompt length decides. Up to 200,000 tokens, Gemini costs $2.00/M input and $12.00/M output against Sonnet's $3.00/M and $15.00/M. Gemini's rates rise to $4.00/M input and $18.00/M output above 200,000, so check the applicable long-context tier.
How do the context windows of Gemini 3.1 Pro and Claude Sonnet 4.6 compare?
Both offer about 1M tokens, so neither has an edge on size. For multi-file code analysis, RAG over large corpora, or whole-book synthesis, either one can hold the material with little chunking. Leave room for instructions and output rather than assuming a full 1M-token input fits unchanged.
How do the prompt caching discounts compare?
Both models apply a 90% discount to cached input. Gemini 3.1 Pro drops from $2.00/M to $0.20/M, while Claude Sonnet 4.6 drops from $3.00/M to $0.30/M. Gemini therefore stays cheaper on cached input for prompts up to 200,000.