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?
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. Google's API quota is included when you sign in with a Google account. No credit card ever required.
- — 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 currently accessible via a ChatGPT account (including free plan, on a temporary basis). 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 — Gemini CLI is your safest option in this group. Codex CLI has a temporary free path via a ChatGPT account, but that access is time-limited and subject to change. If yes — keep reading, because the tradeoffs matter.
Gemini CLI — The Only One That's Actually Free
Gemini CLI gives 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. No quota that resets after 30 days and leaves you stranded.
That's a genuinely sustained free tier, not a marketing trial.
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 Claude Sonnet or GPT-4o
Flash is good. It is not Claude Sonnet 4.5 or GPT-4o. 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 is for
Gemini CLI is for anyone who has $0 to spend right now and wants to start using a real coding agent today. It's also for learners and hobbyists who run the tool occasionally — 1,000 requests/day is enough for a full evening of coding.
Read the full Gemini CLI review if you want a deeper look at what Flash handles well and where it hits 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 Sonnet — one 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: temporary ChatGPT free plan inclusion
As of May 2026, OpenAI has temporarily included Codex access in the ChatGPT free plan. You can sign into Codex CLI with your ChatGPT account — no API key required to get started. That said, this is explicitly a temporary offer; free plan access has rate limits and is subject to being removed.
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 o4-mini, 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.
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 o4-mini-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 temporary free ChatGPT 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 | Yes | No | No |
| Free tier | 1,000 req/day | ~$5 trial credit | Temporary (ChatGPT free plan) |
| Credit card required | No | No (trial) / Yes (after) | No (ChatGPT login) / Yes (API) |
| Default model | Gemini 2.5 Flash | Claude Sonnet | o4-mini |
| Context window | Up to 1M tokens | 200K tokens | 128K tokens |
| 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. Install Gemini CLI. It's the only one in this group with a real, sustained free tier. Stop here.
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). Gemini CLI on Flash is fine. The free tier is worth more than the marginal model quality gap for most beginner use cases. Stick with Gemini CLI.
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. Use Gemini CLI's free tier first. Get a feel for what a terminal agent actually does before you spend anything.
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: Gemini CLI, full stop. 1,000 requests/day on Flash is enough to build real things.
- 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 temporarily accessible 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.
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
Gemini CLI Review: Google's Free Terminal Coding Agent
Gemini CLI is Google's free open-source terminal coding agent. Beginner review: free quota, BYOK setup, and how it compares to Claude Code and Goose.
May 10, 2026