TL;DR

Claude Code and Codex CLI are the two dominant terminal-based AI coding agents in 2026. Claude Code now defaults to Opus 5.5, which Anthropic reports at 66.4% on Terminal-Bench 4.0 against 57.9% for OpenAI’s GPT-6 Astra, and it has won the blind code-quality comparisons published so far. Codex CLI runs OpenAI’s GPT-6 family, still spends fewer tokens per task (though the famous 4x gap has shrunk to roughly 1.2x in Composio’s newer eval), and is fully open source under Apache 2.0. Both start at $20/month, and both now have a $100 tier for heavy users. My pick is to use both: Claude Code for architecture and frontend, Codex CLI for DevOps and batch work where token spend adds up.

Models, plan prices and benchmarks last verified: November 3, 2026.

Why This Comparison Matters Now

Terminal coding agents have become the default for serious dev work. IDE extensions like Copilot still exist, but the real action has shifted to agents that read your entire codebase, run shell commands, and ship pull requests while you step away.

Two tools own this space: Anthropic’s Claude Code and OpenAI’s Codex CLI. They approach the same problem from opposite directions. Claude Code optimizes for correctness and deep reasoning. Codex CLI optimizes for speed and autonomous execution.

Both have moved several model generations since this comparison was first written in April, when Claude Code ran Opus 4.6 and Codex ran the GPT-5.3/5.4-Codex line. Per the Claude Code model docs, the default model is now Opus 5.5 on every paid plan and on the API, with Sonnet 5.5 and Haiku 5.5 behind the sonnet and haiku aliases and Fable 5.2 (launched November 9, 2026) behind fable. The Codex models page lists GPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra and GPT-6 Luna. GPT-5.5 left Codex for ChatGPT sign-in on October 14, 2026. For a model-level ranking across vendors, the best AI models for coding guide covers the current tiers; the older GPT-5.4 vs Claude Opus 4.7 vs Gemini 3.1 Pro comparison is kept as a snapshot of the spring generation.

Benchmarks: The Numbers That Matter

BenchmarkClaude Code sideCodex CLI sideEra / source
Terminal-Bench 4.066.4% (Opus 5.5, xhigh)57.9% (GPT-6 Astra, high; OpenAI-reported)Current, Anthropic’s Opus 5.5 launch
SWE-bench Verified~81% (Opus 4.6)~80% (GPT-5.4)April 2026
SWE-bench Pro~55% (Opus 4.6)57.7% (GPT-5.4)April 2026
Terminal-Bench 2.065.4% (Opus 4.6)77.3% (GPT-5.3-Codex)April 2026
Blind plan duels8 of 12 decided (67%)3 of 12 decided (25%)Blake Crosley, Feb 2026

The top row is the only current-generation head-to-head, and both numbers are vendor-reported. Anthropic ran Opus 5.5 at xhigh effort with production safeguards on, and quotes the GPT-6 Astra score as OpenAI reported it, at high effort. The standard error on the Opus 5.5 figure is about ±2.6 points, so the 8.5-point gap is larger than the noise but not something an independent lab has confirmed yet.

That row flips the story the April table told. On the spring models, Codex led Terminal-Bench 2.0 by about 12 points, and SWE-bench Verified was a statistical tie at ~80%, which is why OpenAI leaned on SWE-bench Pro, where GPT-5.4 led by a couple of points. Terminal-Bench 4.0 is a different, harder suite, so the two Terminal-Bench rows aren’t directly comparable. Still, the claim that Codex owns terminal tasks no longer has current numbers behind it.

The blind-test row deserves a caveat. Blake Crosley ran 36 Alpha/Beta duels in which a judge scored each tool’s plan without knowing which agent wrote it; 13 produced structured verdicts, and Claude Code won 8 of the 12 that were decided. That’s one developer’s setup on plan quality, not a large study of finished code. It matches the wider forum consensus that Claude Code writes cleaner, more idiomatic code, but treat it as a data point rather than a verdict.

Token Efficiency: The Hidden Cost Multiplier

The “Codex uses 4x fewer tokens” line that circulates in every comparison traces back to one test. In Composio’s September 2025 head-to-head, run with Sonnet 4 against GPT-5 (medium), Claude Code consumed 6,232,242 tokens on a Figma-to-code clone while Codex used 1,499,455, a bit over 4x. On a smaller scheduler task the ratio was about 3x (234,772 vs 72,579).

Composio has since rewritten that comparison for the current models, and the gap shrank a lot. Across its 47-workflow “Golden Eval” (August 2026), Fable 5 in Claude Code averaged 276,957 runtime tokens per workflow and GPT-5.6 Sol (high) in Codex averaged 223,779. That’s roughly 1.2x, not 4x. Composio sells the MCP tooling used in both tests, and neither covers Opus 5.5 or the GPT-6 family, so treat the exact multiplier as soft. Codex still comes out leaner; it’s just no longer a different league.

The gap that remains comes from how each agent reasons. Claude Code tends to “think out loud.” It reads more files, considers more context, and generates longer reasoning chains before acting. That produces better code on average but burns tokens doing it. Codex CLI is more surgical: it reads what it needs, acts, and moves on.

At 1.2x, a single task barely notices. Across a full day of agent runs on a metered plan, a 20% difference is still the gap between finishing inside your limits and hitting the wall an hour or two early.

Pricing: What You Actually Pay

Both tools start at $20/month, but the tiers above that, and what they include, have changed a lot since spring.

Claude Code Plans

PlanPriceWhat You Get
Pro$20/mo ($17/mo billed annually)5-hour and weekly usage limits. Anthropic doubled the 5-hour limits on May 6, 2026 (reported)
Max$100/mo5x Pro usage, plus $100/mo in Claude API credits (not spendable on Claude Code itself)
Ultra (formerly Max 20x)$200/mo10x Pro usage per week, no 5-hour limit for verified accounts, plus $200/mo in API credits
API (Sonnet 5.5)Pay-per-token$2/$10 per 1M input/output tokens
API (Opus 5.5)Pay-per-token$4/$20 per 1M input/output tokens
API (Fable 5.2)Pay-per-token$8/$40 per 1M input/output tokens

Prices come from claude.com/pricing and the Claude API pricing docs. The Sonnet 5 price that was once billed as introductory is now permanent; the $3/$15 increase planned for September 2026 was cancelled. The Claude Code Pro vs Max breakdown walks through what the Max API credits do and don’t cover.

Codex CLI Plans

PlanPriceWhat You Get
Free / Go$0 / $8/moGPT-6 Luna in the Codex desktop app, subject to rollout
Plus$20/moPer 5 hours: roughly 15-160 local messages on GPT-6.1 Sol, 35-285 on GPT-6.1 Terra, 350-3,000 on GPT-6 Luna
ProFrom $100/mo ($100, $200 or $500)No five-hour limit at present; Ultrafast mode on the $500 plan
Business$20/user/mo annual ($25 monthly)Plus-level limits with admin controls and data privacy
APIPay-per-tokenGPT-6.1 Terra $1/$5, GPT-6.1 Sol $2/$10, GPT-6 Luna $0.10/$0.50, GPT-6 Astra $10/$50

Plan data is from the Codex pricing page; API rates are from OpenAI’s API pricing. The old codex-mini SKU this table used to list is no longer on OpenAI’s pricing page.

The headline prices look similar, but the economics diverge. On the API, GPT-6.1 Sol costs exactly what Sonnet 5.5 costs ($2/$10), and GPT-6.1 Terra is half that at $1/$5. Combine Terra’s price with Codex’s lower token use and the per-task API bill can land at a fraction of Claude’s, although Terra is positioned for speed rather than the hardest reasoning work.

For heavy daily use, both vendors now point you at a $100 tier. Claude’s Max (the plan formerly called Max 5x) buys 5x Pro capacity plus API credits for your other projects; Codex’s entry Pro tier currently removes the five-hour limit altogether. Which is the better deal depends on whether your bottleneck is the rate limit or the model. The real cost of Cursor vs Copilot piece runs the same subscription-vs-API math for IDE tools.

Security: Two Sandboxes, Two Defaults

A year ago these tools had opposite security models. They’ve converged on the mechanism but still differ on the default.

Codex CLI sandboxes at the OS level out of the box. Per its approvals and security docs, it uses Seatbelt policies via sandbox-exec on macOS and bwrap plus seccomp on Linux (Landlock, which earlier versions used on Linux, survives only as a legacy path). In a version-controlled folder the default preset is “Auto”: workspace writes allowed, approval requested for anything outside that. To let it run unattended while keeping the sandbox:

codex --sandbox workspace-write --ask-for-approval never \
  "migrate every test in tests/ from unittest to pytest"

The escape hatch is --dangerously-bypass-approvals-and-sandbox (alias --yolo), which the docs mark as not recommended.

Claude Code has its own OS-level sandbox now, but it’s off by default. The sandboxing docs describe Seatbelt on macOS and bubblewrap plus socat on Linux and WSL2, built on the open-source @anthropic-ai/sandbox-runtime package. Native Windows runs commands unsandboxed. You turn it on with /sandbox in a session or in settings:

{
  "sandbox": {
    "enabled": true,
    "failIfUnavailable": true,
    "allowUnsandboxedCommands": false
  }
}

The last two keys matter more than they look. Without failIfUnavailable, Claude Code silently falls back to unsandboxed execution if a dependency is missing. Without allowUnsandboxedCommands: false, Claude can ask to rerun a failed command outside the sandbox. The sandbox also covers only shell commands: the built-in file tools, hooks and local MCP servers run outside it and fall back on permission rules in settings.json. Plan mode still shows proposed changes before execution, and for tighter blast-radius control on side tasks you can push work into a Claude Code subagent with a scoped tool list.

In practice, Codex is still harder to misconfigure, because the safe setup is the one you get without touching anything. Claude Code can be locked down just as tightly, but only if you opt in and set the two strict flags above.

Where Each Tool Wins

Each tool has situations where it’s the obvious pick.

Claude Code is better for:

Frontend and UI work. Claude Code handles React, CSS, and design-to-code tasks with better results. In Composio’s 2025 Figma test, Claude Code captured the layout but missed the theme colors, while Codex ignored the design and built an original page. Codex output tends to work but misread layout intent.

Multi-file feature planning. Plan mode reads broadly, asks clarifying questions, and proposes changes across the codebase as a coherent unit, which is exactly what Crosley’s plan duels scored. Codex tends to go file-by-file.

Complex debugging. Claude Code’s deeper reasoning chain pays off when the bug isn’t obvious. It correlates symptoms across files better than Codex does, and the extra tokens are cheap compared with an afternoon of bisecting.

Context-heavy workflows. Claude Code has the larger MCP and plugin ecosystem, and its hooks and subagents make it easy to wire in Jira, Notion, databases or custom APIs. Codex CLI supports MCP too (STDIO and streamable HTTP servers, with OAuth), so the gap is ecosystem depth rather than capability. The AI agent protocols guide covers how MCP, A2A and ACP fit together, and FastMCP in Python shows how to build one server that Claude Code, Codex, and Cursor can all consume.

Codex CLI is better for:

Running Codex unattended for batch migrations is where it shines. Hand it a list of tasks with --ask-for-approval never and walk away; the default-on sandbox means a bad command can’t reach outside the workspace.

Shell scripts, Dockerfiles, CI configs, deployment pipelines. Codex’s terminal edge was clearest on the spring models (77.3% vs 65.4% on Terminal-Bench 2.0). On the current suite Anthropic reports Opus 5.5 ahead, so this is now more about speed and token cost on routine shell work than about raw accuracy.

If you’re running agents on every PR in a large monorepo, token costs add up fast. Codex’s leaner token use plus GPT-6.1 Terra’s $1/$5 pricing matters at that scale.

And Codex CLI itself is Apache 2.0 with over 130,000 GitHub stars, and it still ships often (v0.166.0 landed October 29). You can fork it, extend it, audit it. Claude Code is proprietary, although its sandbox runtime is open source.

The “Use Both” Strategy

The developer consensus in forums is that the best workflow is routing tasks to the right tool.

A pattern that works:

  1. Start with Claude Code for the architecture pass: plan mode, review the proposed structure, iterate on the design
  2. Switch to Codex CLI for implementation: autonomous execution of well-defined tasks
  3. Back to Claude Code for frontend and UI polish, where code quality and visual accuracy matter
  4. Codex CLI for CI/CD, tests, and deployment, where speed and token cost win over reasoning depth

Each tool has strengths that the other lacks. Using only one means leaving performance on the table.

What About Gemini CLI?

Google’s Gemini CLI launched with Gemini 2.5 Pro and scored competitively on some benchmarks, but it never got past a clear third place: smaller community, fewer MCP integrations, and less tooling around it. Our Gemini CLI tutorial documents the setup as it worked then.

Update: Google retired Gemini CLI for individual users on June 18, 2026, replacing it with the closed-source Antigravity CLI, which ships with aggressive rate limits. See the Antigravity CLI vs Claude Code vs Codex CLI comparison for the full breakdown.

A note on Codex’s other surface area: OpenAI shipped a major update to the Codex desktop app on April 16 that added computer use, persistent memory, and 90+ plugins. You can launch it from the CLI with codex app. The CLI is still the comparison point above; the desktop app now plays in a different category.

FAQ

Is Claude Code or Codex CLI better for beginners?

Claude Code. Plan mode lets you review changes before they’re applied, and the agent explains its reasoning more thoroughly. Codex CLI’s safe defaults are better, but its terse style assumes you know what you’re asking for.

Can I use both Claude Code and Codex CLI on the same project?

Yes. They don’t conflict. Both are terminal tools that read your local codebase. Some developers run Claude Code for planning and Codex CLI for execution in the same session.

Which uses fewer tokens, Claude Code or Codex CLI?

Codex CLI, but by less than it used to. Composio’s 2025 Figma-clone test had Codex at about a quarter of Claude Code’s tokens (1.5M vs 6.2M). Its August 2026 rerun across 47 workflows put the gap at roughly 1.2x (about 224K vs 277K average tokens).

Is Codex CLI really free?

The CLI itself is open source and free to install. But it needs model access, either through a ChatGPT plan (Plus at $20/mo, Pro from $100 to $500/mo, Business per seat) or direct API billing. You’re paying for the model, not the tool.

Which is better for Python and Go development?

Both handle Python and Go well. Claude Code has a slight edge on complex Python projects, particularly tracking imports and type hints across large codebases. For Go, Codex CLI’s lower token usage pairs well with the language’s explicit, less-verbose style.

How do the security models compare?

Both now use OS-level sandboxes (Seatbelt on macOS, bubblewrap on Linux). Codex turns its sandbox on by default; Claude Code’s is opt-in via /sandbox, and its file tools, hooks and MCP servers run outside it. Codex is safer out of the box; Claude Code can match it with failIfUnavailable and allowUnsandboxedCommands: false.

Whichever CLI you pick, the daily patterns transfer — Claude Code workflows collects the ones that stuck.

Sources

Bottom Line

If I could only pick one, I’d pick Claude Code for the higher code quality, the better frontend handling, and, on the current models, the stronger reported Terminal-Bench score. But I’d resent the limitation. The token gap has narrowed but hasn’t closed, Codex’s safe-by-default sandbox is the better design, and there are entire categories of work (autonomous tasks, DevOps, CI pipelines) where Codex CLI is the cheaper tool for the same result.

The real question is whether paying for both is worth it compared with the productivity gain. With both vendors now selling a $100 heavy-use tier, the combined bill is lower than it was in spring. I think it’s worth it for anyone whose work splits evenly between frontend and infrastructure; if your days lean heavily one way, pick the matching tool and skip the second subscription.