Claude vs GPT vs Gemini for Coding: Cost Per Task Compared
"Which AI should I code with?" is usually answered with benchmarks. Invoices answer it differently. Coding is the most token-hungry mainstream workload — an agent loop re-reads your repository dozens of times per task — so small rate differences compound into real money, and the rules around caching and context length matter as much as the headline price. Below, we price the same two coding jobs on Claude, GPT and Gemini at their current tiers: a 15-step coding-agent task, and a one-shot code review. All rates are published October 2026 figures, USD per 1M tokens.
The Two Jobs We're Pricing
Job 1 — the agent task. A coding agent fixing a bug: 15 steps. Each step sends 40K input tokens — 34K of it repeated repository context, system prompt and tool definitions, plus 6K of new material — and returns 2K output tokens of code, tool calls and reasoning. This is the shape of real agent traffic: input-heavy, cache-friendly, output-light per step.
Job 2 — the one-shot review. A single request: a 120K-token diff-plus-context reviewed in one pass, 8K tokens of findings out. No repetition, so no caching — a pure headline-rate comparison, and the shape where tier rules (thresholds and step-ups) bite.
Job 1: The Agent Task, Priced Per 1,000 Tasks
| Tier | Model | Rates (in / cached / out) | Cost per step | Cost per task | Per 1,000 tasks |
|---|---|---|---|---|---|
| Workhorse | GPT-6.1 Sol | $2.00 / $0.10 / $10.00 | $0.0354 | $0.531 | $531 |
| Workhorse | Gemini 4 Argon (intro, thru Nov 30) | $2.00 / $0.10 / $10.00 | $0.0354 | $0.531 | $531 |
| Workhorse | Claude Sonnet 5.5 | $2.00 / $0.20 / $10.00 | $0.0388 | $0.582 | $582 |
| Workhorse | Gemini 4 Argon (from Dec 1) | $4.00 / $0.20 / $20.00 | $0.0708 | $1.062 | $1,062 |
| Flagship | Claude Opus 5.5 | $4.00 / $0.20 / $20.00 | $0.0708 | $1.062 | $1,062 |
| Flagship | Claude Fable 5.1 | $10.00 / $0.25 / $50.00 | $0.1685 | $2.528 | $2,528 |
| Flagship | GPT-6 Astra | $10.00 / $1.00 / $50.00 | $0.1940 | $2.910 | $2,910 |
| Budget | GPT-6 Luna / Claude Haiku 5.5 | $0.10 / $0.01 / $0.50 | $0.0019 | $0.029 | $29 |
Read the workhorse rows carefully, because they're the whole story. GPT-6.1 Sol and intro-period Argon tie at $531 per thousand tasks; Sonnet 5.5 costs 10% more ($582) for one reason only — its cache reads are $0.20 against $0.10. On an agent workload where 85% of input is repeated context, the cache rate is the price. And Argon's row has a date on it: from December 1, the identical workload costs $1,062 — flagship money — which is why our Argon vs Wonder analysis insists on budgeting Google at the December rate. The budget row is not a typo: at $29 per thousand tasks, Luna and Haiku cost 18x less than the workhorses, which is why production coding agents route their autocomplete, commit-message and test-selection steps down there and save the workhorse for the steps that think.
Job 2: The One-Shot Review, Where Rules Bite
| Model | Math (120K in, 8K out, no cache) | Cost per review |
|---|---|---|
| GPT-6 Luna | 120K x $0.10 + 8K x $0.50 | $0.016 |
| Claude Haiku 5.5 | 120K x $0.50 + 8K x $2.50 (stepped-up rate) | $0.080 |
| GPT-6.1 Sol | 120K x $2.00 + 8K x $10.00 | $0.320 |
| Claude Sonnet 5.5 | 120K x $2.00 + 8K x $10.00 | $0.320 |
| Gemini 4 Argon (intro) | 120K x $2.00 + 8K x $10.00 | $0.320 |
| Gemini 4 Argon (from Dec 1) | 120K x $4.00 + 8K x $20.00 | $0.640 |
| Claude Opus 5.5 | 120K x $4.00 + 8K x $20.00 | $0.640 |
Two rules surface here that the agent table hid. Haiku's 100K step-up: its famous $0.10/$0.50 rate covers prompts up to 100,000 tokens; this 120K review bills entirely at $0.50/$2.50. It's still the second-cheapest row — but a workload priced assuming the headline rate would be off five-fold. OpenAI's 272K threshold doesn't trigger at 120K, but scale the review to a 300K-token monorepo diff and every GPT request reprices at 2x input and 1.5x output for the whole request, while Claude bills the standard rate across its full 1M context. Long-context coding work is where Claude's flat pricing quietly wins, as we found in Is Claude Cheaper Than GPT?
Where the Money Goes Inside One Coding Task
Decompose the winning row. One GPT-6.1 Sol step at $0.0354 splits into $0.0120 of fresh input (34%), $0.0034 of cached input (10%) and $0.0200 of output (56%). The output — just 2K of the step's 42K tokens, under 5% of the volume — is the majority of the cost, because output bills at five times the input rate and because coding agents spend output on reasoning as well as code. Two consequences follow. First, verbosity is a budget line: an agent configured to explain itself at length on every step can double its output tokens and add roughly $180 per thousand tasks on this workload without solving a single extra bug. Second, step count is the master variable — a 25-step task costs two-thirds more than a 15-step task on every row of the table simultaneously, which is why the cheapest coding stack is usually the one with the best planning and the fewest repair loops, not the one with the lowest rate card.
The Caveat That Outranks Every Table: Cost Per Solved Task
Everything above prices a fixed token budget. Real models don't consume fixed budgets — a model that solves the bug in 9 steps beats a cheaper model that needs 15, and a model whose first patch passes tests beats one whose patch needs two repair rounds at full context. Three token-efficiency facts belong in any honest comparison. Anthropic states that Sonnet 5.5 typically needs fewer tokens for the same work than its predecessor — vendor-reported, but consistent with the direction of our own reference workloads. Models from Claude 4.7 onward use a tokenizer that counts roughly 30% more tokens for the same text than the previous generation, which claws back part of a rate advantage before you start. And Gemini's caching is implicit-only, so the 34K cached tokens in Job 1 are a measured outcome on Google, not a guarantee — with Anthropic's explicit breakpoints and OpenAI's automatic-plus-breakpoints, the cached share is closer to a design decision. The only defensible methodology: take your ten most common coding tasks, run them on two or three finalists, and divide each bill by the number of tasks actually solved. The tables here narrow the field; your eval picks the winner.
Verdicts by Scenario
| Scenario | Pick on cost | Why |
|---|---|---|
| High-volume coding agent, repo context heavy | GPT-6.1 Sol ($531/1K tasks) | Cheapest deep cache ($0.10) at workhorse quality, no expiry date |
| Same agent, already on Google | Argon — at December math ($1,062) | Intro price is a trial, not a budget; decide at $4/$20 |
| Long-context work (300K+ prompts) | Claude Sonnet 5.5 / Opus 5.5 | No whole-request surcharge; standard rates to 1M tokens |
| Autocomplete, commit messages, triage steps | GPT-6 Luna or Haiku 5.5 ($29/1K) | 18x cheaper; keep prompts under Haiku's 100K step-up |
| Hardest debugging, cost secondary | Opus 5.5 ($1,062/1K) | Half the price of Fable 5.1 / Astra rows for flagship-tier work |
Whichever row you land on, run your own token mix through the AI API Cost Calculator before committing — and read our prompt caching guide before blaming any provider for an agent bill, because on this workload the cache line is bigger than the provider gap. The full field, including the models that didn't make these tables, is ranked in the cheapest LLM API comparison.
FAQ
Which AI is cheapest for coding?
Per task on a realistic agent workload: GPT-6.1 Sol and intro-period Gemini 4 Argon tie at $0.531, with Claude Sonnet 5.5 at $0.582 — the gap is entirely cache pricing. For the simple steps inside a coding workflow, GPT-6 Luna and Claude Haiku 5.5 cost $0.029 per task, and nothing else is close.
Is Claude or GPT better value for a coding agent?
On price alone, GPT-6.1 Sol's $0.10 cache reads beat Sonnet 5.5's $0.20 on context-heavy agent loops. On very long prompts (over 272K tokens), Claude wins because OpenAI reprices the whole request. On capability per solved task, run your own eval — a model that finishes in fewer steps can erase a rate gap.
Why does Gemini 4 Argon appear twice in the tables?
Because it has two prices: the $2/$10 introductory rate through November 30, 2026, and $4/$20 from December 1. Both are on Google's pricing page. Budgeting on the intro rate alone is how a coding tool's unit economics break in December.
Does a cheaper per-token rate mean a cheaper coding tool?
Not necessarily. Cost per solved task is the real metric: tokens per task, steps per task and first-try success rate all multiply the rate card. The cheapest workflow is usually a routed one — budget models for mechanical steps, a workhorse for the hard steps.
Rates are published October 2026 rate cards (OpenAI, Anthropic and Google pricing pages and trackers, verified October 21, 2026). Workload figures are illustrative examples computed from those rates on fixed token budgets; real cost per solved task varies by model and codebase. Rates change — confirm on the provider's pricing page before committing.