Codex vs Claude Code: pricing, models, sandbox and undo compared

OpenAI's and Anthropic's coding agents side by side: what each costs, which models it runs, how it sandboxes and asks, what it can roll back, and which to pick for what.

Updated October 2026

Codex and Claude Code are the first-party coding agents from OpenAI and Anthropic. Pick Claude Code if you pay for Claude and want to rewind the agent's own edits mid-session. Pick Codex if you pay for ChatGPT, want an open source CLI, or want the agent's sandbox on by default. The biggest practical differences are in price entry points, sandboxing and how much each can undo.

Last updated: October 2026. This page is published by the makers of Darce. Every fact about Codex and Claude Code comes from OpenAI's and Anthropic's own pricing pages, docs and repositories, fetched on October 15, 2026. Both tools change often, so check the linked sources before you decide.

Codex vs Claude Code at a glance

CodexClaude Code
Made byOpenAIAnthropic
CLI licenseApache-2.0, open sourceProprietary
Cheapest plan that includes itChatGPT Free ($0), then Go ($8/month)Claude Pro ($20/month, or $17/month billed yearly)
Default modelGPT-6.1 Sol (since CLI 0.161.0)Opus 5.5 on Pro, Max, Team, Enterprise and the API
Other modelsCustom providers on the Responses API; local models with --ossClaude only; Anthropic doesn't support non-Claude models through a gateway
SandboxOn by default in a git repo: workspace write, network off, .git read-onlyOff by default; turn on with /sandbox
Default approvalsAuto in a version-controlled folder (asks before going outside the workspace)Auto mode: a classifier model reviews actions (v2.1.283 and later)
UndoNo /undo; Esc twice forks the chat but doesn't restore files/rewind restores Claude's own file edits, not files changed by Bash commands
Parallel workSubagents, /worktree, cloud tasks, app worktreesSubagents, --worktree, background agents, cloud sessions

Pricing and plans

Codex is included in every ChatGPT plan: Free, Go, Plus, Pro, Business, Edu and Enterprise. OpenAI's pricing page lists Go at $8 a month, Plus at $20, Pro at $100, $200 or $500, and Business at $20 per user per month billed yearly ($25 billed monthly). Free is described as a way to "explore Codex capabilities on quick coding tasks" and Go as "lightweight coding tasks"; OpenAI publishes no message counts for either.

On Plus, limits are estimated per five-hour window and depend on the model: roughly 15 to 160 local messages with GPT-6.1 Sol, 5 to 45 with GPT-6 Astra, and 350 to 3,000 with GPT-6 Luna. "Pro plans currently have no five-hour limit," though weekly limits may apply. Plus and Pro can buy extra credits. You can also sign in with an API key and pay API rates, which OpenAI recommends for CI.

Claude Code is not on the free Claude plan: Anthropic's setup page says "the free claude.ai plan does not include Claude Code access." It is included in every paid plan:

Claude planPrice
Pro$20/month, or $17/month billed yearly
Max 5x$100/month
Max 20x$200/month
Team, Standard seat$25/seat monthly, $20 billed yearly
Team, Premium seat$125/seat monthly, $100 billed yearly
Enterprise$20/seat/month billed yearly, 20-seat minimum, plus usage at API rates

Pro and Max have a five-hour session limit and a weekly limit, shared between Claude and Claude Code. Without a subscription you can use a Console account and pay per token; Anthropic's cost docs put enterprise usage at about $13 per developer per active day, or $150 to $250 a month.

Where each is better on price: Codex has a $0 and an $8 way in, and a $20 plan that covers the same agent as the $200 one. Claude Code starts at $20 and has no free tier; Max gives 5 or 20 times Pro's usage for $100 or $200.

Models

Codex defaults to GPT-6.1 Sol, which OpenAI describes as "near-Astra performance" at lower cost. GPT-6 Astra is the most capable option and GPT-6 Luna the most efficient; GPT-5.6 models remain available during the rollout. For Free and Go, the models page lists GPT-6 Luna (subject to rollout) and says GPT-6.1 Sol isn't included at launch.

Claude Code defaults to Opus 5.5 on Pro, Max, Team, Enterprise and the Anthropic API. Aliases include opus, sonnet, haiku and opusplan, which uses Opus while planning and Sonnet while making changes.

If you pay per token, the API prices per million tokens (input / output) are:

ModelInputOutput
GPT-6.1 Sol$2.00$10.00
GPT-6 Astra$10.00$50.00
GPT-6 Luna$0.10$0.50
Claude Opus 5.5$4.00$20.00
Claude Sonnet 5.5$2.00$10.00
Claude Haiku 5.5 (prompts up to 100K tokens)$0.10$0.50

Other models. Codex can point at a custom provider, as long as it serves the Responses API, and runs local models with --oss through Ollama or LM Studio. Anthropic says it doesn't support routing Claude Code to non-Claude models through any gateway; people still do it, with caveats we cover in Claude Code with other models.

Sandbox and approvals

This is where the two differ most.

Codex sandboxes by default. In a version-controlled folder the CLI starts in Auto: it can edit and run commands inside the workspace, and asks before going outside it. Network access is off unless you turn it on, and .git, .codex, .agents and .aws are read-only. In a folder without version control it starts read-only. The sandbox uses Seatbelt on macOS, bwrap plus seccomp on Linux and WSL2, and its own sandbox on native Windows. You switch modes with /permissions. --yolo (--dangerously-bypass-approvals-and-sandbox) removes both the sandbox and the prompts, and OpenAI marks it "not recommended".

Claude Code reviews by default, sandboxes on request. Since v2.1.283, interactive terminal and VS Code sessions start in auto mode, where "a second model, the classifier, reviews actions instead of you". Other modes are Manual (asks before most edits, commands and network access), acceptEdits, plan, dontAsk and bypassPermissions, which Anthropic says is for isolated containers and VMs only. The sandboxed Bash tool is off until you run /sandbox; it uses Seatbelt on macOS and bubblewrap on Linux and WSL2, and routes network traffic through a proxy whose allowed domains "start empty". On native Windows, Claude Code runs commands unsandboxed.

Where each is better: Codex gives you OS-level isolation with no setup, on every platform including native Windows. Claude Code's auto mode is built to let long tasks run without a prompt for every routine step, and once its sandbox is on, network access is limited to domains you allow. Neither sandbox stops an agent from deleting or rewriting files inside your project, because the project has to stay writable. Our sandbox vs undo guide covers that gap.

Undo and rewind

Claude Code saves a checkpoint before every prompt that starts a turn. Run /rewind or press Esc twice and choose to restore code, the conversation, or both. Checkpoints survive resuming a session and are kept for about 30 days. The limits are stated plainly in the docs:

  • "Checkpointing does not track files modified by Bash commands." If Claude ran rm, mv or cp, rewind leaves the result.
  • Edits made by most subagents aren't restored.
  • Symlinked and hard-linked files are skipped, which includes files pnpm hard-links into place.
  • Changes made outside the session aren't captured.

Codex has no undo command. Its experimental /undo was removed: a maintainer wrote in January 2026 that "it didn't get much use, and its design caused problems for many users", and the ghost snapshots behind it were removed in April 2026. Pressing Esc twice lets you edit your previous message and fork the chat from that point, but nothing in it restores files on disk. In the Codex app, the review pane can revert all changes, one file or one hunk. OpenAI's CLI docs advise creating git checkpoints before and after a task.

Where each is better: Claude Code, clearly, for rolling back the agent's own edits mid-session. With either tool, commit before you start: neither reverses what a shell command did. More detail in Claude Code rewind and agent checkpoints compared.

Parallel work

Both can run more than one agent at a time.

Codex has subagents, which show in the CLI, the IDE extension and the desktop app, with a configurable cap on concurrent threads. /worktree or --worktree starts a conversation in a new managed git worktree. The desktop app runs several independent chats in one project through worktrees, and cloud tasks each get their own workspace and keep running while your computer sleeps.

Claude Code has subagents that work in their own context window and report back, claude --worktree <name> for an isolated parallel session, background agents to run and watch several sessions from one screen, and cloud sessions in Anthropic-managed VMs on Pro, Max, Team and eligible Enterprise seats, with no separate VM charge. Agent teams exist but are experimental and off by default.

Where each is better: roughly even. Claude Code's background agents and routines suit people who live in the terminal; Codex's app and cloud tasks suit people who hand off work and review it later.

Which should you pick?

  • You already pay for ChatGPT: Codex. It's included in every ChatGPT plan.
  • You already pay for Claude: Claude Code. It's the supported way to use that subscription for coding.
  • You want to spend nothing: Codex on ChatGPT Free, for quick tasks. Claude Code has no free tier; see is Claude Code free for other free options.
  • You want an open source agent you can read and fork: Codex.
  • You want isolation without setup, or work on native Windows: Codex.
  • You want to roll back the agent's edits during a session: Claude Code.
  • You can't decide which model is better for your code: try both on the same task. That's the case for the next section.

Where Darce fits

Darce is our open source (MIT) terminal agent, so weigh this section accordingly. It isn't a replacement for either first-party tool's ecosystem, but it covers two gaps this comparison shows:

  • Race both vendors on your task. /derby runs up to three models, for example a Claude model and a GPT model, on the same task in separate git worktrees. Your files stay untouched until you compare the diffs and keep one. Claude Sonnet and Opus and GPT come with the Builder plan ($15/month); Power ($65/month) has every model.
  • Undo that covers shell commands. /undo snapshots your project before and after every step, so files that rm, mv or an install changed come back too. Your branch, index and stash aren't touched, and removed files sit in .git/darce-trash for 7 days. It asks before what undo can't reverse, like git push, migrations and deploys.

You can also bring your own OpenRouter key instead of a Darce plan. Compare in more depth: Darce vs Codex CLI and the Claude Code alternative.

Sources

Frequently asked questions

Is Codex or Claude Code better?

Neither wins across the board. Codex is open source, included in every ChatGPT plan from Free up, and sandboxes commands by default. Claude Code needs a paid Claude plan but can rewind its own file edits and starts in an auto mode where a classifier reviews actions.

Is Codex free?

Codex is included in ChatGPT Free, which OpenAI describes as a way to explore Codex on quick coding tasks, and in Go at $8 a month. OpenAI doesn't publish message counts for Free or Go.

How much does Claude Code cost?

Claude Code needs a paid plan: Pro at $20 a month ($17 billed yearly), Max at $100 or $200, Team seats from $20, or Enterprise. It can also run on pay-per-token API billing. The free Claude plan doesn't include it.

Does Codex have an undo command?

No. Codex's experimental /undo was removed in 2026. Pressing Esc twice edits your previous message and forks the chat, but doesn't restore files. OpenAI's docs recommend git checkpoints before and after a task.

Does Claude Code run in a sandbox?

Not by default. Run /sandbox or set sandbox.enabled to turn on the sandboxed Bash tool, which uses Seatbelt on macOS and bubblewrap on Linux and WSL2. On native Windows, commands run unsandboxed.

Can I use Claude models in Codex, or GPT models in Claude Code?

Not in a supported way. Codex custom providers must serve OpenAI's Responses API, and Anthropic says it doesn't support routing Claude Code to non-Claude models. To use both vendors in one agent, use a multi-model agent such as OpenCode or Darce.

Related guides