AiCostCompare

Claude Sonnet 5 vs Gemma 4 31B

Side-by-side API pricing and Artificial Analysis performance for Claude Sonnet 5 (Anthropic) and Gemma 4 31B (Google). Green cells mark the better value in each row.

Prices updated Jul 22, 2026, 1:38 AM UTC · refreshed hourly

Claude Sonnet 5

Anthropic

Gemma 4 31B

Google

Pricing
Input $/1M$2.00$0.12
Output $/1M$10.00$0.37
Blended $/1M (3:1)$4.00$0.182
RAG example (30K in / 2K out)$0.08$0.00434
Quality & speed
Intelligence Index53.429.4
Coding Index71.543.4
Agentic Index46.714.4
Output speed (tok/s)8835
Time to first token93.55s0.98s
Specs
Context window1M262K
Input modalitiestext, image, fileimage, text, video

FAQ

Which is cheaper, Claude Sonnet 5 or Gemma 4 31B?

Gemma 4 31B has the lower blended API price at $0.182 per 1M tokens (3:1 input:output mix), versus $4.00 for the other model. Prices are live from OpenRouter and refresh about hourly.

Which is better for RAG workloads?

For a typical RAG request (30K input / 2K output tokens), Gemma 4 31B costs about $0.00434 per request versus $0.08. Also compare context windows: Claude Sonnet 5 offers 1M and Gemma 4 31B offers 262K.

Which scores higher on Artificial Analysis benchmarks?

Claude Sonnet 5 leads on the Artificial Analysis Intelligence Index (53.4 vs 29.4). Check coding and agentic indices on this page for workload-specific tradeoffs.