Skip to content

Guide library

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

Bar chart: API cost of the same 30-turn agent session, Codex GPT-6.2 Sol $0.85, Claude Code Sonnet 5.5 $0.85, Claude Code Opus 5.5 $1.70, Codex GPT-6.2 Astra $3.40
Metarix, original editorial graphic from OpenAI and Anthropic list prices, Dec 2, 2026

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.

Codex vs Claude Code plans, as of 2 Dec 2026
TierCodex (OpenAI)Claude Code (Anthropic)
FreeFree and Go ($8): GPT-6 Luna in the desktop app only, subject to rolloutNot included on Free
$20Plus: CLI, IDE extension, web and iOS, plus cloud code review and SlackPro ($17 billed annually): CLI, IDE and desktop; five-hour and weekly limits
$100Pro $100: no five-hour limit at presentMax: 5x Pro usage; five-hour and weekly limits; $100/month API credits
$200Pro $200Ultra: 10x Pro weekly; no five-hour limit for verified accounts; $200/month API credits
$500Pro $500: adds Ultrafast mode—
Business / TeamBusiness: $20/user/month billed annually, $25 monthly, 2+ usersTeam: Standard seat $20 annual / $25 monthly; Premium seat $100 / $125
EnterpriseContact sales$20/seat/month annual plus usage at API rates, 20-seat minimum
Pay per tokenAPI key (CLI, SDK, IDE; no cloud features)Claude Console API key
Sources: OpenAI Codex pricing page and Anthropic Claude pricing page, checked 2 Dec 2026. Plan allowances are described differently by each vendor and are not directly comparable.

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:

Bar chart: API cost of the same 30-turn agent session, Codex GPT-6.2 Sol $0.85, Claude Code Sonnet 5.5 $0.85, Claude Code Opus 5.5 $1.70, Codex GPT-6.2 Astra $3.40
API cost of one assumed 30-turn agent session on four model choices: 40K-token context cached once and re-read on every turn, 3K new input and 1.5K output per turn. Arithmetic on OpenAI and Anthropic Standard list prices checked 2 Dec 2026, not a measured run. Graphic: Metarix.

Scroll the table horizontally on smaller screens.

Cost of the same assumed session, USD, Standard rates checked 2 Dec 2026
Agent and modelInput / output per 1MCache write / read per 1MSession 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
Metarix arithmetic: 40K cache write + 1.2M cached reads + 90K fresh input + 45K output. Rates from OpenAI API pricing and Anthropic Claude API pricing. Real sessions differ: each agent sends different context, and the two vendors’ tokenizers cut the same text into different numbers of tokens.

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 .git and .claude and should only be used in containers or VMs. Use acceptEdits or auto plus /sandbox instead, and block bypass in managed settings with permissions.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 project trust_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.

Codex vs Claude Code: working details, as of 2 Dec 2026
DetailCodexClaude Code
Default modelA 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 window500,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 plansAutomatic GitHub code review, SlackWeb and desktop apps, Remote Control
CLI source codeOpen source, Apache-2.0Distributed by Anthropic
Sources: OpenAI Codex docs (models, config reference, security, pricing) and Anthropic Claude Code docs (model configuration, permissions, sandboxing), checked 2 Dec 2026.

What to change this week

  1. Claude Code on a plan: run /model and 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.
  2. 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.
  3. Codex: open ~/.codex/config.toml, pin model = "gpt-6.2-sol" (or Astra deliberately), and delete any approval_policy = "untrusted" line.
  4. 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

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

Share