Codex vs Claude Code: Which AI Coding Agent to Use (June 2026)

OpenAI Codex and Anthropic Claude Code are both agentic coding tools, but they run in different places and bill differently. A specific, up-to-date comparison with prices, models, and benchmarks.

OpenAI Codex and Anthropic Claude Code are the two agentic coding tools most professional developers actually keep open all day. They look similar from a distance — type a request in plain English, the agent reads code, edits files, runs commands, and opens a pull request. The real differences are where each one runs by default, which models it can use, and how the bill is calculated. This guide settles all three with current (June 2026) numbers, so you can pick without guessing. If you have used neither, run each once first with the Codex beginner guide and the Claude Code beginner guide.

TL;DR

  • Claude Code lives in your terminal, acts directly on your local files, git, and shell, and runs Anthropic models only (Claude Opus 4.7 and Sonnet 4.6). Best for tight, in-place iteration on a repo you have checked out. Included in Claude Pro $20/mo and Max ($100 / $200).
  • Codex ships as a CLI, IDE extension, web console, and GitHub app. Its standout mode is cloud tasks — it spins up an isolated sandbox, runs long, and opens a PR. It runs GPT-5.5 (and other GPT-5 variants). Included in ChatGPT Plus $20/mo, with far more headroom on Pro $200/mo.
  • Both default to per-token billing out of your plan’s allowance (Codex switched off per-message pricing on April 2, 2026). Heavy daily use of either realistically lands at $100–$200/month once you count overage.
  • On raw coding benchmarks they are close: GPT-5.5 leads SWE-bench Verified at 88.7%, Claude Opus 4.7 follows at 87.6%. The practical winner is decided by workflow, not by one benchmark point.

Side-by-side comparison

DimensionCodexClaude Code
VendorOpenAIAnthropic
ModelsGPT-5.5 (default), GPT-5.4, GPT-5.3-codexClaude Opus 4.7, Sonnet 4.6 (Anthropic only)
Default homeCloud task sandboxYour local terminal
SurfacesCLI, VS Code / JetBrains / Xcode, web console, GitHub, ChatGPT iOS appCLI, VS Code / JetBrains extensions
Standout modeLong-running cloud tasks, parallel fan-outTight local loop with real files, git, shell
Context sourceRepo cloned into the sandbox (or local in CLI)Reads your working tree directly
Plan it rides onChatGPT Free / Go / Plus ($20) / Pro ($200)Claude Pro ($20) / Max ($100 / $200)
Billing modelPer-token from ChatGPT allowance (since Apr 2026)Per-token, shared with claude.ai usage
Background / scheduled runsCloud tasks, GitHub triggersClaude Code Routines (cloud, research preview)

Sources: OpenAI Codex pricing and Use Claude Code with your Pro or Max plan.

Where each one shines

Codex is best for

  • Long-horizon, hands-off tasks. A cloud task takes an issue, works in an isolated sandbox, and opens a PR. OpenAI has demonstrated Codex completing 1,000+ sequential tool calls on a single engineering task without intervention.
  • Parallel fan-out. Kick off several cloud tasks at once (e.g. one per failing test or one per repo in a migration) and review the PRs when they land. Claude Code has no equivalent native fan-out across separate cloud jobs.
  • Sandboxed execution. If you do not want an agent running shell commands on your laptop, the cloud sandbox is isolated by default. GPT-5.5 is the fixed default for cloud tasks; you cannot swap the cloud model today.

Claude Code is best for

  • In-place work on your real tree. It reads your actual files, edits your actual branch, and runs your actual commands. The Claude Code project setup walkthrough is the smoothest first hour.
  • Latency and pair-programming. Local round-trips feel instant, so you can correct course every few seconds instead of waiting for a cloud job. Good prompt patterns are in Claude Code project prompts.
  • Large multi-file refactors. Subagents spin up isolated Claude sessions (own context window) to parallelize search and edits without polluting the parent context — strong for a big in-repo refactor where you want test runs between steps.

How to choose

Indie developer on one project you have checked out? Start with Claude Code. It acts directly on your local files and the feedback loop is tight. The Pro plan at $20/mo (about $17/mo billed annually) bundles Claude Code, claude.ai, and Claude Cowork on one bill.

Team developer buried in issues and PRs? Codex’s cloud-task model amortizes across many tickets — fan out a batch, review PRs, merge the good ones. If you already pay for ChatGPT Plus, Codex is included; the catch is the 30–150 messages per 5 hours Plus allowance, which heavy agentic use burns through fast, pushing you toward Pro or overage.

Already paying for one ecosystem? That usually decides it. A ChatGPT Plus subscriber gets Codex at no extra charge; a Claude Pro/Max subscriber gets Claude Code the same way. There is no reason to add a second $20 plan until your workflow demands the other tool’s standout mode.

Doing both? A common split: Claude Code locally for anything that touches your working tree, Codex in the cloud for isolated background jobs. Commit before each handoff — the two tools do not share context, so a clean git state is the only thing they reliably agree on.

Pricing and limits (as of June 2026)

Neither tool sells a standalone subscription; each rides on the vendor’s consumer plan and bills per token.

PlanPrice/moIncludesRough included-usage ceiling
Claude Pro$20 ($17 annual)Claude Code + claude.ai + Cowork~44k tokens / 5 hr (shared)
Claude Max 5x$1005× Pro usage~88k tokens / 5 hr
Claude Max 20x$20020× Pro usage~220k tokens / 5 hr
ChatGPT Plus$20Codex + ChatGPT~30–150 messages / 5 hr
ChatGPT Pro$200Codex + ChatGPT, big headroom~300–1,500 messages / 5 hr

Notes that matter:

  • Claude Code usage is shared with your claude.ai chats — a long Claude Code session eats the same allowance as the web app. Max plans add two weekly caps (one all-model, one Sonnet-only) that reset seven days after a session starts.
  • Codex moved to token billing on April 2, 2026, replacing the old per-message scheme; usage is metered as credits per million input/output tokens against your ChatGPT plan.
  • All paid Claude plans and Codex now let you continue at standard API rates once the included allowance runs out, so heavy users rarely hit a hard wall — they hit a bigger bill. Plan on $100–$200/month for either tool under daily professional use.
  • For raw API access outside these plans: Opus 4.7 is $5/$25 per 1M input/output tokens, Sonnet 4.6 $3/$15, GPT-5.5 $5/$30.

Check the live pages before committing: Codex pricing and Claude Max plan details.

Models and benchmarks

This is where the “which is smarter” debate actually lives — and the honest answer is they trade blows.

Benchmark (June 2026)Codex (GPT-5.5)Claude Code (Opus 4.7)
SWE-bench Verified88.7%87.6%
SWE-bench Pro58.6%64.3%
Terminal-Bench 2.082.7%~69–72%

Read it like this: GPT-5.5 edges ahead on the standard SWE-bench Verified set and is well ahead on terminal-style agentic tasks (Terminal-Bench), which flatters Codex’s command-running workflow. Claude Opus 4.7 leads on the harder SWE-bench Pro set, which tracks closer to real multi-file engineering work. A single benchmark point will not be what you notice day to day; the surface and the bill will be.

One hard constraint to remember: Claude Code runs Anthropic models only. You cannot point it at GPT-5.5. Codex is the opposite — GPT-5 family only. If you want one tool that can switch between Opus 4.7, Sonnet 4.6, and GPT-5.5 in the same project, that is an editor like Cursor, not either of these.

Common misconceptions

“Codex is just ChatGPT in coding mode.” Not since the 2026 relaunch. Codex is a standalone agent with its own CLI, IDE extensions, web console, and GitHub app; cloud tasks run long-horizon work in a sandbox and open PRs.

“Claude Code is just claude.ai in a browser.” It is a separate terminal-native product. It does share your plan’s usage allowance with claude.ai, but it edits your real filesystem and runs your real shell — the web app does neither.

“One of them is clearly smarter.” On June 2026 benchmarks they split the wins. Pick on workflow and which plan you already pay for, not on a one-point benchmark gap.

FAQ

Q: Which is better for working on my local repo? A: Claude Code. It runs in your terminal against the real working tree, so edits, git operations, and test runs happen in place with near-zero latency. Codex can run locally via its CLI too, but its default and strongest mode is the cloud sandbox, which is more loosely coupled to your live repo state.

Q: Which handles long, hands-off agentic tasks better? A: Codex, for fully unattended cloud jobs — it isolates each task in a sandbox, can run 1,000+ sequential tool calls, and fans out several jobs in parallel. Claude Code is stronger when you want to stay in the loop locally and correct course between steps, and its subagents parallelize work inside one session.

Q: Can I use both on the same project? A: Yes, and many people do. Typical split: Claude Code locally for anything touching your working tree, Codex in the cloud for isolated background tasks like “fix this issue and open a PR.” They do not share context, so commit between handoffs and let each start from a clean git state.

Q: Do they share pricing or accounts? A: No. Codex bills through your OpenAI/ChatGPT plan (Free / Go / Plus $20 / Pro $200); Claude Code bills through Anthropic (Pro $20 / Max $100 / $200). Both meter per token against your plan and fall back to API rates once you exhaust the included allowance.

Q: Can Claude Code use GPT-5.5, or Codex use Claude? A: No. Claude Code runs Anthropic models only (Opus 4.7, Sonnet 4.6); Codex runs the GPT-5 family only (GPT-5.5 default for cloud tasks). If you need one tool that switches between vendors in a single project, use a multi-model editor like Cursor instead.

Tags: #Claude #Codex #AI coding #Comparison