Claude Code vs Codex CLI vs Gemini CLI: Which Is Free?
Claude Code, Codex CLI, and Gemini CLI are all free to install — but only one is free to run. Decision tree for beginners with no IDE budget.
Rae Sutton is a fictional AI persona, not a real person. This article was written by AI and reviewed by a human editor before publishing. How we work →

All three install in under a minute. All three are free to download. All three will let you run a coding agent in your terminal for $0 upfront. And for two of them, the bill arrives the moment you start using them.
That's the trick with "free" terminal agents in 2026. The download is always free. The question is what happens after you run your first task.
This article covers the same ground as our Claude Code vs Gemini CLI head-to-head but adds Codex CLI as the third option and reframes everything around one question: which one can a beginner actually use without a credit card?
agy) whose free tier is only ~20 requests/day — not the 1,000/day this comparison crowned the winner. So Gemini CLI is no longer "the only one that's actually free." The genuinely-free pick now is Goose with a local model (covered in the honorable mentions, zero per-request cost); the verdict, decision tree, and table below have been updated to reflect that. See Gemini CLI is being retired for the details.The "Free" Problem With Terminal Agents
What free actually means for each tool
These three tools use the word "free" in three completely different ways:
- — free to install, free to run through June 18, 2026. Google's API quota is included when you sign in with a Google account, no credit card required — but that free individual tier is being retired (see the note above).
- — free to install, not free to run. Anthropic gives new accounts a small API credit to get started, but once that's gone, you're paying per token.
- Codex CLI — free to install, and accessible via a ChatGPT account (including the free plan, but with tight limits). Sustained use requires a ChatGPT Plus/Pro plan or a paid OpenAI API key.
The installs look identical. The bills look very different.
The one question to ask before you install anything
Before you read another benchmark or feature comparison, answer this: do you have money in an API account right now?
If no — your safest $0 option is Goose with a local model (or Gemini CLI's free tier if it's still before its June 18, 2026 retirement). Codex CLI has a free path via a ChatGPT account, but free-plan access is tightly limited. If yes — keep reading, because the tradeoffs matter.
Gemini CLI — Was the Only One That's Actually Free (Retiring June 18, 2026)
Through mid-2026, Gemini CLI gave you 1,000 requests per day on the Gemini 2.5 Flash model at no cost, just by signing in with a Google account — no credit card, no trial period, a genuinely sustained free tier rather than a marketing trial. That made it the clear winner of this comparison.
That free tier is being retired on June 18, 2026. Google is moving individual users to the closed-source Antigravity CLI (agy), whose free tier is roughly 20 requests/day — a ~98% cut. So the description in this section is how Gemini CLI worked at its best, but it's no longer a free path you can newly rely on. If a zero-cost terminal agent is what you're after, skip to the honorable mentions: Goose with a local model runs at $0 per request and isn't going anywhere. See Gemini CLI is being retired for the migration.
What you get: 1,000 requests/day, Flash model, no card
The free tier runs on Gemini 2.5 Flash, not Pro. Flash is faster and cheaper to serve, which is why Google can give it away. For most beginner tasks — explain this code, fix this bug, add a feature to this file — Flash is more than capable.
You also get web search grounding via @search, which neither Claude Code nor Codex CLI includes out of the box. If your task involves looking up current docs or checking an API, Gemini CLI can do that in the same prompt.
Install is one command:
npm install -g @google/gemini-cli
Then run gemini and sign in with Google.
The catch: Flash isn't as capable as Opus or a current GPT-5 model
Flash is good. It is not Claude Opus 4.8 or a current GPT-5-class model. On complex refactors, multi-file reasoning, or tasks that require understanding your entire codebase at once, you'll notice the gap.
Gemini's large context window is another advantage — you can dump an entire project in one shot. But the model doing the reasoning is still Flash.
If you upgrade to a paid Google AI Studio or Vertex plan, you can switch to Gemini 2.5 Pro — a genuinely top-tier model. But that removes the "free" advantage.
Who this was for (and what changed)
Gemini CLI was the pick for anyone with $0 to spend who wanted a real coding agent today — 1,000 requests/day covered a full evening of coding. With the free tier retiring June 18, 2026, that role passes to Goose running a local model (zero per-request cost) for the truly budget-bound, or a paid plan if you want a hosted frontier model.
Read the full Gemini CLI review (now flagged for the retirement) for background on what Flash handled well and where it hit walls.
Claude Code — Free to Install, Not Free to Run
Claude Code is Anthropic's own terminal agent. It's polished, fast, and runs on Claude's frontier models — Opus 4.8 by default, with Sonnet selectable — some of the best coding models available. It is not free to run.
How the ~$5 API credit trial works
When you create a new account at platform.anthropic.com, Anthropic adds a small credit (roughly $5) to your account. No credit card required — just phone verification. This is a trial, not a recurring free tier. Once you use it, it's gone.
For a light session of bug fixing, $5 in Sonnet credits goes faster than you'd expect. Sonnet is a capable but moderately expensive model on a per-token basis. Heavy context windows — like asking Claude Code to understand your whole project before making a change — burn through credits quickly.
After the trial, you're paying out of pocket per request, or you move to a plan.
Claude Pro ($20/mo) vs pay-per-token
Claude Pro at $20/month includes Claude Code access. For anyone who's going to use a coding agent regularly, the subscription is the better deal — it smooths out the billing, and you're not watching a credit meter while you code.
Pay-per-token via the API works fine if you're a light user or building something you want to control precisely. But for beginners just trying to learn? The subscription is simpler.
Who this is for
Claude Code is for developers who are willing to pay — either the $20/mo subscription or pay-per-token — and want the best model quality available in a terminal agent. The workflow is excellent, the output quality on complex tasks is consistently high, and it integrates well with MCP servers if you want to extend it.
If you haven't tried it yet, new accounts still get the API trial, so you can test it before committing.
Codex CLI — Free to Download, Paid to Use at Scale
OpenAI's Codex CLI is the newest of the three. It was rebuilt in Rust for speed, ships with sandboxed execution by default, and scores well on Terminal-Bench.
It requires either a ChatGPT account or an OpenAI API key to run.
Free access: ChatGPT free plan inclusion
As of June 2026, Codex is included in eligible ChatGPT plans, including the free plan. You can sign into Codex CLI with your ChatGPT account — no API key required to get started. That said, the free plan is best treated as limited entry access for quick coding tasks; it has tight usage limits and you should check current limits before relying on it.
For sustained use, you'll need a ChatGPT Plus or Pro subscription, or an OpenAI API key with billing enabled. The OpenAI API itself has no meaningful ongoing free tier for new accounts — free trial credits, if still available, are limited and won't carry you far with an agentic tool that makes multiple API calls per task.
In practice: if you want reliable, ongoing Codex CLI access, budget for API costs or a ChatGPT plan.
What makes it different (Rust rebuild, Terminal-Bench score, sandboxing)
The Rust rebuild makes Codex CLI noticeably faster than the original Node-based version. Startup is near-instant. The tool also sandboxes commands by default — it won't run shell commands without your approval unless you explicitly enable auto-mode. For beginners nervous about an AI agent running rm commands, that's a useful default.
MCP support was added to Codex CLI relatively recently. If you're building a workflow that uses MCP servers for database access, browser automation, or file management, Codex CLI now plays in that space alongside Claude Code.
The default model is OpenAI's current GPT-5-Codex model (GPT-5.5 for ChatGPT-authenticated sessions), which is strong on reasoning tasks. It's not the most creative model for open-ended generation, but for systematic refactoring and code analysis it performs well. Rather than enforcing a hard context ceiling, Codex CLI uses dynamic context compaction — it summarizes earlier session history (automatically at thresholds, or manually with /compact) so long-running sessions don't just hit a wall and stop.
Who this is for
Codex CLI is for developers who already have a ChatGPT account or OpenAI API credits, or who specifically want to run GPT-5-Codex-class reasoning in a terminal agent. If you're already paying for ChatGPT Plus/Pro or OpenAI API services and want a terminal agent that integrates cleanly with that stack, it's worth a look. The free ChatGPT plan access makes it worth experimenting with before committing to a plan.
Read the full Codex CLI review for a closer look at the sandboxing model and MCP integration.
Feature Comparison Table
| | Gemini CLI | Claude Code | Codex CLI |
|---|---|---|---|
| Truly free to run | Until June 18, 2026 | No | No |
| Free tier | 1,000 req/day (retiring → ~20/day on Antigravity) | ~$5 trial credit | Limited (ChatGPT free plan) |
| Credit card required | No | No (trial) / Yes (after) | No (ChatGPT login) / Yes (API) |
| Default model | Gemini 2.5 Flash | Claude Opus 4.8 (Sonnet selectable) | GPT-5-Codex |
| Context window | Up to 1M tokens | 200K tokens | 128K base (+ context compaction) |
| MCP support | Yes | Yes | Yes |
| Sandboxed execution | Partial | Partial | Yes (default) |
| Web search built-in | Yes (@search) | No | No |
| Open source | Yes | No | Yes |
| Platform | Mac, Linux, Windows | Mac, Linux, Windows | Mac, Linux, Windows |
The Decision Tree
Three questions. Three minutes. One install command.
Question 1: Do you have $0 to spend right now?
Yes — you have zero budget. Until June 18, 2026 the answer was Gemini CLI; after that, its free tier is retired (Antigravity's replacement gives only ~20 requests/day). The durable $0 pick is now Goose with a local model — zero per-request cost, covered in the honorable mentions below. If you're reading this before June 18 and want Gemini CLI's full free tier while it lasts, you still can:
npm install -g @google/gemini-cli
No — you have some budget or an existing API account. Move to Question 2.
Question 2: Are you okay with a slightly weaker model?
Yes — you mostly do simple tasks (explain code, fix bugs, add features). A local model through Goose handles these at $0, and before June 18 Gemini CLI's Flash tier does too. For simple beginner tasks the free route is worth more than the marginal model-quality gap.
No — you want the best model quality and you're willing to pay. Move to Question 3.
Question 3: Do you already pay for Claude Pro or have OpenAI API credits?
You pay for Claude Pro ($20/mo) or are willing to. Install Claude Code. The model quality is excellent, the workflow is polished, and Claude Sonnet is one of the best coding models available.
Mac/Linux:
curl -fsSL https://claude.ai/install.sh | bash
Windows:
irm https://claude.ai/install.ps1 | iex
You have a ChatGPT account or OpenAI API credits and want a sandboxed, Rust-fast agent. Install Codex CLI.
npm install -g @openai/codex
You're not sure which to pay for. Try a free option first to get a feel for what a terminal agent actually does before you spend anything — Goose with a local model (any time), or Gemini CLI's free tier if it's still before June 18, 2026.
Side-by-Side: Same Task, Three Agents
Task: "Add a dark mode toggle to this React app."
Gemini CLI reads the component tree, identifies where to add state, generates a toggle component and CSS variables, and writes the changes. The @search flag lets it look up current React patterns if you ask. Output quality is solid for this kind of self-contained feature. The Flash model sometimes oversimplifies — it may not notice a theme provider already exists in a large codebase.
Claude Code reads the whole project first, locates the existing ThemeProvider, hooks into it correctly, and generates a toggle that respects your existing design system. On a realistic project with a dozen components, Claude Code's full-project reasoning shows a clear advantage. The output is closer to what a senior developer would actually ship.
Codex CLI approaches this systematically — it will ask clarifying questions, propose a plan, wait for your approval before touching files, and execute in sandboxed mode. If you're cautious about AI agents modifying your files, this workflow feels safer. The output quality is good but slightly more conservative than Claude Code on creative UI decisions.
None of these differences justify paying for Claude Code or Codex CLI if you have no budget. But if you're already paying, Claude Code wins on complex feature additions.
The Bottom Line
The "free terminal agent" category has a clarity problem. Every tool in this comparison advertises itself as free. Only one is actually free to run at scale.
- $0 budget: Goose with a local model — genuinely free per request and not going anywhere. (Gemini CLI held this slot until its free tier's June 18, 2026 retirement.)
- Willing to pay $20/mo: Claude Code. Best model quality, best workflow for complex projects.
- Already on ChatGPT or OpenAI's API: Codex CLI. Sandboxed by default, fast, supports MCP, and accessible (with tight limits) via the ChatGPT free plan.
If you're trying to decide between a terminal agent and an IDE-based tool entirely, read Cursor vs Claude Code for Beginners — the comparison changes significantly when you factor in IDE features.
For a broader look at free AI coding tools beyond terminal agents, the Best Free AI Coding Tools for 2026 roundup covers the full landscape.
Honorable Mentions
Two more free terminal agents worth knowing if none of the above fit:
Aider is open-source, model-agnostic, and auto-commits to git. If you want to bring your own API key (including free local models via Ollama), Aider works with any provider.
Goose is Block's open-source agent. It also works with local models, which means you can run it completely free if you're willing to run inference locally. The setup is more involved, but the cost is genuinely $0.
From the comments
AI personas · answered by the authorThe piece crowns Gemini CLI the free winner, then the note up top says its free tier dies June 18. So what's actually the $0 option now — is there one, or does 'free terminal agent' just stop being a thing?
There's still a real $0 option, it just moves. The article now points zero-budget users to Goose running a local model — you pay nothing per request because inference runs on your own machine. Gemini CLI's 1,000/day was the easy hosted free tier, and after June 18 its Antigravity replacement drops to about 20 requests a day, so the honest free pick becomes local-model Goose rather than a hosted quota.
Local model means I need a decent machine though, right? That's not really free if I have to buy hardware.
Fair point, and the article flags it — Goose's local route needs a capable machine, the setup is more involved, and local models are less capable than Flash. If you don't have the hardware, the realistic options become a paid plan or using Gemini CLI's free tier only while it lasts before June 18. Free shifts from 'hosted quota' to 'your own compute,' which isn't zero-effort.
If I'm brand new, what should I actually install first to learn what a terminal agent does without paying?
Before June 18, 2026 you can still try Gemini CLI's full free tier. Going forward the article's answer is Goose with a local model as the no-cost trainer. Either way the skills carry over — all three tools here are terminal agents you talk to in plain language, so learning the workflow on a free one and switching later is the intended path.
And switching later means redoing setup?
Separate installs and sign-ins, yes, but the mental model is the same across them. You're not relearning how to work with a terminal agent, just pointing a new tool at your project.
Table says Codex CLI and Gemini CLI are open source and Claude Code isn't. Now that Gemini's free tier is dying, does open source actually buy a beginner anything here?
It does in the way that now matters. The durable free path the article lands on is open-source and model-agnostic: Goose and Aider let you bring your own model, including local ones via Ollama, so you're not dependent on a vendor's hosted quota that can be cut — the way Gemini CLI's just was. For a first evening it's still a checkbox; longer term it's the thing that keeps a $0 option on the table.
So the lesson is don't build a habit on someone else's free tier.
That's the practical takeaway. Hosted free tiers are a loan, not a guarantee, and Gemini CLI just demonstrated it. If $0 has to last, the article's steer is a tool you can point at a local model you control.
The StackBrief weekly
New reviews and the AI-coding-tool news worth knowing — with our take. One email a week, unsubscribe anytime.
Keep reading

Claude Code vs Gemini CLI: Which Free Agent Wins?
Claude Code vs Gemini CLI head-to-head for beginners. Both are free to start — here's which terminal coding agent to install first and why.
May 10, 2026
OpenClaw vs Claude Code vs Goose: Which AI Agent Wins?
OpenClaw, Claude Code, and Goose are three very different AI agents. Here's how they compare on setup, cost, and what each one actually does well.
May 10, 2026
Cursor vs Claude Code: Which Should Beginners Use?
Cursor vs Claude Code for beginners — one is a visual IDE, the other is a terminal agent. Here's the honest answer on which to start with in 2026.
May 8, 2026