Skip to content

COMPARISONS

Best AI Model for Coding Compared: GPT, Claude, Gemini

The best AI model for coding compared on one measured session: $0.57, $1.31 and $3.27. The cheapest of the three is the one whose card leaves a figure out.

The best AI model for coding compared on price is not one number, because the three vendors do not bill the same shape. On 2026-08-19 we priced one measured 354,835-token session on all three published cards: GPT-5.3 Codex $0.57, Gemini 3.1 Pro $1.31, Claude Opus 5 $3.27 — except Gemini's figure climbs to $13.03 if the session runs eight hours, and the cheapest of the three rests on a rate OpenAI does not publish. This article shows the arithmetic, the crossing point, and a check that re-reads all three vendors rather than trusting a date.

Key takeaways

  • One session, three shapes. Anthropic charges a one-time cache write, Google rents the cache per token-hour, OpenAI publishes no write rate at all. A single $/MTok column cannot express all three.
  • Gemini 3.1 Pro overtakes Claude Opus 5 after 80 minutes of cache held — before that it is cheaper, after that it is more expensive, and no comparison table has a column for time.
  • The cheapest row is the one with the missing figure. GPT-5.3 Codex wins at $0.57 partly because OpenAI publishes no cache-write premium; at Anthropic's published 2x it would be $1.14.
  • The measured session sits 1.77x over Google's 200,000-token tier, so the rates that apply are $4 and $18 per million, not the $2 and $12 every roundup quotes.
  • Fourteen published fields were re-read live and all fourteen matched what this article prints, which is a stronger claim than a date next to a table.

The short answer

Pick GPT-5.3 Codex on published price, Gemini 3.1 Pro only for short sessions, and Claude Opus 5 when you are buying something other than the cheapest tokens. That is a ranking of rate cards, not of code, and the distance between those two things is the subject of the rest of this page.

For the full sticker-price picture across tools rather than models, the AI coding tools pricing comparison is the pillar this sits under. This article is the model-level version, and it builds directly on two earlier ones: what actually separates Claude from GPT and the Gemini and Claude price flip.

One session priced on three cards

The session is not hypothetical. It is one headless turn that read three committed files from this repository — a lockfile and two project documents, 696,820 bytes — and reported 354,835 prompt tokens with 325,343 of them written to cache. Every figure below is that exact token shape run through three published rate cards:

ModelCharged onceAfter 1 hourAfter 8 hours
GPT-5.3 Codex$0.57$0.57$0.57
Gemini 3.1 Pro$1.31$2.78$13.03
Claude Opus 5$3.27$3.27$3.27

Two of those rows are flat lines and one is a slope. Google rents cached tokens at $4.50 per million per hour, which on 325,343 written tokens is $1.46 an hour for as long as the cache is held — and an agent session that is thinking, waiting on a test run, or sitting idle in a terminal is still holding it.

The whole calculation is committed:

Terminal
npm run check:threeway

The cheapest row is the one with a missing rate

GPT-5.3 Codex wins the table, and the reason is worth more than the win.

Every vendor bills the tokens that populate a cache. Anthropic publishes what it charges for that: 2x the input rate for a one-hour TTL, which on 325,343 tokens at $5 per million is $3.25 — almost the entire Claude Opus row. Google publishes no write premium, and neither does OpenAI for gpt-5.3-codex. So two of the three rows above are built on an assumption, and it is stated rather than buried: unpublished write premiums are priced at 1x the vendor's own input rate, because the tokens have to be paid for on the request that carries them.

VendorCache-write rateEffect on the row
Anthropic2x input, published$3.25 of a $3.27 total
OpenAInot publishedassumed 1x — $0.57 total
Googlenone charged, rent insteadassumed 1x — $1.31 plus $1.46/hour

Change that one assumption and the ranking moves. If OpenAI charged the same 2x premium Anthropic publishes, its row would be $1.14 — still the cheapest, but no longer by 5.7x. If it charged nothing at all for writes, it would be $0.01.

That range is the finding. A comparison built from published cards rewards the vendor who publishes least, and the only honest response is to name the assumption and show what it is worth. An earlier article on this site priced Google's writes at zero and reported the rent separately; this one prices them at input rate and folds the rent in. Both choices are defensible, both are stated, and a table that picks one silently is not.

Where Gemini overtakes Claude Opus

Because two rows are flat and one has a slope, they intersect. Solved exactly rather than read off a chart:

The crossing
Gemini once      $1.313
Claude Opus once $3.268
Gemini rent      $1.464 per hour

(3.268 - 1.313) / 1.464 = 1.34 hours = 80 minutes

Under 80 minutes of held cache, Gemini 3.1 Pro is the cheaper of the two. Over it, Claude Opus 5 is. For a quick targeted edit Gemini wins on price; for an afternoon of agentic work on one loaded codebase it does not, and the gap keeps growing because rent does not stop.

A related figure appears in the Gemini and Claude comparison, which found a 53-minute crossing. The two numbers measure different things and both are right: that one compares Anthropic's one-time write fee against Google's rent alone, on Claude Sonnet 5. This one compares the two vendors' full session totals, on Claude Opus 5, with Google's writes priced at its input rate rather than at zero. Different model, different quantity, same mechanism — which is why the method matters more than the headline.

The tier boundary nobody quotes

Google's published rates for Gemini 3.1 Pro are $2 input and $12 output per million for prompts at or under 200,000 tokens, and $4 and $18 above it. The measured session is 354,835 tokens: 1.77x over the boundary.

Every figure in this article's Gemini row therefore uses $4 and $18, not the numbers on the marketing page. That is not an edge case being engineered for effect — the session is three committed files from a small repository, exactly the kind of read an agent performs when asked to understand a project, and what actually fills a context window measured that a single lockfile can account for 139,640 tokens on its own.

Checking the vendor instead of the date

Two existing checks on this site carry a readOn date next to every rate and fail once it goes stale. That catches age. It does not catch a figure that changed the day after it was read.

scripts/check-three-way.mjs fetches all three published pages and compares them field by field against what this article prints:

Terminal
npm run check:threeway -- --fetch
# → No drift: every live field matches what this site prints.

Fourteen fields across three vendors, re-read on 2026-08-19: Anthropic's input, output, context window and max output; OpenAI's input, cached input and output; Google's seven, including both tier rates and the storage rent. All fourteen matched. Any that had not would name the vendor, the field, the printed value and the published one, and exit non-zero.

The parsers are deliberately not generic — OpenAI ships its table as serialised component props, Google renders a real table, Anthropic renders a four-column comparison in model order. A loose parser that silently matched the wrong cell would be worse than no check at all, so each one is anchored and the script fails when a field comes back empty rather than treating an unparsed page as an unchanged one.

The fetch that failed, and why it matters

The first version sent a Chrome User-Agent, on the reasoning that documentation sites serve browsers better. Against ai.google.dev that request redirect-looped into an auto-signin OAuth flow and blew past the 20-redirect budget Node's fetch enforces:

What came back
TypeError: fetch failed
  cause: Error: redirect count exceeded

The same URL, requested with no User-Agent at all, returns 200 with zero redirects. Measured 2026-08-19.

It is a small bug with a general lesson: the failure looked like the page being unavailable, and the honest reading is that Google's docs site treats a browser-shaped request as a signed-in user's. If that had been silently caught and turned into "Google figures unavailable", the article would have shipped a two-way comparison and called it a three-way. The script now fails loudly when a field cannot be read, for exactly that reason.

How to choose between the three

  • Short, bounded sessions: Gemini 3.1 Pro. Cheapest of the three for the first 80 minutes of held cache, and the large window is genuinely large. Set a cache TTL you actually want to pay for.
  • Long agentic sessions on one loaded codebase: not Gemini. Rent compounds; the other two do not. This is the single clearest decision rule the pricing supports.
  • Cheapest published tokens: GPT-5.3 Codex — with the caveat that its lead is partly an unpublished rate, and you should re-price it the day OpenAI documents one.
  • Anthropic when the harness is the purchase. Claude Opus 5 is the most expensive row here by 5.7x, and the reason people pay it is not the token rate — what an agent actually is covers what you are buying alongside the model.
  • Whatever you pick, price a real session, not a rate. Ranking on the input rate ranks on a tiny fraction of an agentic request; the reasoning is in what the price cards actually say.

Common mistakes in an LLM coding comparison

  • Ranking on the headline input rate. Tempting because it is the one number every vendor prints large. The symptom is a bill that does not resemble the table. On this session the uncached input was 2 tokens of 354,835 — ranking on it ranks on 0.0006% of the request.
  • Treating "1M context" as one specification. Tempting because both Anthropic and Google market the phrase. The symptom is a budget built on a number the price tier abandons at 200,000 tokens.
  • Comparing a vendor who publishes everything against one who publishes less. Tempting because the arithmetic works either way. The symptom is a winner chosen by disclosure policy. The fix is to state the assumed rate and show the range it spans.
  • Trusting a dated table. We made a version of this mistake ourselves for two prior articles. The symptom is a page that is confidently wrong on a Tuesday. The fix is a check that re-reads the source, not a reminder to.
  • Reading a price ranking as a quality ranking. The symptom is buying the cheapest tokens for work where the model's failure rate costs more than the difference — see what a SWE-bench score actually measures.

What we are not claiming

No output was compared. Only Claude Code is installed on this machine, so no GPT or Gemini response was generated, read or graded. There is no quality ranking here and there will not be one until all three run under a single harness — a precondition scripts/check-harness-share.mjs checks and deliberately fails on.

Two of the three cache-write rates are assumed, at 1x input, and the sensitivity is printed above rather than hidden. The Anthropic cache multipliers are not re-read live either: they appear in prose on a different page and carry a readOn date of 2026-08-17.

The token itself is assumed to be one unit across the three cards, and it is not. The same eight files from this repository count 1.206x more tokens on Anthropic's tokeniser than on OpenAI's, so every row above understates the spread between vendors by roughly a fifth — pricing per byte of source is the correction, and it does not change the ordering here.

And there is one figure this repository has measured that contradicts a published card: on Claude Sonnet 5, Claude Code's own reported cost reproduces at $3/$15 per million rather than the published $2/$10 — a 1.5x gap, documented in the Sonnet and Opus comparison. We have no equivalent tool-side measurement for OpenAI or Google, which means the one vendor whose row can be checked against a real bill is the one whose row is highest.

Conclusion

Price your own session before you pick, because the ranking here changes with one variable no table has a column for. If your work is short and bounded, Gemini 3.1 Pro is the cheapest of the three for the first 80 minutes; if it runs all afternoon on one loaded repository, rent makes it the most expensive. GPT-5.3 Codex leads on published rates and should be re-checked the moment OpenAI documents a cache-write premium. Run npm run check:threeway -- --fetch against your own token shape — it took three vendors' live pages and fourteen fields to establish that today, at least, the table is right.

Frequently asked questions

Which is cheapest for coding: GPT, Claude or Gemini?
On one measured 354,835-token session priced against all three cards on 2026-08-19, GPT-5.3 Codex came to $0.57, Gemini 3.1 Pro to $1.31 and Claude Opus 5 to $3.27. Gemini's figure rises with time because Google rents the cache at $4.50 per million tokens per hour, reaching $13.03 after eight hours, while the other two are charged once and never move.
Why do GPT vs Claude vs Gemini price comparisons disagree with each other?
Because the three vendors bill the prompt cache in three different shapes. Anthropic charges a one-time write fee at twice its input rate. Google charges no write fee and rents the cache per token-hour. OpenAI publishes a cached-input rate and no write rate at all for gpt-5.3-codex. Any single dollar figure has to assume something about the two unpublished rates, and different pages assume differently.
Does Gemini's 1M context window make it cheaper for large codebases?
Not on the published card. Google's rates double above a 200,000-token prompt, from $2 to $4 per million input and $12 to $18 output, and a routine agentic session measured here was 354,835 tokens — 1.77x over that boundary. The large window is real; the headline price does not apply at the sizes the window exists to serve.
How current are AI model pricing comparisons?
Most carry a date and nothing else. The figures in this article are re-read from all three vendors' published pages by a committed script, which compares fourteen fields against what the article prints and exits non-zero on any difference. Run on 2026-08-19, all fourteen matched. A date tells you a number is old; only a re-read tells you it is wrong.
Which model writes the best code?
This article does not answer that and cannot. Only Claude Code is installed on the machine these measurements come from, so no GPT or Gemini output was produced, compared or graded. Anyone ranking three models on output quality needs all three running under one harness, and that precondition is checked by a script on this site that deliberately fails here.

Muhammad Kashif

Founder and editor of Devventa, covering AI coding assistants, Next.js and the modern AI development stack.