Claude Sonnet 4 vs GPT-5.1 Codex

Side-by-side benchmark comparison across coding, math, reasoning, speed, and pricing.

GPT-5.1 Codex by OpenAI wins on 11 of 15 benchmarks against Claude Sonnet 4 by Anthropic, which leads on 2. This head-to-head comparison covers coding, math, reasoning, speed, and pricing metrics from our benchmark data.

Category-by-Category Breakdown

General Intelligence: In general intelligence, GPT-5.1 Codex scores 1395 on Chatbot Arena ELO compared to Claude Sonnet 4's 1365, while GPT-5.1 Codex scores 82.0% on MMLU-Pro compared to Claude Sonnet 4's 81.0%.

Coding: In coding, GPT-5.1 Codex scores 96.0% on HumanEval+ compared to Claude Sonnet 4's 88.0%, while GPT-5.1 Codex scores 78.0% on SWE-bench Verified compared to Claude Sonnet 4's 72.7%, while GPT-5.1 Codex scores 85.0% on LiveCodeBench compared to Claude Sonnet 4's 58.0%.

Math: In math, both score 85.0% on MATH, while GPT-5.1 Codex scores 95.0% on GSM8K compared to Claude Sonnet 4's 94.5%.

Reasoning: In reasoning, Claude Sonnet 4 scores 75.4% on GPQA Diamond compared to GPT-5.1 Codex's 65.0%, while GPT-5.1 Codex scores 52.0% on ARC-AGI compared to Claude Sonnet 4's 42.0%.

Context: In context, Claude Sonnet 4 scores 1.0M on Context Length compared to GPT-5.1 Codex's 400K.

Pricing Comparison

Claude Sonnet 4 costs $3.0/1M input tokens and $15.0/1M output tokens, while GPT-5.1 Codex costs $1.3/1M input and $10.0/1M output. GPT-5.1 Codex is the more affordable option for API usage.

Speed Comparison

Claude Sonnet 4 generates output at 75 tok/s compared to GPT-5.1 Codex's 85 tok/s, and the time to first token is 400 ms for Claude Sonnet 4 versus 400 ms for GPT-5.1 Codex. GPT-5.1 Codex delivers faster throughput.

Verdict

GPT-5.1 Codex leads across the board in coding, general intelligence, affordability, speed, making it the stronger overall choice in this comparison.

Claude Sonnet 4 vs GPT-5.1 Codex — FAQ

Which is better, Claude Sonnet 4 or GPT-5.1 Codex?

GPT-5.1 Codex wins on more benchmarks overall (11 vs 2). However, the best choice depends on your specific needs — each model excels in different areas.

How does Claude Sonnet 4 compare to GPT-5.1 Codex for coding?

GPT-5.1 Codex is better for coding, scoring 78.0% on SWE-bench Verified compared to 72.7%. SWE-bench tests real-world software engineering by resolving actual GitHub issues.

Is Claude Sonnet 4 cheaper than GPT-5.1 Codex?

Yes, GPT-5.1 Codex is cheaper. Claude Sonnet 4 costs $3.0/1M input and $15.0/1M output tokens. GPT-5.1 Codex costs $1.3/1M input and $10.0/1M output tokens.

Which is faster, Claude Sonnet 4 or GPT-5.1 Codex?

GPT-5.1 Codex is faster, generating output at 85 tok/s compared to 75 tok/s. Faster output speed means shorter wait times for API responses.

What benchmarks does the Claude Sonnet 4 vs GPT-5.1 Codex comparison cover?

This comparison covers 15 benchmarks including Chatbot Arena ELO, MMLU-Pro, HumanEval+, MATH, GPQA Diamond, SWE-bench Verified, Output Speed, LiveCodeBench, and more. Metrics span general intelligence, coding, math, reasoning, speed, and cost categories.