CheckPre

Claude Sonnet 5 vs Gemini 3.1 Pro API Cost

Claude Sonnet 5 at $2/$10 against Gemini 3.1 Pro at $2/$12 per million tokens, including Gemini's higher rates for prompts over 200,000 tokens.

Updated · By Niraj Kumar · 6 sources

Models

Each request

Count text inCount text in
tokens

System prompt, conversation history, documents and tool definitions are all resent on every call.

tokens

The visible answer.

Count tokens from a prompt or JSON payloadShow

Plain text, OpenAI Chat or Responses JSON, or Anthropic Messages JSON. A final assistant message or a response body counts as output. Counted in your browser; nothing is uploaded.

Loading the tokenizer…

Counts use OpenAI's o200k tokenizer, so they are exact for GPT-6 and GPT-5 models, plus a few tokens of message framing. Other providers' tokenizers count the same text differently and do not publish a conversion factor; Anthropic says Claude models from 4.7 on produce about 30% more tokens than earlier Claude models. For an exact count on another model, paste one of its API responses: the usage it reports is shown above.

tokens

Thinking tokens are billed as output. Leave at 0 for models or settings that do not reason.

Volume

PricePrice

30,000 requests over 30 days.

Discounts

%
0%100%

The share of input that repeats exactly at the start of every request, such as a fixed system prompt. The prompt caching calculator prices cache writes and expiry in detail.

Batch APIBatch API
Cheaper for this workloadClaude Sonnet 58% less, saving $30.00 a month
Claude Sonnet 5
$330.00 a month
$0.011 a request · 15th cheapest of 24
Gemini 3.1 Pro
$360.00 a month
$0.012 a request · 19th cheapest of 24
At 10× the volume
$300.00 a month apart
Cheapest listed model
Claude Haiku 5.5
$16.50 a month
Side by side
MeasureClaude Sonnet 5Gemini 3.1 Pro
Input, per 1M tokens$2$2
Cache hit, per 1M tokens$0.20$0.20
Output, per 1M tokens$10$12
Context window1M tokens1.05M tokens
Max output128K tokens65.5K tokens
Batch discount50%50%
Long-context surchargeNoneAbove 200K input
Input cost a month$180.00$180.00
Output cost a month$150.00$180.00
Every model on this workload, per month3,000 tokens in, 500 out, 1,000 a day. Hover or focus a row for rates.
  1. 1Claude Haiku 5.5Anthropic$16.50
  2. 2GPT-6 LunaOpenAI$16.50
  3. 3Qwen3.8 FlashAlibaba$20.55
  4. 4GPT-5.6 LunaOpenAI$36.00
  5. 5DeepSeek V4.1 FlashDeepSeek$45.00
  6. 6Qwen3.7 PlusAlibaba$60.00
  7. 7Gemini 3.5 Flash-LiteGoogle$64.50
  8. 8Gemini 3.8 FlashGoogle$123.75
  9. 9Grok 4.3xAI$150.00
  10. 10Claude Haiku 4.5Anthropic$165.00
  11. 11DeepSeek V4 ProDeepSeek$178.20
  12. 12Grok 4.7xAI$270.00
  13. 13Qwen3.8 MaxAlibaba$270.00
  14. 14Claude Sonnet 5.5Anthropic$330.00
  15. 15Claude Sonnet 5Anthropic$330.00
  16. 16GPT-6.1 SolOpenAI$330.00
  17. 17GPT-6 SolOpenAI$330.00
  18. 18GPT-5.6 TerraOpenAI$360.00
  19. 19Gemini 3.1 ProGoogle$360.00
  20. 20Claude Opus 5.5Anthropic$660.00
  21. 21GPT-5.6 SolOpenAI$660.00
  22. 22Claude Opus 5Anthropic$825.00
  23. 23Claude Fable 5.1Anthropic$1,650
  24. 24GPT-6 AstraOpenAI$1,650

How the Claude Sonnet 5 vs Gemini 3.1 Pro API Cost works

cost = (fresh input × input rate + cached input × cache rate + (output + reasoning) × output rate) ÷ 1,000,000

This page uses the same method as the LLM API Cost Calculator, which explains each term and assumption in full.

Worked example

A chat feature sending 3,000 input tokens and getting 500 back, 1,000 times a day, priced on both models with no caching.

  1. 1Claude Sonnet 5: 3,000 × $2 + 500 × $10, ÷ 1,000,000 = $0.011 a request, $330.00 a month
  2. 2Gemini 3.1 Pro: 3,000 × $2 + 500 × $12, ÷ 1,000,000 = $0.012 a request, $360.00 a month
  3. 3Difference: $30.00 a month

Claude Sonnet 5 is $30.00 a month cheaper for this workload, 8% less.

Frequently asked questions

Which is cheaper, Claude Sonnet 5 or Gemini 3.1 Pro?

At standard list rates, Claude Sonnet 5 is 8% cheaper than Gemini 3.1 Pro on a typical chat request (3,000 tokens in, 500 out); Claude Sonnet 5 is 16% cheaper than Gemini 3.1 Pro on output-heavy generation (500 in, 2,000 out); and Claude Sonnet 5 is 7% cheaper than Gemini 3.1 Pro on a large cached prompt (20,000 in, 90% cached, 500 out). Claude Sonnet 5 charges $2 input and $10 output per million tokens; Gemini 3.1 Pro charges $2 and $12.

How do long prompts change the Sonnet 5 vs Gemini 3.1 Pro comparison?

Below 200,000 tokens the two share a $2 input rate and Sonnet 5's output is cheaper, $10 to $12. Above 200,000, Gemini 3.1 Pro bills the request at $4 input and $18 output, while Sonnet 5 keeps its standard rate up to 1M tokens, so long-document work widens the gap. Caching differs too: Gemini's explicit cache charges $4.50 per million tokens an hour to keep, Anthropic's charges once to write.

Sources

Related calculators

More in AI, Cloud & Developer