Claude Code vs Codex vs Gemini CLI Compared
You’ve picked an AI coding agent — or maybe you’re still deciding. Either way, you’re wondering how Claude Code, Codex CLI, and Gemini CLI actually compare when you use them day after day on real projects.
This isn’t a feature matrix. I’ve used all three extensively on greenfield features, multi-file refactors, bug hunts, and documentation runs — real projects, not toy demos. What follows is an honest take on the three things that matter most: code quality, cost, and speed.
Quick answer: Claude Code is the one I’d pick if forced to choose. Using more than one can help too, but only when each agent has a clear role.
Update — July 2026: On June 18, Google stopped serving Gemini CLI requests through personal Google accounts, including Gemini Code Assist for individuals and Google AI Pro/Ultra, and directed those users to Antigravity CLI. A separate unpaid Gemini API-key route remains at 250 requests per day with Flash models; organization Code Assist plans and paid API or Vertex AI access also remain. The performance observations below refer to Gemini CLI before the consumer-account transition.
The GPT-5.5 observations below are historical too. Model defaults, agent harnesses, service load, and network conditions have changed since these sessions, so treat the qualitative rankings as dated personal experience rather than controlled benchmarks.
What Each Agent Actually Is
All three are terminal-based AI coding agents. They read your files, understand your codebase, write code, run commands, and iterate on their own output. They’re not autocomplete — they’re autonomous agents that tackle multi-step tasks end to end.
Claude Code is Anthropic’s proprietary agentic coding tool, powered by Claude Opus and Sonnet. It stands out for deep codebase understanding and convention-aware code generation. It runs locally and talks to Anthropic’s API.
Codex CLI is OpenAI’s open-source command-line agent. When you do not select a model, Codex uses a recommended model; as checked July 29, 2026, the default Power setting uses GPT-5.6 Sol with medium reasoning. GPT-5.4 mini remains available for lower-cost work. Codex runs locally, reads files, executes shell commands, and handles multi-file changes.
Gemini CLI is Google’s open-source terminal agent, built on the Gemini model family. After the consumer-account transition described above, supported routes include an unpaid Flash-only API key, organization licenses, and paid API or Vertex AI access.
What they share: point any of them at a codebase, describe a task in plain English, and they’ll work autonomously. The differences are in how well they do it.
Code Quality: Where It Matters Most
This is the dimension that determines whether an AI agent saves you time or creates cleanup work.
Understanding Intent
Claude Code consistently grasps what you’re trying to accomplish, not just what you literally typed. Ask it to “add error handling to the API layer” and it’ll consider retry logic, meaningful error messages, and proper HTTP status codes — without being told.
Codex CLI was strong here too in my GPT-5.5 sessions. It generated correct, working code reliably. Where it occasionally fell short was nuance — it might add error handling that’s technically correct but doesn’t follow the patterns your codebase already uses.
Gemini CLI produces more literal interpretations. It does what you asked, but you may need to be more explicit about surrounding concerns.
Complex Refactors
Multi-file changes are the real stress test. Claude Code handles these best — it tracks dependencies across files, updates imports, and modifies tests to match. I’ve thrown 15-file refactors at it and gotten clean, reviewable diffs.
Codex CLI manages multi-file work well, though it occasionally misses a reference in a file it didn’t initially identify as relevant. Gemini CLI can handle multi-file tasks but sometimes needs the work broken into smaller pieces.
Edge Cases
Claude Code anticipates edge cases proactively. It adds null checks, handles empty arrays, and considers race conditions without being prompted. This saves real review time.
Codex CLI handles the happy path well and catches obvious edge cases, but the subtle ones sometimes slip through. Gemini CLI tends to stick to the happy path unless you explicitly prompt for edge case coverage.
Following Existing Conventions
This is where Claude Code pulls ahead most clearly. It picks up on naming conventions, error handling patterns, file structure, and testing style. The output reads like a team member wrote it.
A concrete example: I asked all three to add a caching layer to an Express API. Claude Code matched the existing middleware pattern, used the same error wrapper the codebase already had, and added tests following the existing test structure. Codex CLI wrote a correct caching middleware but used a different pattern. Gemini CLI produced working code that needed restructuring to fit in.
The bottom line: all three produce functional code, but Claude Code requires the least reviewing AI-generated code before merging. Codex is close and improving fast. Gemini is capable but demands more review cycles.
Cost & Pricing
Pricing models differ significantly. Here’s the breakdown:
| Claude Code | Codex CLI | Gemini CLI | |
|---|---|---|---|
| Free tier | None for Claude Code | Limited Codex access on ChatGPT Free | 250 req/day with an unpaid Gemini API key (Flash only) |
| Subscription | Pro $20/mo; Max from $100/mo | Plus $20/mo; Pro $100/mo (5x) or $200/mo (20x) | Consumer-account Gemini CLI access ended; organization Code Assist plans remain |
| API input | $2/MTok introductory, then $3 (Sonnet 5); $5 (Opus 5) | $0.75/MTok (GPT-5.4 mini); $5/MTok (GPT-5.6 Sol) | $1.25/MTok up to 200K; $2.50 above 200K (Gemini 2.5 Pro) |
| API output | $10/MTok introductory, then $15 (Sonnet 5); $25 (Opus 5) | $4.50/MTok (GPT-5.4 mini); $30/MTok (GPT-5.6 Sol) | $10/MTok up to 200K; $15 above 200K (Gemini 2.5 Pro) |
MTok = per million tokens. Base prices and access status were checked July 29, 2026 against official Anthropic, OpenAI subscription, OpenAI API, and Google sources. Sonnet 5’s $2/$10 rates are introductory through August 31, 2026; standard pricing is $3/$15 afterward. GPT-5.6 Sol requests above 272K input tokens cost 2x input and 1.5x output for the full request. Gemini 2.5 Pro uses the higher rates above 200K prompt tokens. Caching, batch, regional, and tool charges can differ.
API spend varies with model, context size, cache behavior, reasoning, and tool use. Claude’s paid-plan activity across its apps and Claude Code draws from shared rolling session and weekly limits; optional usage credits continue at standard API rates. Compare your own usage dashboard with the plan price instead of assuming a universal break-even point.
Codex has limited access on ChatGPT Free, with larger allocations on paid plans. For API use, GPT-5.4 mini is a lower-cost Codex option, while GPT-5.6 Sol is the current frontier coding model. At the standard API rates checked above, Gemini 2.5 Flash costs less per token than GPT-5.4 mini, so the right budget choice depends on which agent and capability your task needs.
There is no defensible universal daily cost for these agents. Measure the same representative tasks with provider usage dashboards, then compare retained output and review time—not token price alone.
Speed & Responsiveness
A few seconds of latency per interaction compounds across dozens of agent turns in a session. These are dated observations from sessions using Claude Opus and Sonnet, Codex GPT-5.5, and Gemini CLI before its consumer transition—not a controlled benchmark. Region, network, provider load, reasoning settings, tools, and repository size can change the result.
Time to first token. In those sessions, Codex CLI with GPT-5.4 mini was the quickest to start producing output. Claude Code with Sonnet was similarly fast. Opus took longer, and Gemini CLI had noticeable startup overhead before the model began responding.
Throughput on large tasks. In that sample, Claude Code with Opus was slower per turn but often finished complex tasks in fewer total turns. Codex CLI was fast across the board. Gemini CLI was quick for straightforward work but sometimes needed more back-and-forth on complex tasks.
The speed vs. quality trade-off. In my sample, faster responses did not always reduce time to merge because extra review cycles sometimes erased the gain. Slower Opus responses that needed less correction sometimes finished sooner overall.
When it matters. I weight response speed more heavily for bounded tasks such as a utility function, a test, or a type-error fix. For multi-file refactors, architectural changes, and tricky bugs, I put more weight on correctness and review effort.
Quick Comparison
| Dimension | Claude Code | Codex CLI | Gemini CLI |
|---|---|---|---|
| Code quality | Excellent | Strong | Good |
| Cost | Moderate–High | Low–High by model and access route | Low–Free via API key |
| Speed | Moderate (Opus) / Fast (Sonnet) | Fast | Moderate (startup overhead) |
| Complex tasks | Excellent | Good | Fair |
| Codebase awareness | Excellent | Good | Fair |
| Free option | No Claude Code free tier | Limited via ChatGPT Free | Unpaid Flash-only API key (see quota note above) |
Better Together
Here’s what I actually do: I run all three.
If Claude Code and Codex are the two agents in your stack, the practical guide to using Claude Code and Codex together covers task fan-out, handoffs, cross-review, and racing.
Claude Code gets the hard stuff — complex refactors, architectural decisions, tasks where getting it right the first time matters more than speed. It’s the agent I trust most with gnarly work.
Codex CLI handles the middle ground — feature implementation, test writing, API integrations. Reliable, fast, and cost-effective for everyday development.
Gemini CLI takes the straightforward tasks — boilerplate, documentation, and simple bug fixes. For no-cost use, use the supported unpaid API-key route described above.
The trick is running them in parallel. Rather than queuing tasks sequentially, I give each agent its own task in a separate git worktree and run them in separate working copies. While Claude Code is working through a complex refactor, Codex CLI can write tests and Gemini CLI can update docs. When the tasks are genuinely independent, concurrent execution can reduce elapsed time when provider quotas and local resources have capacity; separate sessions still repeat some repository orientation and context loading. The cost guide explains that trade-off.
This is why I built Parallel Code. It creates isolated worktrees for each agent, lets you monitor them from a single dashboard, and handles branch management automatically. That means less manual branch switching, no shared working-copy collisions, and less idle waiting; branches can still conflict when their changes are integrated.
Conclusion
If I had to pick one, it would be Claude Code. The code quality advantage compounds — less review, fewer bugs, better alignment with your conventions.
Using more than one can reduce elapsed time when the work is genuinely independent and provider quotas and local resources have capacity. In that situation, match each tool to a clear role: Claude Code for the hard problems, Codex CLI for everyday work, and Gemini CLI through one of its currently supported access routes for quick wins.