Gemini vs Claude coding comparisons all print the same table, and three of its columns are not the same measurement. On 2026-08-18 we took one real session — three committed files from this repository, 354,835 prompt tokens, measured by Claude Code itself — and priced it on both vendors' published cards. The metered gap came out at roughly 110x in Google's favour, and it is not a real gap: Anthropic charges a one-time fee for the cache and Google charges rent, and the two cross at 53 minutes.
Key takeaways
- The metered comparison is a fee against a rent. Anthropic billed $1.301372 once for a one-hour cache TTL. Per Google's Gemini API pricing documentation, Google rents the same 325,343 tokens at $1.464044 per hour, so the comparison reverses after 53 minutes of session life.
- A real coding session lands 1.77x over Google's 200k tier. Above it, Gemini 3.1 Pro's rate is exactly 2.00x the headline rate every roundup quotes.
- Both windows are "1M" and neither is. Google publishes 1,048,576 tokens; Anthropic publishes 1,000,000 — 4.86% apart.
- The 2x output-ceiling gap disappears when you check one side. Anthropic's card says 128,000; Claude Code reported 64,000 for the same model, just under Google's published 65,536.
- One of these prices has an expiry date. Gemini 3.7 Flash doubles on 1 January 2027, published on the rate card. Anthropic publishes no scheduled change for the models here.
The short answer
Choose on how long your sessions live, not on the per-token column. Short, bursty, mostly-uncached work is cheaper on Gemini by a wide margin. Long agentic sessions that hold a large cached context — the shape most terminal coding agents actually produce — erase that margin and then cross it.
Everything below is a cost and specification comparison, and deliberately not a quality one. For where the whole field sits, the complete comparison of AI coding assistants is the pillar; for the same problem across nine cards rather than two, what the price cards actually say is the wider version.
One measured session, priced on both cards
The session is deliberately boring: a lockfile and two project documents, all committed, piped into a single headless turn whose entire output was the word "ok".
cat package-lock.json roadmap.md content-rules.md | claude -p "Reply with exactly: ok" --output-format json --effort low --model sonnet # → 696,820 bytes in # → "cache_creation_input_tokens": 325343, "cache_read_input_tokens": 29490 # → 354,835 context tokens, total_cost_usd 1.960971
We price that token shape on both cards with an internal check script:
| Priced on | Cost |
|---|---|
| Claude Sonnet 5, flat rate | $1.307322 |
| Gemini 3.1 Pro, headline rate | $0.005950 |
| Gemini 3.1 Pro, rate that applies | $0.011876 |
Two things about that table are wrong in ways worth separating. The first is that the middle row is the rate almost every published comparison quotes, and it is not the rate this session would pay. The second is bigger: the Gemini rows do not include the cache at all, because Google does not publish a per-write fee to include.
A fee is not a rent
Anthropic bills a cache write (see the Claude prompt caching documentation): 325,343 tokens at $4 per million for a one-hour TTL, $1.301372, once. Google bills cache storage: the same tokens at $4.50 per million tokens per hour, $1.464044 for every hour you hold them.
Those are different kinds of number and no single column can hold both. Set them equal and you get the only figure in this article that actually decides anything:
Anthropic write fee $1.301372 one-time, 1-hour TTL
Google storage rent $1.464044 per hour held
─────────────────────────────
crossover 53 minutes
Under 53 minutes of cached-context life, Gemini is cheaper and the metered table is roughly right. Past it, Google's rent overtakes Anthropic's fee and keeps going, and the direction of the comparison inverts while every published table still says 110x.
This matters more for coding than for anything else, because an agentic session is exactly the workload that holds a large context for a long time. A developer who leaves a terminal agent open over lunch is paying Google for lunch and paying Anthropic nothing extra.
Adding OpenAI to the same session makes the shape clearer rather than muddier: priced across all three vendors, Gemini's total overtakes Claude Opus 5 at 80 minutes rather than 53, because that comparison measures full session cost against a more expensive flat card instead of a fee against a rent.
The 200k boundary is not an edge case
Gemini 3.1 Pro's rate card has two columns. Below 200,000 prompt tokens it is $2.00 in and $12.00 out. Above it, $4.00 and $18.00. Anthropic has no such tier; its rate is flat at any prompt length.
The measured session was 354,835 tokens — 1.77x the boundary, and the rate that applied was exactly 2.00x the headline. Nothing about it was contrived: it is three files from one small Next.js site, and an agent asked to understand the project would plausibly open all three. package-lock.json alone measured 139,640 tokens, which is why — the detail is in what actually fills a context window.
So the tier is not the exception in agentic coding. It is closer to the default, and quoting the sub-200k rate for a coding workload is quoting the wrong half of the card.
Gemini vs Claude coding on the spec sheet
Read on 2026-08-18 from each vendor's own documentation, including Anthropic's model specifications:
| Field | Claude Sonnet 5 | Gemini 3.1 Pro |
|---|---|---|
| Context window | 1,000,000 | 1,048,576 |
| Max output, published | 128,000 | 65,536 |
| Max output, tool reports | 64,000 | not installed here |
| Prompt-length tier | none | 200,000 |
| Cache write | $4/MTok | not published |
| Cache storage | not billed | $4.50/MTok/hour |
| Availability | generally available | preview |
Two rows deserve reading twice.
The windows. Both are sold as one million tokens. Google's is 1,048,576 — a power of two — and Anthropic's is a round 1,000,000. The 4.86% difference is real, it is in Google's favour, and it is far too small to decide anything.
The output ceilings. On the cards this looks like Anthropic winning 2x. But Claude Code 2.1.234 reported a 64,000-token ceiling for Claude Sonnet 5 on the sessions measured here, which is slightly below Google's published 65,536. A 1.95x advantage on paper becomes a rounding error the moment one side is checked against a tool, and we could only check one side. Anthropic separately documents 300,000 output tokens on the Batches API behind an output-300k-2026-03-24 beta header, which is a third number again and not the one a coding session gets.
And one of them is a preview. gemini-3.1-pro-preview is labelled preview on Google's own model page; claude-sonnet-5 is generally available. Comparing a preview model to a GA one is a comparability problem in its own right, and it is the kind of thing that vanishes when a table prints only names and numbers.
One of these prices has an expiry date
Google's rate card carries scheduled increases in its own cells. Gemini 3.7 Flash reads "$0.75 through December 31, 2026. $1.50 starting January 1, 2027" on input, with output going $3.75 to $7.50 and cache storage $0.50 to $1.00 per million token-hours.
That is a published doubling on a known date, and it is the sort of fact a roundup written today will be silently wrong about in January. Anthropic publishes no scheduled change for any model compared here.
We made it a failing check rather than a sentence: our internal price check carries the effective date, and exits non-zero once the date passes without the card being re-read. It is the same discipline the nine-card price check uses, and the reason this site's pricing claims carry a read date at all.
Running it headless: three empty successes
Everything above is arithmetic on two published cards, which is what this site could measure in August. On 2026-09-20 we ran it instead: Google's Antigravity CLI was pointed at the same task Claude Code completes, three times, across two Gemini model families, and returned an empty response every time while reporting status: SUCCESS. The block is a tool permission, not the model. The price comparison stands; this is the availability half of the question.
The task is four small JavaScript modules, exactly one of which holds an off-by-one error. It is the task six Claude arms answered the day before, chosen because the answer is a single function name — pageSlice — which a nine-line grader can score without any vendor's help. Each arm copies src/ into an empty scratch directory, so no instruction file is discovered by walking up the tree and the README naming the answer is never in context.
agy --output-format json --model gemini-3.1-pro-low --print='…the task prompt…'
# → {"status":"SUCCESS","response":"","duration_seconds":12.06,
# "usage":{"total_tokens":14603},
# "denied_actions":[{"action":"command","display_name":"RunCommand"}]}
| Arm | Model | Answer | Tokens |
|---|---|---|---|
| Task, verbatim | gemini-3.1-pro-low | none | 14,603 |
| Task, no-shell instruction | gemini-3.1-pro-low | none | 13,825 |
| Task, verbatim | gemini-3.8-flash-medium | none | 11,882 |
| Control — "what is 2 plus 2?" | gemini-3.1-pro-low | 4 | 4,234 |
The control is the load-bearing row. It needs no tool, so nothing gets denied, and it comes back correct in 5.8 seconds with an empty denied_actions. The CLI works, the account works, the model answers. What fails is the specific act of looking at a file.
Every denied arm exits 0, reports status: "SUCCESS" and returns "response": "" — 40,310 tokens across the three for zero characters of output. The only human-readable warning is a stderr line — "no output produced — a tool required the command permission that headless mode cannot prompt for" — and stderr is exactly what a pipeline throws away.
The stderr message offers two ways out: an allow-rule under permissions.allow in settings.json, or re-running with --dangerously-skip-permissions. We took neither. When this site last probed this binary, --dangerously-skip-permissions was refused by this machine's own auto-mode classifier, and widening a third-party agent's permissions until the measurement comes out changes the thing being measured. The question was what this tool does unattended out of the box.
We did try the one intervention that is not an escalation. Arm two adds a sentence telling the model to read the files directly with its file tools and run no shell commands. It reached for RunCommand anyway, spent 13,825 tokens, and returned nothing — which is why we treat this as a tool-layer outcome rather than a prompt-writing problem.
What Google's agent actually serves
agy models lists fourteen models as of 2026-09-20. Eleven are Google's: Gemini 3.8 Flash, 3.7 Flash and 3.6 Flash in high, medium and low, and Gemini 3.1 Pro in high and low. Every one carries its effort level inside the model id — gemini-3.1-pro-high and gemini-3.1-pro-low are separate catalogue entries, where Claude Code takes --effort as a flag and Codex CLI takes model_reasoning_effort as a config key. Nothing on the shelf answers to a bare major version, so a search for one is a search for something the catalogue does not sell.
The other three are not Google's:
| Model | Vendor |
|---|---|
| Claude Sonnet 4.6 (Thinking) | Anthropic |
| Claude Opus 4.6 (Thinking) | Anthropic |
| GPT-OSS 120B (Medium) | OpenAI, open weights |
So you can run Claude inside Google's coding agent, but you will be running Opus and Sonnet 4.6, where Claude Code serves Opus 5 and Sonnet 5 — a major version behind, read from the two tools' own catalogues on the same day. We are not claiming the older generation is worse; nothing here measured either one's output. The narrower point is that "we use Claude" is not a complete statement about what you are running, which is the cross-vendor version of the problem three of ten --model names already have inside Claude Code alone.
What we could not measure, and did not estimate
When this comparison was priced in August, Claude Code was installed on this machine and no Gemini CLI was. So every Google figure in the pricing sections is a published one and every Anthropic figure marked "tool reports" is a measurement, and that asymmetry was printed in our check's output rather than smoothed over.
Three specific consequences:
- No output-quality ranking. We cannot run both, so we do not rank both. This is the same refusal the Claude vs GPT comparison made, for the same reason, and the preconditions it defined are still unmet here.
- Google's delivered output ceiling is unverified. 65,536 is what the page says. Whether a real session gets it is not something this machine can answer, and the row says "not installed here" rather than assuming.
- Google's cache behaviour is priced, not observed. The $4.50 per million token-hours is from the rate card. We did not watch a bill accrue.
- The headless run says nothing about Gemini's coding ability. Three empty responses are a fact about a permission prompt that cannot be shown, not about a model. Whether an allow-rule or the dangerous flag would have let the task complete is a different measurement, and so is interactive mode — everything in that run is scoped to
--print. Nor can we say whetherstatus: SUCCESSon an empty turn is a deliberate definition of success or a defect.
The one Anthropic figure we did verify independently is worth stating, because it is a correction. Priced at Anthropic's published $2/$10 rates, the session comes to $1.307322. Claude Code billed $1.960971 — exactly 1.500x, the ratio you get from $3/$2. That reproduces what the Sonnet and Opus comparison found on a much smaller turn: the tool bills Sonnet 5 at $3/$15, not the published $2/$10. This session's cache write was 325,343 tokens against that one's 11,054 — 29x the shape, and the same 1.5x discrepancy to six decimal places.
How to choose between them
- Time your sessions before you price them. If your cached context routinely lives past an hour, price Google's storage rent and not its token rate. Under 53 minutes on this shape, the metered comparison is fair.
- Price the tier you will actually be in. For agentic coding that is usually the above-200k column, which is 2.00x the one that gets quoted.
- Ignore the context-window row. A 4.86% difference between two million-token windows will never be the reason a project succeeds or fails.
- Check the output ceiling in your tool, not on the card. One vendor's card was 2x its own tool's answer here.
- Re-read both cards on a schedule, and make the schedule fail loudly. One of these vendors has already announced that a price doubles in 136 days.
Common mistakes comparing these two
- Putting one $/MTok column next to another. Tempting because both vendors publish one. The symptom is a 110x gap that reverses under a stopwatch. The fix is pricing a real token shape, cache terms included.
- Quoting the headline Gemini rate for coding work. Tempting because it is the first number on the page. The symptom is a bill twice your estimate. The fix is measuring your session's prompt length once — ours was 1.77x over the boundary.
- Treating "1M context" as one specification. Tempting because both say 1M. The symptom is a comparison that turns on 48,576 tokens nobody will notice. The fix is comparing what the tool reports, not what the marketing rounds to.
- Ranking coding quality from one side. Tempting because the reader wants a winner. The symptom is a recommendation with no measurement under it. The fix is saying which tool you have installed and refusing the rest.
- Branching on
statusalone in an automated run. Tempting because it is the field named for the job. The symptom is three SUCCESSes, 40,310 tokens and no output. The fix is checkingdenied_actions. - Treating "we use Claude" as a version. Google's shelf serves 4.6; Anthropic's serves 5.
Conclusion
Price the session, not the token. If your work is short and bursty, Gemini 3.1 Pro is meaningfully cheaper and the published gap is roughly honest; if it is long-running agentic coding on a large repository, Google's cache rent overtakes Anthropic's cache fee after 53 minutes and the above-200k tier doubles the rate you were quoted. Price your own measured session on both cards before committing either way. If you are automating, note that on 2026-09-20 Claude Code completed unattended file-reading work and Antigravity CLI did not, and that gap is a permission model rather than a model. And if quality is the deciding factor, note that neither this article nor any comparison written on one installed tool can settle it.
Frequently asked questions
Is Gemini cheaper than Claude for coding?
What is Google's 200k token pricing tier?
Does Gemini or Claude have a bigger context window?
Which model has a bigger output limit, Gemini 3 or Claude?
Can you compare Gemini and Claude on coding quality?
Can Antigravity CLI do agentic coding headlessly?
Muhammad Kashif
Founder and editor of Devventa, covering AI coding assistants, Next.js and the modern AI development stack.




