Codex vs Claude Code (July 2026): Pricing, Models, and When to Use Each

Every ranking comparison of these two was written before GPT-5.6, Sonnet 5, and Opus 5 shipped. The current matchup: real pricing, the new models, usage limits, and when to run both.

•

Published on

•

Codex vs Claude Code (July 2026): Pricing, Models, and When to Use Each
Do not index
Codex vs Claude Code is the closest fight in AI coding tools, and it moves so fast that most comparisons expired within weeks of publishing. Here is the short answer as of late July 2026. Codex gives you more usage per dollar, an actual free tier, and parallel cloud tasks that run while you do something else. Claude Code gives you a deeper agent harness (skills, hooks, subagents), checkpoints you can rewind, and the models at the top of the independent agentic leaderboards. At Agent37 we run always-on hosting for coding agents and sell neither model, so we have no horse in this race beyond getting the facts right.
And the facts have a short shelf life. Nearly everything ranking for this question was written in May or June 2026, back when the matchup was Opus 4.8 vs GPT-5.5. Both lineups have turned over completely since then.

Codex vs Claude Code at a glance

Dimension
Codex (OpenAI)
Claude Code (Anthropic)
Current models
GPT-5.6 Sol, Terra, Luna (GA July 9, 2026)
Opus 5 (July 24), Sonnet 5, Fable 5 opt-in
Cheapest way in
Free tier, then Go at $8/mo
Pro at $17/mo billed annually ($20 monthly)
Power plans
Plus $20/mo; Pro $100/mo (5x) or $200/mo (20x)
Max at $100/mo (5x) or $200/mo (20x)
API pricing (per 1M tokens)
Sol $5 in / $30 out; Terra $2 / $12; Luna $0.20 / $1.20
Fable 5 $10 / $50; Opus 5 $5 / $25; Sonnet 5 $2 / $10 intro
Context window
~1M tokens on the API
1M tokens on Claude 4.6 and later
Repo config file
AGENTS.md
CLAUDE.md
Extensibility
MCP, agent plugins
MCP, skills, hooks, subagents, plugins
Cloud execution
Parallel tasks from web, GitHub, Linear, Slack
Web sessions, scheduled routines, background subagents
CLI license
Open source, Apache-2.0, ~102k GitHub stars
Not open source
Sandboxing
macOS Seatbelt, Linux bubblewrap
The same primitives: Seatbelt, bubblewrap
Two things in that table would have been wrong a month ago: the model rows and the sandbox row. That is why the date on a comparison matters more than its word count.

What changed in July 2026 (and why June comparisons mislead you)

The spring matchup you will still find quoted everywhere, Opus 4.7/4.8 vs GPT-5.5, is over. The actual timeline:
  • June 9: Anthropic launched Claude Fable 5, its most capable widely released model (alongside the limited-availability Claude Mythos 5), at $10 in / $50 out per million tokens with a 1M-token context window.
  • June 12 to July 1: Fable 5 was briefly suspended under a US export-control directive, then restored globally once the controls were lifted. If you tried it in mid-June and it vanished, that is why.
  • June 30: Claude Sonnet 5 arrived at $2 / $10 introductory pricing (it rises to $3 / $15 on September 1, 2026). It is the default model for Claude Pro users, including in Claude Code.
  • July 9: OpenAI shipped the GPT-5.6 family: Sol (flagship), Terra (everyday), and Luna (fast and cheap). That largely ended the gpt-5.x-codex naming era (a GPT-5.3 Codex Spark research preview lingers); the same three models now power both ChatGPT and Codex.
  • July 24: Claude Opus 5 landed at $5 / $25, became the default on Max plans, and gets within a rounding error of Fable 5 on agentic benchmarks at half the price.
  • July 30: OpenAI cut GPT-5.6 API prices: Luna by 80% to $0.20 / $1.20 and Terra by 20% to $2 / $12, with Sol unchanged. One day after this guide first went up, its own price table needed an update. That is the shelf life of cost math in this fight.
A note on naming, because search data shows people are confused: there is no "Codex 5.2". That phrase mashes up gpt-5.2-codex, a model from the old naming scheme that OpenAI has since deprecated and dropped from its price list, with the current GPT-5.6 generation. If a guide is comparing "Codex 5.2" or telling you to run Opus 4.8, it has not been checked in months. We keep a current model-by-model price breakdown in our best AI models for OpenClaw guide, refreshed against live pricing pages.

Pricing: is Codex or Claude Code free?

This is the question people actually type into Google, and the honest answer is lopsided.
Codex: yes, there is a real free tier. OpenAI now ships Codex with every ChatGPT plan: Free at $0, Go at $8/mo, Plus at $20/mo, and Pro at $100/mo (5x limits) or $200/mo (20x). On Plus, OpenAI's own estimates put you at roughly 15 to 90 flagship-model messages per five-hour window for local work, more on the lighter models. Since April 2026, Codex meters through token-based credits, and that pool is shared with ChatGPT's agentic features (ChatGPT Work, the Excel agent) rather than with ordinary chat, which keeps its own plan limits.
Claude Code: no free tier in practice. Claude's free plan covers chat. Claude Code comes with paid plans: Pro at $17/mo billed annually ($20 monthly) and Max at $100 or $200. Usage is one pooled budget across claude.ai, the desktop app, and Claude Code, structured as five-hour session windows plus weekly caps; Max plans carry a second weekly cap for Sonnet models. Anthropic publishes the structure but not exact hour numbers, and any blog quoting you "40 hours of Opus a week" is guessing from anecdotes.
The API route (both): skip subscriptions and pay per token with your own key. Current list prices per million tokens: on OpenAI after the July 30 cuts, GPT-5.6 Sol is $5 in / $30 out, Terra $2 / $12, Luna $0.20 / $1.20. On Anthropic, Fable 5 is $10 / $50, Opus 5 $5 / $25, Sonnet 5 $2 / $10 until August 31, and Haiku 4.5 $1 / $5.
List prices lie a little, though. OpenAI charges 2x input and 1.5x output once a request's input crosses 272k tokens. Anthropic's tokenizer (4.7 and later) produces roughly 30% more tokens for the same text than earlier Claude models did, and its cheap prompt cache expires after 5 minutes, which makes sparse, occasional traffic Anthropic's worst pricing case. Opus 5 leads Artificial Analysis's Agentic Index at 55.3, and the same leaderboard prices an Opus task at about $4.38 against $0.12 for GPT-5.6 Luna after the July 30 cut: more than an order of magnitude apart. For routine work the cheap model is enough. Pay flagship rates only for the problems that resist it.
Verdict on price: Codex is the generosity play, full stop. You pay Anthropic for model quality at the top end, not for headroom.

Where each one wins

Claude Code wins on harness depth. Skills (reusable instruction folders), hooks (deterministic scripts around every tool call), and subagents that run in the background by default and can nest their own subagents three layers deep make it the most programmable coding agent available. Checkpoints snapshot your files at every prompt, so /rewind undoes an agent misadventure in seconds. Opus 5 tops Artificial Analysis's Agentic Index, and Max subscribers can route up to half their weekly usage to Fable 5. For long, interactive terminal sessions where you steer, it is the better tool.
Codex wins on economics and parallel throughput. Codex cloud runs tasks in isolated containers you can fire from a GitHub PR, a Linear ticket, or Slack, in parallel, with internet access blocked by default during the agent phase. Code review is genuinely built into the PR flow. The CLI is open source and ships weekly. If your work decomposes into many delegable chores, Codex gets through more of them per dollar.
The sandbox gap closed. June-era comparisons made much of a kernel-versus-application sandboxing difference. That is now wrong: both CLIs enforce isolation with the same OS primitives, Seatbelt on macOS and bubblewrap on Linux, with allowlisted network access and approval prompts. The differences that remain are defaults and UX, not isolation tech.
Both speak MCP, and both read a repo instruction file: AGENTS.md for Codex, CLAUDE.md for Claude Code. Keep the two files in sync and either agent can pick up your repo cold.

Running both together

Every honest reviewer lands on "keep both installed" and then stops. The routing that works:
  • Interactive feature work, refactors you watch, anything frontend: Claude Code, with Sonnet 5 as the default to keep costs sane and Opus 5 for the gnarly parts.
  • Background chores, dependency bumps, test-suite fixes, PR review: Codex cloud tasks, fired from the PR or ticket, several at once.
  • Second opinions: run the other agent's review over the diff before merging. Two different models catch different classes of mistakes, and reviews are cheap on both.
Switching costs have collapsed, in one direction at least. Codex CLI 0.145.0 (July 21) expanded its /import command to migrate your Claude Code settings, MCP servers, sessions, and memories wholesale (it covers Cursor too). OpenAI knows exactly whose users it wants.

Where do they run all day?

Neither of these is a code-completion tool. They are agents: they run test suites, chew through review queues, and execute scheduled jobs. Which raises a problem every comparison skips: an agent can only work while its computer is awake. Close the laptop, the run dies. We wrote a whole guide on running Claude Code as a background agent for exactly this problem.
Codex cloud is OpenAI's answer, and for repo-scoped tasks it is a good one. But it is per-task and lives inside OpenAI's walls: each task starts from a container you configured per repo, not from a persistent machine that accumulates your toolchains, credentials, and half-finished branches.
The alternative is a persistent box you control. Plan for 4 GB of RAM for stable agent bursts; a DIY VPS works if you want to own the patching. Or rent the persistent layer: an Agent37 Cloud instance is an always-on computer, metered per minute and isolated with gVisor, running on the same fleet as roughly 1,000 live instances. The $4.94/mo 2 vCPU / 4 GB shape meets that spec; the $3.44/mo 1 vCPU / 3 GB floor works for lighter sessions. You bring your own OpenAI or Anthropic key, and the model bill goes straight to the provider. One caveat: there is no one-click template for either agent yet. A Claude Code template is in the works; Codex runs today through a custom Docker image. New workspaces get a $1 starter credit, no card required.

FAQ

Is Codex or Claude Code free?

Codex is: ChatGPT's Free tier includes it, and Go is $8/mo. Claude Code requires a paid plan, from $17/mo billed annually. On the API, both are pay-per-token with no subscription.

Has Codex overtaken Claude Code?

On usage per dollar and cloud parallelism, yes. On harness programmability, no: skills, hooks, and nested subagents have no full Codex equivalent. On raw model strength it is genuinely contested now: Opus 5 tops Artificial Analysis's Agentic Index, while OpenAI's own numbers favor GPT-5.6 Sol on other agent benchmarks. Run both on a real task from your queue before believing either side's chart.

Is Codex 5.2 better than Claude Opus 5?

"Codex 5.2" is not a product. The current Codex models are the GPT-5.6 family (Sol, Terra, Luna); gpt-5.2-codex is an older, since-deprecated API model that inspired the mashup name. Against GPT-5.6 Sol, the honest answer is contested: independent and vendor benchmarks disagree, and the per-request cost gap is real.

Can they share one repo config?

Nearly. Codex reads AGENTS.md, Claude Code reads CLAUDE.md. Keep the contents identical and both agents follow the same house rules; Codex's /import will even migrate your existing Claude Code setup.

The bottom line

Pick Claude Code if you live in the terminal, steer your agent closely, and want the most programmable harness with the leaderboard-topping models. Pick Codex if you want maximum throughput per dollar and love firing parallel cloud tasks from GitHub and Slack. We run both, route work by type, and cross-review before merging.
Whichever you pick, give it a computer that never sleeps. Agent37 Cloud keeps a coding agent always-on from $3.44/mo, metered per minute. The $1 starter credit covers about a week on the smallest instance, no card required.
Vishnu

Written by

Vishnu

Founder at Agent37, which runs managed hosting for OpenClaw and Hermes agents for 1,000+ users. Writes about what actually breaks when you leave an AI agent running.