Claude Code and Codex CLI are the two vendor-built terminal coding agents, and both start at $20 a month in the US (Claude Pro and ChatGPT Plus, checked October 2026). Pick Codex CLI for an open source agent with a strict sandbox on by default, including on native Windows; pick Claude Code for Claude models, finer permission modes and a classifier that approves routine actions. Public benchmark scores put them close to level, so choose on workflow and plan.
Claude Code vs Codex comes down to models, safety defaults and plan, because on the public benchmark that tests both harnesses they finish close to level. Pick Codex CLI if you want an open source agent with a sandbox on by default and OpenAI models; pick Claude Code if you want Claude models, more permission modes and a reviewer model that approves routine actions for you.
This comparison is built from the vendors' documentation and pricing pages, checked October 2026, not from our own side-by-side test: Anthropic's permission modes, sandbox and model docs, claude.com/pricing and the Claude API price list; OpenAI's Codex CLI, approvals and security and Codex pricing pages and its API price list; and the Terminal-Bench 3.0 results. Prices are US dollars before tax.
- Same entry price: Claude Pro and ChatGPT Plus are both $20 a month
- Benchmarks: Codex with GPT-5.6 Sol 34.4%, Claude Code with Fable 5 33.8% on Terminal-Bench 3.0
- Safety by default: Codex sandboxes commands with network off; Claude Code starts in auto mode
- Native Windows: Codex sandboxes there; Claude Code needs WSL2 for its sandbox
- Open source: Codex is Apache-2.0; Claude Code is proprietary
- API list price: GPT-6.1 Sol equals Sonnet 5.5; Claude Code defaults to the pricier Opus 5.5
- Both read AGENTS.md, so one repo can serve both agents
Both are the same kind of tool: an agent in your terminal that reads a repository, edits files and runs commands, with IDE extensions, a desktop app and a cloud mode around it. For where Claude Code fits among editors and other agents, start at our Claude Code complete guide, the hub for AI coding tools on this site.
Claude Code vs Codex CLI: the head-to-head
Most of the feature list now matches. Both support MCP servers, subagents, hooks, skills and plugins, both have a non-interactive mode for scripts and CI, and both hand work off to a cloud session. The differences sit in licence, safety defaults, Windows support and which models you can run.
| Claude Code | Codex CLI | |
|---|---|---|
| Maker and models | Anthropic; Claude models, default Opus 5.5 | OpenAI; OpenAI models, CLI shows gpt-6.1-sol |
| Licence | Proprietary, use under Anthropic's Commercial Terms | Open source, Apache-2.0 |
| Install | Native installer (curl or PowerShell), Homebrew, WinGet | Standalone installer, npm @openai/codex, Homebrew, Windows script |
| Entry plan | Claude Pro, $20 a month | ChatGPT Plus, $20 a month (Go at $8 is desktop app only) |
| Heavy plans | Max 5x $100, Max 20x $200 | Pro $100, $200 or $500; no five-hour limit on Pro |
| Pay per token | Claude Console account | OpenAI API key (no cloud features) |
| Default safety | Auto mode: a classifier reviews actions; Bash sandbox off until /sandbox | Workspace write with on-request approvals in a git repo; network off |
| OS sandbox | macOS, Linux and WSL2; none on native Windows | macOS, Linux and native Windows |
| Project instructions | CLAUDE.md, or an existing AGENTS.md | AGENTS.md (created with /init) |
| Extensions | MCP, subagents, hooks, skills, plugins | MCP, subagents, hooks, skills, plugins |
| Scripts and CI | claude -p, GitHub Actions | codex exec, GitHub Action |
| Cloud handoff | Claude Code on the web | codex cloud |
Checked October 2026. Licences from the anthropics/claude-code and openai/codex repositories; project files from Anthropic's memory docs and the Codex CLI page.
Sandboxing and approval modes compared
This is where the two differ most. Codex leads with an operating-system sandbox; Claude Code leads with permission modes. Each has the other layer too, but the defaults show the design.
Codex, per OpenAI's approvals and security page, runs with network access off by default. In a version-controlled folder it starts in Auto, which is workspace write with on-request approvals; outside version control it starts read-only. The sandbox is enforced by the OS: Seatbelt on macOS, bwrap plus seccomp on Linux, and a native sandbox on Windows. Inside writable folders, .git stays read-only. The /permissions command offers Ask for approval, Approve for me (an automatic reviewer), Full access and a custom config (permissions page).
Claude Code, per Anthropic's permission modes docs, starts interactive terminal and VS Code sessions in auto mode from version 2.1.283, where a second model, the classifier, reviews actions instead of you. Its Bash sandbox is off by default; /sandbox turns it on, after which shell commands can write only to the working directory, a temp folder and any added directories, and network traffic goes through a proxy with an allow list that starts empty. It runs on macOS, Linux and WSL2; on native Windows, Claude Code runs commands unsandboxed.
| What you want | Claude Code | Codex CLI |
|---|---|---|
| Ask before almost everything | Manual (default) mode: reads run, everything else asks | read-only sandbox with on-request approvals |
| Let it edit, ask for the rest | acceptEdits: edits and common file commands run | Ask for approval: workspace write, asks beyond the workspace |
| Let a reviewer model decide | auto: a classifier checks each action | Approve for me: automatic review of eligible approval requests |
| Plan without changing files | plan mode | read-only sandbox |
| Locked-down scripts | dontAsk: only pre-approved tools, the rest denied | codex exec with a fixed sandbox and approval policy |
| No guard rails | bypassPermissions, for isolated containers and VMs | danger-full-access or --yolo, which OpenAI marks not recommended |
In practice: on native Windows, Codex gives you an OS sandbox without extra setup. On macOS or Linux, Claude Code with /sandbox on reaches a similar boundary, and its classifier cuts prompts further.
Pricing: subscriptions and API keys
At the entry level the price is identical. Claude Code is included in Claude Pro at $20 a month and Codex in ChatGPT Plus at $20 a month, both checked October 2026 on claude.com/pricing and OpenAI's Codex pricing page. Above that, Claude Max costs $100 or $200 a month and ChatGPT Pro $100, $200 or $500.
Source: claude.com/pricing, Anthropic help centre and OpenAI Codex pricing page, US dollars, checked October 2026
- Limits. OpenAI publishes ranges: on Plus, 15 to 160 local messages per five hours on GPT-6.1 Sol and 350 to 3,000 on GPT-6 Luna, with weekly limits that may also apply. Pro plans currently have no five-hour limit. Anthropic publishes no message counts; Claude plans use five-hour and weekly windows shared with chat (Max article).
- Cheapest way in. ChatGPT Free and Go include Codex with GPT-6 Luna in the desktop app, subject to rollout; the CLI, IDE extension and web start on Plus. The free Claude plan does not include Claude Code at all.
- Teams. ChatGPT Business is $25 a user monthly or $20 billed annually. A Claude Team Standard seat is the same, $25 or $20, with Premium seats at $125 or $100.
On an API key both bill per token. The table uses one illustrative task, not a measurement: 1,000,000 tokens of cached context re-read across a session, 100,000 tokens of new input and 40,000 output tokens. Only the rates are the vendors'. Claude prices new context as cache writes at 1.25x the input rate; OpenAI charges plain input.
| Model | Input / output per million tokens | Illustrative task cost |
|---|---|---|
| Claude Opus 5.5 (Claude Code default) | $4 / $20 | $1.50 |
| Claude Sonnet 5.5 | $2 / $10 | $0.75 |
| GPT-6.1 Sol | $2 / $10 | $0.70 |
| Claude Haiku 5.5 | $0.10 / $0.50 | about $0.04 |
| GPT-6 Luna | $0.10 / $0.50 | about $0.04 |
The takeaway: per token, GPT-6.1 Sol and Sonnet 5.5 cost about the same, but Claude Code defaults to Opus 5.5 (model docs), which doubles the bill unless you switch with /model. Codex on an API key also drops the cloud features, such as GitHub code review and Slack. For the Claude side in full, read our Claude Code pricing guide.
Which is better on benchmarks?
On the one public benchmark that scores both harnesses, they are close to level. Terminal-Bench measures how often an agent completes real terminal tasks, and its results are published per model and harness pair, so they compare the whole agent rather than the model alone.
Source: tbench.ai, Terminal-Bench 3.0 launch post, read 16 October 2026
Three cautions before you read too much into it. The models tested are a generation behind the current defaults, Opus 5.5 and GPT-6.1 Sol, so newer pairs have no published score yet. The harness matters: on the earlier Terminal-Bench 2.1 table, Opus 4.6 scored 70.1% inside Claude Code and 63.8% inside the Terminus 2 harness. And the Terminal-Bench team says many 2.1 tasks had become saturated, which is why 3.0 exists. Our Claude vs ChatGPT comparison covers the chat products behind each agent.
When to pick Claude Code and when to pick Codex CLI
- You want Claude models, including Fable for the hardest tasks
- You already pay for Claude Pro or Max and use Claude chat
- You want auto mode approving routine actions for you
- You work on macOS, Linux or WSL2
- Your team runs Claude Team or Enterprise seats
- You want an open source agent you can read and fork
- You want a sandbox and network off from the first run
- You work on native Windows
- You already pay for ChatGPT Plus or Pro
- You want a Pro plan without a five-hour limit
Running both is also reasonable, and cheap to set up: both read AGENTS.md, so one file of project rules serves each agent (Anthropic memory docs, Codex CLI page). Give each its own git worktree so their edits never collide. If you are also weighing an AI editor, see Claude Code vs Cursor.
How to compare them on your own repo
No vendor page tells you which agent suits your codebase, so run a short trial of your own. One afternoon is enough.
- 1Install both
Claude Code with its native installer, Codex with its standalone installer. Expected result: claude and codex both start in a new terminal.
- 2Write one AGENTS.md
Run /init in Codex, review the file, and let Claude Code read the same one.
- 3Pick one real task
A bug with a failing test works well, because pass or fail is not a matter of taste.
- 4Match the safety settings
Codex in Ask for approval; Claude Code in acceptEdits with /sandbox on, so neither has an edge.
- 5Give both the same prompt
Each on its own git worktree from the same commit.
- 6Compare what you had to fix
Count manual fixes, prompts answered and the plan usage each run used (/usage or /status).
Set-up help for the Claude side is in how to install Claude Code, and if you want to try it before paying, Claude Code free options lists the legitimate routes. Anthropic's cost guide and OpenAI's models page are the pages to re-read before you commit to a plan, because models and limits change often. If you want to go from trial to a shipped product, AI SaaS Builder, one of our programs, has a module on the Claude Code CLI and MCP servers inside a full build.
Claude Code vs Codex CLI: FAQ
Is Claude Code better than Codex CLI?
Neither wins outright on the evidence available. On the Terminal-Bench 3.0 launch post, read 16 October 2026, Codex with GPT-5.6 Sol scored 34.4% and Claude Code with Fable 5 scored 33.8%, close to a tie. Codex has the stricter default sandbox and an open source licence; Claude Code has deeper permission modes and Claude models. Pick on workflow and plan, not on a winner.
Is Codex CLI cheaper than Claude Code?
At the entry level they cost the same: ChatGPT Plus and Claude Pro are both $20 a month in the US, checked October 2026. ChatGPT Go at $8 includes Codex only in the desktop app with GPT-6 Luna. On API keys, GPT-6.1 Sol and Claude Sonnet 5.5 have the same list price, $2 input and $10 output per million tokens, while Claude Code defaults to Opus 5.5 at $4 and $20.
Can I use Codex CLI and Claude Code on the same project?
Yes. Both run in your terminal against the same folder, and both read AGENTS.md: Codex creates one with /init, and Anthropic's docs say Claude Code can read a repository's AGENTS.md in place of CLAUDE.md. Keep shared project rules there. Run one agent at a time on a given branch, or give each its own git worktree, so their edits do not collide.
Is Codex CLI open source?
Yes. The openai/codex repository on GitHub is licensed under Apache-2.0, so you can read, fork and modify the agent itself. Claude Code is not: its GitHub repository holds plugins, examples and the changelog, and its licence notice reads "All rights reserved" with use subject to Anthropic's Commercial Terms of Service. Both are free to install; the models cost money.
Does Codex CLI run code in a sandbox by default?
Yes. OpenAI's docs say Codex runs with network access off by default and uses an operating-system sandbox: Seatbelt on macOS, bwrap plus seccomp on Linux and a native sandbox on Windows. In a git repository the default is workspace write with on-request approvals; outside one it starts read-only. Claude Code's sandbox is off until you run /sandbox.
Which models does each tool use?
Claude Code runs Claude models and defaults to Opus 5.5 on every plan and on the API, with Sonnet 5.5, Haiku 5.5 and Fable models selectable through /model. Codex CLI runs OpenAI models; its CLI page shows gpt-6.1-sol, and the pricing page lists GPT-6.1 Sol and GPT-6 Luna on Plus. GPT-5.5 left Codex for ChatGPT sign-in on 14 October 2026.
Can I use Codex CLI or Claude Code without a subscription?
Yes, both take pay-per-token billing. Codex works with an OpenAI API key in the CLI, SDK and IDE extension, without cloud features such as GitHub code review or Slack. Claude Code works with a Claude Console account billed at API rates. In both cases set a spend limit before a long session, because agent loops re-send large amounts of context.