Claude Sonnet 4.5 vs GPT-5: Claude Wins Coding A head-to-head comparison finds Anthropic's Claude Sonnet 4.5 outperforms OpenAI's GPT-5 on coding and agentic benchmarks, scoring 77.2% on SWE-bench Verified versus GPT-5's 74.9%, and 50.0% versus 43.8% on Terminal-Bench 2. GPT-5 counters on price, listing at $1.25 per million input tokens and $10 per million output against Sonnet 4.5's $3 and $15, and leads on competition maths and multimodal understanding with 94.6% on AIME 2025 and 84.2% on MMMU. Verdict: in the Claude Sonnet 4.5 vs GPT-5 comparison, Claude Sonnet 4.5 wins on coding and agentic work, scoring 77.2% on SWE-bench Verified against GPT-5's 74.9% Anthropic https://www.anthropic.com/news/claude-sonnet-4-5 , OpenAI https://openai.com/index/introducing-gpt-5/ . GPT-5 wins on price, listing at $1.25 input and $10 output per million tokens versus $3 and $15 for Sonnet 4.5, and it leads on competition maths and multimodal understanding. Pick Sonnet 4.5 if your primary workload is writing and refactoring code inside an agent; pick GPT-5 if you are running high token volumes, image-heavy inputs, or maths-flavoured reasoning where the cost difference compounds. Sonnet 4.5, and the margin holds across more than one benchmark, which is what makes it worth acting on. Anthropic reports 77.2% on SWE-bench Verified for Sonnet 4.5, using parallel test-time compute Anthropic https://www.anthropic.com/news/claude-sonnet-4-5 . OpenAI reports 74.9% for GPT-5 on the same benchmark OpenAI https://openai.com/index/introducing-gpt-5/ . A 2.3 point gap on a single leaderboard would be noise. The Terminal-Bench 2 leaderboard, which scores models on multi-step terminal work rather than isolated patches, puts Sonnet 4.5 at 50.0% and GPT-5 at 43.8% Terminal-Bench https://terminal-bench.com/leaderboard — a wider gap on the task shape that matters most when a model is driving a shell rather than answering a question. The practical difference shows up in agent loops. On computer-use tasks measured by OSWorld, Anthropic reports 61.4% for Sonnet 4.5, and describes the model sustaining autonomous multi-step coding for more than 30 hours in its own launch testing Anthropic https://www.anthropic.com/news/claude-sonnet-4-5 . That figure is a vendor claim, not an independent measurement, so treat it as a directional signal about long-horizon stability rather than a number to plan a sprint around. If you want a closer look at how the two ecosystems behave inside real developer tooling, our comparison of Codex and Claude Code https://dev.to/articles/gpt-codex-vs-claude-code covers the harnesses rather than the raw models. Enough to change architecture decisions at volume. GPT-5 lists at $1.25 per million input tokens and $10 per million output tokens; Sonnet 4.5 lists at $3 and $15 OpenAI pricing https://openai.com/api/pricing/ , Anthropic https://www.anthropic.com/news/claude-sonnet-4-5 . Run the arithmetic on a modest production workload of 10 million input tokens and 2 million output tokens per month at list prices. Sonnet 4.5 comes to $60 Anthropic https://www.anthropic.com/news/claude-sonnet-4-5 . GPT-5 comes to $32.50 OpenAI pricing https://openai.com/api/pricing/ . That is about 46% less for the same traffic, and the gap scales linearly, so a team pushing ten times that volume is choosing between roughly $600 and $325 a month before any caching or batching discounts. One caveat that catches people out: OpenAI's heavy-reasoning tier, GPT-5 Pro, is listed at $15 input and $120 output per million tokens OpenAI pricing https://openai.com/api/pricing/ . If your evaluation quietly used Pro and your production plan assumes base GPT-5 pricing, your cost model is wrong by an order of magnitude on output. Maths and multimodal breadth. GPT-5 reaches 94.6% on AIME 2025 with no tool access and 84.2% on MMMU, the multimodal understanding benchmark OpenAI https://openai.com/index/introducing-gpt-5/ . If your product reasons over diagrams, screenshots, scanned documents or charts, that is the more relevant axis than SWE-bench, and it points the other way. Context length also favours GPT-5: 272K input tokens with a 400K total window, against 200K for Sonnet 4.5. For most coding work this is academic, because retrieval beats stuffing a monorepo into a prompt. It stops being academic when you are summarising long transcripts or reconciling several large documents in a single pass. Not at the frontier, and that is the honest framing. Anthropic released Claude Sonnet 5 on 30 June 2026 at $2 input and $10 output per million tokens, reporting 63.2% on SWE-bench Pro against GPT-5.5's 58.6% Anthropic https://www.anthropic.com/news/claude-sonnet-5 , OpenAI https://openai.com/index/introducing-gpt-5-5 . Sonnet 5 versus GPT-5.5 is the current-generation question, and we cover the newer field in our 2026 coding model roundup https://dev.to/articles/best-llm-for-coding-2026-gpt-5-3-codex-vs-claude-opus-4-6 and the Gemini 3.7 Flash comparison https://dev.to/articles/gemini-3-7-flash-vs-claude-sonnet-5-gpt-5-6-terra-coding-benchmark . Note what the Sonnet 5 price does to this analysis: at $2 input, the newer Anthropic model undercuts Sonnet 4.5 by a third while scoring higher. If you were choosing Sonnet 4.5 today purely on capability, check whether Sonnet 5 is cheaper for you as well. The main reasons to stay on 4.5 are prompt stability, an evaluation suite you have already tuned, and pinned behaviour in a production agent you do not want to re-qualify. Three straightforward cases: If the decision is about a monthly consumer subscription rather than API tokens, that is a different calculation with different winners; see ChatGPT versus Claude on which to pay for https://dev.to/articles/chatgpt-vs-claude-which-to-pay-for-2026 . The limitation worth stating plainly: every headline number above except Terminal-Bench comes from the vendor that ships the model, on benchmarks the vendor chose to report. Vendor-reported SWE-bench figures also vary with scaffolding and test-time compute settings, which is why Anthropic's 77.2% carries a parallel-compute footnote. Run twenty representative tasks from your own backlog through both before committing. The benchmark gap tells you where to start; it does not tell you what your codebase will do. Q: Is Claude Sonnet 4.5 better than GPT-5 for coding? A: Yes, on the published evidence. Sonnet 4.5 scores 77.2% on SWE-bench Verified against GPT-5's 74.9%, and leads 50.0% to 43.8% on Terminal-Bench 2 agentic terminal tasks. Q: How much cheaper is GPT-5 than Claude Sonnet 4.5? A: GPT-5 lists at $1.25 input and $10 output per million tokens versus $3 and $15 for Sonnet 4.5. On a workload of 10M input and 2M output tokens, that is $32.50 against $60 OpenAI pricing https://openai.com/api/pricing/ . Q: Which has the larger context window? A: GPT-5, with 272K input tokens and a 400K total window, compared with 200K for Claude Sonnet 4.5. Q: When were these models released? A: OpenAI released GPT-5 on 7 August 2025. Anthropic released Claude Sonnet 4.5 on 29 September 2025. Q: Should I use these or the newer models? A: Claude Sonnet 5 30 June 2026 and GPT-5.5 are the current generation, and Sonnet 5 is both cheaper and stronger than Sonnet 4.5 at $2 input per million tokens. Stay on the older pair only if you have pinned, qualified behaviour you do not want to disturb. Q: Can I mix both models in one system? A: Yes, and it is often the cheapest correct answer. Route code generation and agent steps to Sonnet 4.5, and send bulk classification, extraction and multimodal parsing to GPT-5.