Gemini CLI vs Claude Code: what changed in 2026
Gemini CLI lost its free tier in June, and both tools now run 1M-token models. What still separates them, and how to use Gemini models inside Claude Code.
This comparison used to be easy to summarise: Gemini CLI had the generous free tier and the bigger context window, Claude Code had the better agent loop. Two of those three things changed in 2026, so most of the old advice is now wrong.
What changed
Gemini CLI's free tier is gone. On June 18, 2026, Google stopped serving Gemini CLI and the Gemini Code Assist IDE extensions to people using them free of charge, and to Google AI Pro and Ultra subscribers. Google points those users to Antigravity CLI instead. Gemini CLI still works with a paid Gemini API key, a Gemini Enterprise Agent Platform key, or a Gemini Code Assist Standard or Enterprise licence. The details, and what is still free, are in Gemini CLI's free tier is gone.
The context-window gap closed. Gemini 3.1 Pro has a window of about one million tokens. Claude Code now runs Sonnet 5 and later, and Opus 4.7 and later, with a 1M window on every plan, Pro included, and compacts at about 967K tokens by default.
So the two arguments that used to favour Gemini CLI -- cost and size -- no longer separate the tools. What is left is the question that always mattered more.
Where the agent loop matters
Claude Code's advantage is what happens across a long autonomous run. Reading the right files rather than all of them, deciding what to change, running the tests, interpreting the failure, and fixing it without being told to. On a multi-file change with a test suite to satisfy, that difference compounds over twenty steps.
When your problem is "this is genuinely hard", the loop matters more than the window.
Where a large window still helps
Holding a whole repository or a huge log in context is no longer something only one side can do. The difference is what it costs. On the Gemini API, Gemini 3.1 Pro Preview is $2 per million input tokens up to 200K tokens and $4 above, with no free tier, while the Flash models (3.5 to 3.8) have a free tier. Claude Sonnet 5.5 is $2 per million input tokens on Anthropic's API.
If your job is reading a lot of material once, a free-tier Flash model is the cheapest way to do it. If it is changing code across a long run, the loop decides.
The distinction in practice
| Your task | Better fit |
|---|---|
| Understand an unfamiliar large repo | Either; both hold around a million tokens |
| Sift a huge log once, at no cost | A free-tier Gemini Flash model, in whichever tool |
| Multi-file refactor with tests to satisfy | Claude Code |
| Debug something subtle | Claude Code |
| Bulk mechanical edits | Either; use the cheaper model |
| No budget and no setup time | Neither CLI as-is: Antigravity CLI's free plan, or Claude Code pointed at free backends |
A large window does not make an agent better at deciding what to do. A good loop does not let it read more than it can hold. They are different capabilities and the marketing for both blurs it.
Rate limits differ in character
Gemini CLI on an API key inherits the Gemini API's limits, which apply per project: requests and tokens per minute, plus requests per day that reset at midnight Pacific time. An agent sends many more requests per minute than a chat session, so per-minute 429s during an autonomous run are normal, especially on a free-tier project (telling the two 429s apart).
Claude Code on a subscription bites differently: a rolling five-hour usage window plus a weekly cap, shared with Claude on the web and desktop. You hit those as a usage-limit message that names a reset time, rather than as per-minute errors.
You do not have to pick
Claude Code reads ANTHROPIC_BASE_URL, so it can be pointed at a router that carries Gemini models too:
npm install -g @sifxprime/krouter
krouter -t
export ANTHROPIC_BASE_URL=http://localhost:20128/v1
export ANTHROPIC_AUTH_TOKEN=<your-krouter-key>Connect a Gemini API key and a Claude-serving backend, and the same agent loop can reach either: gemini/gemini-flash-latest on a free-tier key, gemini/gemini-3.1-pro-preview on a paid one. An Antigravity sign-in also carries Gemini 3.1 Pro (ag/gemini-pro-agent), but it is a subscription login that is not licensed for router use, and kRouter shows a risk notice before you connect it.
One setting to get right: Claude Code assumes a context window from the model's name, and a name like gemini/gemini-3.1-pro-preview is not one it knows. kRouter's Claude Code card under CLI Tools has a max-context setting that writes CLAUDE_CODE_MAX_CONTEXT_TOKENS for you (why it matters).
That setup gives you Claude Code's loop with a Gemini model when the task suits one -- which is the combination the comparison is really pointing at.
Choosing
Gemini CLI if your organisation already has a Code Assist Standard or Enterprise licence or a paid Gemini API project, and you want Google's own CLI on top of it.
Antigravity CLI if you want Google's agent on a personal account, since that is where Google moved free and Google AI Pro users.
Claude Code if your tasks are long autonomous runs with tests, and you either have a subscription or are willing to spend half an hour pointing it at a backend you already hold.
Both if you would rather match the model to the task than argue about which tool is better in general.
Common questions
Is Gemini CLI free?
Not any more for personal accounts. Since June 18, 2026, Google no longer serves Gemini CLI to free users or to Google AI Pro and Ultra subscribers, and points them to Antigravity CLI. It still works with a paid Gemini API key, an Enterprise Agent Platform key, or a Code Assist Standard or Enterprise licence.
Does a bigger context window make a better coding agent?
No. It makes a better large-input tool. Agent quality is about the loop -- deciding what to read, what to change, and how to interpret a failure. And in 2026 both sides have around a million tokens anyway.
Can Claude Code use Gemini models?
Not directly, but it can through a translating endpoint. It speaks the Anthropic Messages API, so a router in front can serve Gemini behind that interface. Set the context window for the model name, or Claude Code will compact too early or too late.
Why do I hit 429 immediately with Gemini?
Per-minute limits on the Gemini API are sized for interactive use, and they are lower on a free-tier project. An agent sends far more requests per minute, so this is expected rather than a fault. Check retryDelay to confirm it is a rate limit rather than an exhausted daily quota.
Which is cheaper overall?
It depends on the model, not the tool. Gemini Flash models on a free-tier API project cost nothing within their limits; Gemini 3.1 Pro has no free tier. Once you are paying for either, the difference narrows and the task fit matters more than the price.
Related
Published by Kodelyth, the team that builds kRouter. Posts are drafted with AI assistance and reviewed by a person before they go out. kRouter is free and MIT licensed.
Install kRouterRelated posts
- ComparisonsClaude Code vs Codex CLI: same job, different guardrailsBoth read your repo, edit files and run commands. They differ in how they act without asking, what they cost, and how you point them at other models.
- ComparisonsClaude Code vs Cursor in 2026: agent, editor, and the billClaude Code is an agent that lives in your terminal; Cursor is an editor with a usage pool. What actually differs in 2026, what each costs, and using both.
- ComparisonsClaude Code with GLM, Kimi or DeepSeek: setup and trade-offsGLM-5.3, Kimi K3 and DeepSeek V4 can all drive Claude Code. What each costs, which slot each suits, what breaks, and when you need a router.
Relevant docs
- Getting StartedInstall kRouter, connect a first provider, and point Claude Code, Codex or any OpenAI-compatible tool at it. Takes about five minutes.
- Core conceptsProviders, combos, account routing, token savers, MITM mode, quota tracking, the response cache and remote access: the eight ideas behind kRouter.
- ProvidersConnect 95+ AI providers to kRouter: OAuth subscriptions, free services, free-tier and pay-per-token API keys, and browser-cookie logins.