Comparison · Tools & workflows
Codex vs Claude Code (Dec 2026): Price, Limits, Sandboxing
Codex and Claude Code both start at $20, but Codex sandboxes commands by default and has a $100 tier without a five-hour limit, while Claude Code defaults to Opus 5.5 at twice the per-token price. Plans, a same-session cost comparison and what to change.
Soraya Lindquist · Dec 2, 2026 · 6 min read
On this page

Codex and Claude Code both cost $20 a month at the entry tier, and both read your repo, edit files and run commands from the terminal. They split on three things you will feel in the first week: Codex runs commands inside an OS sandbox with the network off by default, Claude Code asks before each risky action and makes its sandbox opt-in; Codex Pro at $100 currently has no five-hour limit, while Claude needs the $200 Ultra plan for that; and Claude Code defaults to Opus 5.5, which costs twice as much per token as the Codex model most people will pick.
Everything below comes from OpenAI’s Codex docs and Anthropic’s Claude Code docs and pricing pages, checked 2 December 2026.
Plans and prices side by side
Scroll the table horizontally on smaller screens.
| Tier | Codex (OpenAI) | Claude Code (Anthropic) |
|---|---|---|
| Free | Free and Go ($8): GPT-6 Luna in the desktop app only, subject to rollout | Not included on Free |
| $20 | Plus: CLI, IDE extension, web and iOS, plus cloud code review and Slack | Pro ($17 billed annually): CLI, IDE and desktop; five-hour and weekly limits |
| $100 | Pro $100: no five-hour limit at present | Max: 5x Pro usage; five-hour and weekly limits; $100/month API credits |
| $200 | Pro $200 | Ultra: 10x Pro weekly; no five-hour limit for verified accounts; $200/month API credits |
| $500 | Pro $500: adds Ultrafast mode | — |
| Business / Team | Business: $20/user/month billed annually, $25 monthly, 2+ users | Team: Standard seat $20 annual / $25 monthly; Premium seat $100 / $125 |
| Enterprise | Contact sales | $20/seat/month annual plus usage at API rates, 20-seat minimum |
| Pay per token | API key (CLI, SDK, IDE; no cloud features) | Claude Console API key |
How usage is described differs, which matters when you budget. OpenAI publishes rough ranges of local messages per five hours on Plus: 17–180 with GPT-6.2 Sol, 6–50 with GPT-6.2 Astra and 350–3,000 with GPT-6 Luna, with weekly limits that may also apply. Anthropic describes Claude plans only as multiples of Pro. Neither converts cleanly into the other, so do not pick a plan from these numbers alone; run /status in Codex or /usage in Claude Code for a week and look at what you actually used.
Same session, four bills on API keys
On API-key billing the comparison is clean, because both vendors publish per-token prices. Take one assumed agent session: a 40,000-token context (instructions, tool definitions, the files it keeps re-reading) written to the cache once and re-read on 30 turns, plus 3,000 new input tokens and 1,500 output tokens per turn. Priced at each vendor’s Standard list rates on 2 December 2026:

Scroll the table horizontally on smaller screens.
| Agent and model | Input / output per 1M | Cache write / read per 1M | Session cost |
|---|---|---|---|
| Codex, GPT-6.2 Sol | $2 / $10 | $2.50 / $0.10 | $0.85 |
| Claude Code, Sonnet 5.5 | $2 / $10 | $2.50 / $0.10 | $0.85 |
| Claude Code, Opus 5.5 (its default) | $4 / $20 | $5 / $0.20 | $1.70 |
| Codex, GPT-6.2 Astra | $8 / $40 | $10 / $0.40 | $3.40 |
The takeaway is about defaults, not brands. Anthropic’s model docs say Claude Code’s default model is Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and the Anthropic API. On paper that doubles the bill against Sonnet 5.5, which is priced exactly like GPT-6.2 Sol. Codex picks a recommended model if you set none; its docs suggest GPT-6.2 Sol for everyday work and Astra for demanding tasks, and Astra is four times Sol.
These are list-price sums, not measurements. The two agents do not send identical context for the same request, and their tokenizers differ; Metarix found up to a 3.6× spread between tokenizers on identical non-English text in Same Text, More Tokens.
Safety defaults: sandbox first vs ask first
This is the difference that changes daily work most. OpenAI’s security docs say Codex runs locally inside an OS-enforced sandbox, using Seatbelt on macOS and bwrap with seccomp on Linux, with network access off and writes limited to the active workspace by default. In the Auto preset (--sandbox workspace-write --ask-for-approval on-request) it edits and runs commands in the working directory without asking, and stops for approval only for writes outside the workspace or commands that need the network.
Claude Code starts the other way round. Its permissions docs list default mode (labelled Manual) as prompting before most edits, shell commands and network requests, with acceptEdits, plan, auto (a background classifier reviews actions), dontAsk and bypassPermissions as alternatives. It also has a built-in Bash sandbox, using Seatbelt on macOS and bubblewrap on Linux, but you turn it on with /sandbox. Once on, sandboxed commands can write to the working directory and a temp directory, and Claude Code asks the first time a command needs a new network domain.
The failure mode to know on each side:
- Claude Code: approval fatigue. Teams that tire of prompts jump to
bypassPermissions, which Anthropic says skips prompts even for writes to.gitand.claudeand should only be used in containers or VMs. UseacceptEditsorautoplus/sandboxinstead, and block bypass in managed settings withpermissions.disableBypassPermissionsMode. - Codex: a retired setting that stops it starting. OpenAI’s docs say Codex no longer supports
approval_policy = "untrusted"and that the setting can prevent the client from starting. Remove it from~/.codex/config.toml, project configs and startup scripts; use a projecttrust_level = "untrusted"entry if you want stricter approvals.
Our hooks and permissions guide maps the full permission models of both, plus Cursor and Copilot CLI. Codex has also started masking credentials in its output; see Codex CLI starts masking your credentials.
What else differs in the repo
Scroll the table horizontally on smaller screens.
| Detail | Codex | Claude Code |
|---|---|---|
| Default model | A recommended model if none is set (docs suggest GPT-6.2 Sol for everyday work) | Opus 5.5 on all Anthropic plans and the API |
| Default context window | 500,000 tokens for GPT-6.2 Sol, 272,000 for GPT-6.2 Astra (up to 1M via `model_context_window`) | Up to 1M tokens depending on the model |
| Project instructions file | `AGENTS.md` | `CLAUDE.md`; also reads `AGENTS.md` in supported setups |
| Config file | `~/.codex/config.toml` | `settings.json` (user, project, managed) |
| Headless / CI | `codex exec`, or an API key in CI | `claude -p`, or a Console API key |
| Cloud extras on plans | Automatic GitHub code review, Slack | Web and desktop apps, Remote Control |
| CLI source code | Open source, Apache-2.0 | Distributed by Anthropic |
What to change this week
- Claude Code on a plan: run
/modeland decide whether Opus 5.5 is what you want for routine edits. Switching routine work to Sonnet halves the per-token price on API billing, and on a plan it stretches your limits further. - Claude Code: run
echo $ANTHROPIC_API_KEY. If a key is set, Claude Code bills API rates instead of your subscription; details in Claude Code pricing. - Codex: open
~/.codex/config.toml, pinmodel = "gpt-6.2-sol"(or Astra deliberately), and delete anyapproval_policy = "untrusted"line. - Both in CI: use API keys, not personal plan logins, and set a spend limit on the key.
Which one to use
- Use Codex if you want sandboxing on by default, code you can audit, a $100 tier without a five-hour limit, or automatic code review on GitHub pull requests from your plan.
- Use Claude Code if your team trusts Claude models, wants the 1M-token context on Opus, or relies on its extension surface (hooks, skills, subagents, MCP servers); budget for Max or Ultra if you use it all day.
- Use both if you can afford two $20 plans: run Codex for sandboxed, autonomous tasks and Claude Code for long-context refactors, each in its own worktree. Our git worktrees guide shows the setup.
For the other terminal agents, including Copilot CLI, Antigravity CLI and OpenCode, see the best AI CLI coding agents. We will recheck these prices and defaults within 90 days.
Sources
- OpenAI, Codex pricing (plans, usage ranges, speed multipliers), checked 2 Dec 2026.
- OpenAI, Codex security: sandboxing, approvals and network, checked 2 Dec 2026.
- OpenAI, Codex models (recommended models, default context windows), checked 2 Dec 2026.
- Anthropic, Claude pricing, checked 2 Dec 2026.
- Anthropic, Claude Code docs: model configuration, permissions, sandboxing, memory and AGENTS.md, checked 2 Dec 2026.
- OpenAI, API pricing and Anthropic, Claude API pricing, checked 2 Dec 2026.
- Metarix arithmetic on published list prices; no agent session was run for this article.
Tools covered in this guide
Frequently asked questions
- Is Codex or Claude Code cheaper?
- Both start at $20 a month. On API keys, Codex with GPT-6.2 Sol and Claude Code with Sonnet 5.5 have identical list rates ($2 input, $10 output per million tokens), but Claude Code defaults to Opus 5.5 at twice that. At $100, Codex Pro currently has no five-hour limit; Claude needs Ultra at $200 for that.
- Is Codex CLI free?
- The Codex CLI code is open source under Apache-2.0, but using it needs ChatGPT Plus ($20 a month) or higher, or an OpenAI API key billed per token. Free and Go plans get Codex only in the desktop app, subject to rollout.
- Which is safer, Codex or Claude Code?
- They take different approaches. Codex runs commands in an OS sandbox with network off by default. Claude Code asks before most edits, commands and network requests by default, and its OS sandbox is turned on with /sandbox. Either is safe if you avoid full-bypass modes outside containers.
- Can Codex and Claude Code share project instructions?
- Partly. Codex reads AGENTS.md. Claude Code reads CLAUDE.md, and its memory docs describe when it also reads AGENTS.md, so shared rules in AGENTS.md can serve both; check the Claude Code docs for the cases where AGENTS.md support is unavailable.
- Which model does Claude Code use by default?
- Anthropic’s docs say the default is Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and the Anthropic API (Sonnet 5.5 on Microsoft Foundry). Run /model to switch.
More in Tools & workflows
Follow Metarix
Digital media intelligence hub
AI SaaS · developer workflows · architecture