In Codex vs Claude Code, Claude Code with Claude Opus 5.5 passes more hard tasks, and Codex with GPT-6.1 Sol does each task for a fraction of the cost. On the Artificial Analysis Coding Agent Index, Claude Code scores 62 against 54 for Codex with GPT-6.1 Sol, but that Codex setup finishes a task for $1.50 at API prices against $11.42, in about 24 minutes instead of an hour. Both CLIs start at $20 a month.
So pick on what constrains you. Pass rate on long, difficult work favors Claude Code. Cost per task, plan limits, a sandbox that's on by default and an open-source CLI favor Codex. Versions checked: Claude Code 2.1.318 (3 November 2026) and Codex CLI 0.166.0 (29 October 2026). Prices are in US dollars, checked on 5 November 2026.
The short answer
- Pick Claude Code for the highest pass rate on long tasks. On the official Terminal-Bench 4.0 leaderboard, Claude Code with Opus 5.5 resolved 64.8% of tasks, against 58.2% for Codex with GPT-6 Astra or GPT-6.1 Sol.
- Pick Codex when cost decides it. On that same leaderboard, the full Codex run with GPT-6.1 Sol cost $0.6k against $4.7k for Claude Code with Opus 5.5, on 1.5B tokens against 8.0B.
- Pick Codex for safer defaults: its sandbox is on out of the box, including a native Windows sandbox, and the CLI is Apache-2.0. Claude Code's sandbox is off until you turn it on, and its code is proprietary.
- Effort settings narrow the gap. On SlopCodeBench at medium effort, Opus 5.5 and GPT-6.1 Sol finished within one checkpoint of each other and cost $193.47 and $178.51 for the same 196 checkpoints.
- The price ladders match at $20, $100 and $200. ChatGPT adds an $8 Go plan and a $500 Pro tier; Claude offers annual billing on Pro.

Codex vs Claude Code side by side
| Claude Code | Codex | |
|---|---|---|
| Version checked | 2.1.318, 3 Nov 2026 | CLI 0.166.0, 29 Oct 2026 |
| Default model | Claude Opus 5.5 at medium effort, on every plan and the API | A recommended model unless you set one; OpenAI points Plus and above at GPT-6.1 Sol |
| Other models | Sonnet 5.5, Haiku 5.5, Fable 5.2 | GPT-6 Astra, GPT-6.1 Terra, GPT-6 Sol, GPT-6 Luna |
| Context window | 1M tokens on Opus 5.5 | 500K by default for GPT-6.1 Sol in Codex |
| Lowest plan with the CLI | Claude Pro, $20 | ChatGPT Plus, $20 (Free and Go list only the desktop app) |
| Pay per token | Anthropic API key | OpenAI API key (CLI, SDK, IDE; no cloud features) |
| Surfaces | Terminal, VS Code and Cursor, JetBrains, desktop app, web and mobile, Slack, Chrome, GitHub Actions, GitLab CI/CD | CLI, IDE extension for VS Code, Cursor and Windsurf, Xcode and JetBrains integrations, ChatGPT desktop app, Codex Cloud, Slack, Linear, GitHub |
| Cloud tasks | Pro and above, counted against plan limits | Plus and above, not with an API key |
| Sandbox | Off by default; macOS Seatbelt, bubblewrap on Linux and WSL2; none on native Windows | On by default (workspace-write, network off); Seatbelt, bubblewrap, native Windows sandbox |
| Approval modes | Manual, acceptEdits, plan, auto (classifier), dontAsk, bypassPermissions | Auto preset, read-only, auto-review, --yolo |
| MCP | claude mcp add, project .mcp.json | codex mcp add, [mcp_servers] in config.toml |
| Config | ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, managed settings | ~/.codex/config.toml, .codex/config.toml in trusted projects, profiles |
| Instructions file | CLAUDE.md; reads AGENTS.md when no CLAUDE.md exists | AGENTS.md |
| Scripting | claude -p | codex exec |
| Other providers | Claude on Bedrock, Google Cloud, Microsoft Foundry | Bedrock, Vertex AI, any Responses API endpoint |
| Open source | No, "All rights reserved" | CLI, SDK and app server under Apache-2.0; IDE extension and cloud closed |
Two rows matter more than they look. Claude Code's default model is Opus 5.5 on Pro too since v2.1.280, so a $20 plan spends its limit on Opus unless you switch with /model sonnet, and Anthropic says the model you pick changes how fast you reach a limit. And Codex's repository is open source but doesn't accept outside pull requests; issues and root-cause reports are welcome.
Anthropic doesn't support routing Claude Code to non-Claude models through a gateway. Codex accepts custom providers, but current releases need a Responses API endpoint and reject Chat Completions-only ones.
Models and plan prices
Each agent comes bundled with its maker's chat subscription. The Claude pricing page and OpenAI's Codex pricing page list:
| Monthly price | Claude plan (includes Claude Code) | ChatGPT plan (includes Codex) |
|---|---|---|
| $0 | Free: no Claude Code | Free: GPT-6 Luna in the desktop app, subject to rollout |
| $8 | None | Go: GPT-6 Luna in the desktop app |
| $20 | Pro ($17 a month billed annually) | Plus |
| $100 | Max: 5x Pro usage | Pro 100 |
| $200 | Ultra: 10x Pro usage a week, no 5-hour limit for verified accounts | Pro 200 |
| $500 | None | Pro 500: adds Ultrafast mode |
| Team seat | Standard $25 monthly or $20 annually; premium (5x standard) $125 or $100 | Business: $25 monthly or $20 annually, 2 users minimum |
| Enterprise | $20 a seat billed annually, 20-seat minimum, plus usage at API rates | Contact sales |
Max, Ultra and all three ChatGPT Pro tiers bill monthly only. Max and Ultra also include $100 and $200 a month to spend on the Claude Platform API. OpenAI's Pro tiers article only says Pro 200 includes more than Pro 100 and Pro 500 the most, with no multiples. The Codex pricing breakdown and Claude Code pricing guide cover each side in more depth.
With an API key, you pay per token at list price:
| Model | Input / output per 1M tokens | Cached input |
|---|---|---|
| Claude Fable 5.2 | $8.00 / $40.00 | $0.20 |
| Claude Opus 5.5 | $4.00 / $20.00 | $0.20 |
| Claude Sonnet 5.5 | $2.00 / $10.00 | $0.10 |
| Claude Haiku 5.5 (prompts up to 100K) | $0.10 / $0.50 | $0.01 |
| GPT-6 Astra | $10.00 / $50.00 | $1.00 |
| GPT-6.1 Sol | $2.00 / $10.00 | $0.10 |
| GPT-6.1 Terra | $1.00 / $5.00 | $0.05 |
| GPT-6 Luna | $0.10 / $0.50 | $0.01 |
GPT-6.1 Sol costs half of Opus 5.5 per token, the same as Sonnet 5.5. On the OpenAI API, prompts over 272K input tokens are billed at 2x input and 1.5x output for the whole request; inside a ChatGPT plan, Codex applies no long-context surcharge. Anthropic bills Opus 5.5's full 1M window at the standard rate.
Usage limits
Neither company publishes a fixed number of tasks per plan. What each one does publish:
- Claude: Pro and Max have a five-hour session limit and a weekly limit; Ultra has only the weekly limit for verified accounts. Chat, the desktop app and Claude Code draw from the same pool. Past the limit you wait, upgrade, or switch on pay-as-you-go usage at API rates with a monthly spend limit. Check with
/usage. - Codex: OpenAI estimates local messages per five hours on Plus and standard Business seats: 5 to 45 on GPT-6 Astra, 15 to 160 on GPT-6.1 Sol, 35 to 285 on GPT-6.1 Terra and 350 to 3,000 on GPT-6 Luna. Cloud tasks use more. Pro plans currently have no five-hour limit; weekly limits still apply. Check with
/status. - Codex Fast mode uses the included allowance 2.5 times as fast, and Ultrafast 8 times. On Claude's API, Opus 5.5 fast mode costs 2x the standard price.
Two changes landed around the date checked. OpenAI's Pro tiers article, updated in early November, doubled the Work and Codex allowance on Pro 100 and Pro 500 and canceled the Pro 200 cut announced on 29 September. And from December, Plus, Pro and Business plans share one token-based allowance across ChatGPT and Codex, as Claude already does; Instant chat won't draw from it.
Sandboxing, permissions and config
This is where the two differ most in daily use.
Codex sandboxes every command by default. Its Auto preset (--sandbox workspace-write --ask-for-approval on-request) lets it read, edit and run commands in the working directory, with network access off, and asks before it writes elsewhere or goes online. .git, .codex and .agents stay read-only inside the workspace. On Linux and WSL2, install bubblewrap first; on Windows, PowerShell sessions use a native sandbox. --yolo removes both the sandbox and the prompts.
Claude Code relies on permission prompts first. Its sandbox is off until you run /sandbox or set sandbox.enabled, covers only shell commands (file tools, MCP servers and hooks run outside it), and doesn't run on native Windows. Once on, sandboxed commands can run without a prompt, and network traffic goes through a local proxy that checks each host against your allowed list. Both tools now have a model reviewing approval requests for you: auto mode in Claude Code, Auto-review in Codex.
A project setup in Claude Code, in .claude/settings.json:
{
"model": "opus",
"permissions": {
"allow": ["Bash(npm run *)"],
"ask": ["Bash(git push *)"],
"deny": ["Read(./.env)"],
"defaultMode": "acceptEdits"
},
"sandbox": {
"enabled": true,
"network": { "allowedDomains": ["github.com", "*.npmjs.org"] }
}
}
The same intent in Codex, in ~/.codex/config.toml (or .codex/config.toml in a trusted project):
model = "gpt-6.1-sol"
model_reasoning_effort = "medium"
sandbox_mode = "workspace-write"
approval_policy = "on-request"
[sandbox_workspace_write]
network_access = false
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
MCP works the same way in both. claude mcp add --transport http notion https://mcp.notion.com/mcp adds a remote server to Claude Code, and codex mcp add context7 -- npx -y @upstash/context7-mcp adds a local one to Codex. OpenAI notes that every MCP server adds context to each message and uses more of your limit, so disable the ones a task doesn't need.
Benchmarks: Terminal-Bench, Artificial Analysis and SlopCodeBench
This section uses only runs that include Opus 5.5 (released 22 September) and GPT-6.1 Sol (29 September); scores for earlier models don't carry over.
The official Terminal-Bench 4.0 leaderboard runs each model in its maker's agent, with an 8-hour limit per task. Cost and tokens are for the whole leaderboard run:
| Agent and model | Tasks resolved | Tokens | Cost of the run |
|---|---|---|---|
| Claude Code + Opus 5.5 (max) | 64.8% ± 3.1% | 8.0B | $4.7k |
| Claude Code + Sonnet 5.5 (max) | 61.8% ± 2.9% | 19.4B | $7.3k |
| Codex + GPT-6 Astra (max) | 58.2% ± 2.8% | 1.5B | $3.3k |
| Codex + GPT-6.1 Sol (max) | 58.2% ± 3.1% | 1.5B | $0.6k |
| Claude Code + Fable 5.1 (max) | 57.9% ± 3.8% | 2.7B | $6.2k |
| Codex + GPT-6 Sol (max) | 49.4% ± 3.2% | 5.0B | $1.5k |
The 95% confidence intervals of the top Claude Code and Codex entries don't overlap: 61.7% to 67.9% against 55.1% to 61.3%.
Artificial Analysis keeps a Claude Code vs Codex page that scores both agents on three benchmarks and measures cost per task at API prices:
| Agent and model, max effort | Index | FrontierCode | Terminal-Bench 4.0 | SWE-Atlas-QnA | Cost per task | Time per task | Tokens per task |
|---|---|---|---|---|---|---|---|
| Claude Code + Opus 5.5 | 62 | 56% | 63% | 66% | $11.42 | 1.0 h | 14.5M |
| Claude Code + Sonnet 5.5 | 59 | 48% | 66% | 64% | $13.30 | 1.3 h | 24.1M |
| Claude Code + Fable 5.1 | 58 | 49% | 58% | 66% | $11.53 | 35.3 min | 5.99M |
| Codex + GPT-6 Astra | 55 | 49% | 56% | 59% | $7.04 | 24.8 min | 3.23M |
| Codex + GPT-6.1 Sol | 54 | 49% | 53% | 60% | $1.50 | 23.7 min | 3.94M |
| Codex + GPT-6.1 Terra (xhigh) | 48 | 45% | 46% | 54% | $0.69 | 16.4 min | 6.89M |
Claude Code with Opus 5.5 took 146.4 turns per task to Codex with Astra's 39.4. Its cache hit rate was 95% (Codex with Astra: 93%), and a cache hit costs a twentieth of Opus 5.5's input price, so raw token counts overstate the cost gap.

Is the gap the agent or the model? Many Claude vs Codex comparisons mix the two. Vals AI ran Terminal-Bench 4.0 with the same minimal agent, mini-swe-agent, for every model (updated 29 October). Opus 5.5 passed 65.15% at $13.20 per task, GPT-6 Astra 59.60% at $9.58 and GPT-6.1 Sol 55.05% at $1.72. The ranking and the roughly 7.7x cost ratio survive without either maker's harness, so the difference follows the models more than the agents.
Effort changes the picture. Dex Horthy's SlopCodeBench run (15 October) makes agents extend their own code across 196 checkpoints of changing requirements:
| Model and effort | Strict passes | Core pass rate | Cost of the campaign |
|---|---|---|---|
| GPT-6 Astra, xhigh | 32 (16.33%) | 69.39% | $758.62 |
| GPT-6.1 Sol, medium | 29 (14.80%) | 65.82% | $178.51 |
| Opus 5.5, medium | 28 (14.29%) | 73.98% | $193.47 |
| Opus 5.5, xhigh | 25 (12.76%) | 71.94% | $817.04 |
At medium effort, Opus 5.5 costs 1.08 times what GPT-6.1 Sol costs, not 7.6 times. Opus 5.5 kept the core features of more checkpoints working (73.98% against 65.82%), while GPT-6.1 Sol had one more checkpoint with every test passing. Each setting ran once, so treat one-checkpoint gaps as noise. For cost per passing task across more models, including DeepSeek and Kimi, see Claude alternatives for coding.
Is Codex better than Claude Code?
Not on pass rate. Claude Code with Opus 5.5 leads Terminal-Bench 4.0 and all three parts of the Artificial Analysis index. Codex is better on cost, speed, token use and default safety, and on SlopCodeBench's strict score GPT-6 Astra and GPT-6.1 Sol edged ahead. The pass-rate gap is 6 to 7 points on the hardest public tasks, not a different class of tool.
So the honest answer is conditional:
- Codex is better if you're on a $20 plan and keep hitting limits, if you pay per token, if you run many agents in parallel, or if you work on native Windows.
- Codex is better if your security review requires an open-source client or a sandbox that's on before anyone configures it.
- Claude Code is better if a failed task costs you more than the tokens, as with long migrations or multi-hour debugging, and when Opus 5.5's 1M-token context helps on a large codebase.
- Claude Code is better if your company already pays for Claude Team or Enterprise seats, since every paid seat includes it.
- For quick, well-scoped edits, these benchmarks don't measure the difference, and developer reports split both ways. Pick the plan you already have.
For other agents in the same comparison, see Cursor vs Claude Code and Claude Code alternatives.
Monthly cost for the same usage
To price the same work on both, take Artificial Analysis's measured API cost per task (hard, multi-step tasks at max effort) and multiply by a month of 22 working days:
| Agent and model | Cost per task | 1 task a day (22) | 5 tasks a day (110) |
|---|---|---|---|
| Claude Code + Sonnet 5.5 | $13.30 | $292.60 | $1,463.00 |
| Claude Code + Opus 5.5 | $11.42 | $251.24 | $1,256.20 |
| Codex + GPT-6 Astra | $7.04 | $154.88 | $774.40 |
| Codex + GPT-6.1 Sol | $1.50 | $33.00 | $165.00 |
| Codex + GPT-6.1 Terra (xhigh) | $0.69 | $15.18 | $75.90 |

What the numbers mean for choosing:
- Heavy Claude Code users should subscribe. Five hard Opus 5.5 tasks a day cost $1,256.20 at API prices; Ultra costs $200, 84% less, if its weekly limit holds your month.
- Codex is the one where per-token billing can make sense. 110 GPT-6.1 Sol tasks cost $165.00, between the $100 and $200 Pro tiers, and an API key has no plan allowance to run out of, though it drops Codex Cloud and the other cloud features.
- Effort moves either bill a lot. These figures are at max effort; at medium, SlopCodeBench put Opus 5.5 within 8% of GPT-6.1 Sol's cost.
Anthropic's own figure for Claude Code at API prices, across enterprise deployments, is about $13 per developer per active day and $150 to $250 per developer a month, with 90% of users under $30 a day.
For a team of 10 billed monthly, seats cost the same on both: $250 for Claude Team standard seats or ChatGPT Business, $200 billed annually. Claude Team premium seats (5x the usage) cost $1,250 a month. Claude Enterprise, for 20 seats or more, adds $20 a seat to usage at API rates, so with Anthropic's average it comes to roughly $170 to $270 per developer.
To redo the table with your own volume:
# API cost per task from the Artificial Analysis Coding Agent Index v2.0
# (Claude Code vs Codex page, max effort), checked 5 Nov 2026.
COST_PER_TASK = {
"Claude Code + Opus 5.5": 11.42,
"Claude Code + Sonnet 5.5": 13.30,
"Codex + GPT-6 Astra": 7.04,
"Codex + GPT-6.1 Sol": 1.50,
"Codex + GPT-6.1 Terra (xhigh)": 0.69,
}
def monthly_cost(tasks_per_day, working_days=22):
tasks = tasks_per_day * working_days
return {setup: round(tasks * cost, 2) for setup, cost in COST_PER_TASK.items()}
for setup, dollars in monthly_cost(5).items():
print(f"{setup:32} ${dollars:,.2f}")
# Claude Code + Opus 5.5 $1,256.20
# Claude Code + Sonnet 5.5 $1,463.00
# Codex + GPT-6 Astra $774.40
# Codex + GPT-6.1 Sol $165.00
# Codex + GPT-6.1 Terra (xhigh) $75.90
The index's tasks are long and hard (Vals rates the median Terminal-Bench 4.0 task at four hours of expert work), so for everyday edits treat these as an upper bound and check the first week's real usage.
Using both
Many teams run one agent to write and the other to review, and the two now share setup.
Put project instructions in AGENTS.md. Codex reads it natively, and Claude Code reads it when the repository has no CLAUDE.md (v2.1.277 or later). If you keep a CLAUDE.md for Claude-only notes, start it with an @AGENTS.md line to import the shared file.
OpenAI also publishes a Codex plugin for Claude Code (Apache-2.0) that runs Codex reviews and hands off tasks from inside a Claude session. Usage counts against your Codex limits:
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
/reload-plugins
/codex:setup
/codex:review --background
To install the CLI itself, npm install -g @openai/codex works on every platform, and the Codex CLI install guide covers the standalone installers and sign-in.
What developers report
- "Opus 5.5 burns tokens like there's no tomorrow" (a Hacker News commenter on Claude Max who said GPT-6.1 Sol at Extra High in Codex "feels unlimited", 29 Oct 2026, link)
- "Codex caught back up with Sol-6.1" (a Hacker News commenter who mixes both agents and says Codex also uses far less memory, 2 Nov 2026, link)
- "at the moment it's night and day" (a Hacker News commenter who tries Codex regularly and still prefers Claude Code, 3 Nov 2026, link)
- A Hacker News commenter on the $20 Claude plan said they rarely get near the weekly limit using Opus 5.5 at medium effort, and canceled Codex after repeatedly reaching its limits (4 Nov 2026, link)
- "performance difference at this point is minute and is a matter of taste" (a Hacker News commenter whose company mostly moved to Codex, 27 Oct 2026, link)
- Dex Horthy's SlopCodeBench run found Opus 5.5 passed 28 checkpoints at medium effort and 25 at xhigh, while xhigh cost 4.22 times as much (HumanLayer on GitHub, 15 Oct 2026, link)
The limits reports conflict. The $20-plan commenter runs Opus 5.5 at medium effort, and the benchmarks show how much effort moves token use.
Where Aight fits
Neither agent can point at Aight. Claude Code speaks Anthropic's Messages API and current Codex releases need a Responses API endpoint, while Aight's API reference documents Chat Completions, embeddings and the model list.
For heavy agent work, a plan is the better buy. Aight charges list price for Opus 5.5 ($4.00 / $20.00), so the 110-task Opus month above costs $1,256.20 of usage there too. The 10% extra on each recharge brings that to about $1,176 after the 3% processing fee outside India, still far above $200 for Claude Ultra.
Aight fits the work around the agents: scripts, CI jobs and tools that take an OpenAI-compatible base URL, with Claude and GPT models on one prepaid balance, a monthly cap per key and an allowed-model list. Aider edits through plain text, so it doesn't need tool calling, which Aight's reference doesn't cover. Configured as an OpenAI-compatible provider:
export OPENAI_API_BASE=https://api.getaight.ai/v1
export OPENAI_API_KEY=sk-aight-...
aider --model openai/claude-opus-5-5
FAQ
Is Codex free?
Partly. ChatGPT Free and Go ($8) include Codex with GPT-6 Luna in the ChatGPT desktop app, subject to rollout. The CLI and IDE extension with GPT-6.1 Sol start at Plus ($20), or you pay per token with an API key. Claude Code isn't on Claude's Free plan and starts at Pro ($20, or $17 a month billed annually).
Can Claude Code run GPT models, or Codex run Claude?
Not with official support in Claude Code: Anthropic runs it on Claude models only, including through Bedrock, Google Cloud and Microsoft Foundry. Codex takes custom providers that expose a Responses API endpoint and has built-in Bedrock and Vertex AI providers. Benchmarkers have run both harnesses with outside models (Codex with DeepSeek V4.1 Flash, Claude Code with GLM-5.3), but support is then on you.
Which one uses fewer tokens?
Codex, by a wide margin. Artificial Analysis measured 3.94M tokens per task for Codex with GPT-6.1 Sol and 14.5M for Claude Code with Opus 5.5 at max effort, and the official Terminal-Bench run used 1.5B tokens against 8.0B. Lowering effort helps Claude Code most: on SlopCodeBench, Opus 5.5 at xhigh cost 4.22 times what it cost at medium.
Do chat messages count against coding limits?
On Claude, yes: chat, the desktop app and Claude Code share one pool on every paid plan. On ChatGPT, Codex shares its allowance only with agentic features such as ChatGPT Work until December, when Plus, Pro and Business move to one token-based allowance shared by ChatGPT and Codex. Instant chat won't count toward it.
Which works better on Windows?
Codex, for isolation. It ships a native Windows sandbox for PowerShell sessions and uses its Linux sandbox under WSL2. Claude Code installs natively on Windows through PowerShell, CMD or WinGet, but runs commands unsandboxed there; Anthropic's docs say to run it inside WSL2 to use the sandbox.
Sources
- Anthropic: Claude pricing, Release notes, Using Claude Code with Pro, Max or Ultra
- Claude Code docs: Overview, Model configuration, Costs, Permissions, Sandboxing, Settings, Settings reference, MCP, Memory and AGENTS.md, Cloud sessions, LLM gateways, Plugins
- Claude Code on GitHub: CHANGELOG, LICENSE; npm @anthropic-ai/claude-code
- OpenAI Codex docs: Pricing, Codex CLI, Models, Sandbox, Agent approvals and security, Permissions, Config basics, Configuration reference, MCP, IDE extension, Codex Cloud, Open source
- OpenAI Help Center: About ChatGPT Pro tiers, Understanding ChatGPT and Codex usage limits, Extra usage on personal plans
- OpenAI API: Pricing, GPT-6.1 Sol, Changelog
- OpenAI on GitHub: openai/codex releases, codex-plugin-cc; npm @openai/codex
- Benchmarks: Terminal-Bench 4.0 leaderboard and Terminal-Bench 4.0 announcement, Artificial Analysis Claude Code vs Codex, Vals AI Terminal-Bench 4.0, SlopCodeBench 10/2026 by HumanLayer
- Hacker News comments: 50285041, 50339369, 50350011, 50367744, 50259347
- Aider: OpenAI-compatible APIs
- Aight: Models and pricing, API reference
Checked on 5 November 2026. Updated 17 November 2026: Fable 5.2 prices and Aight's current model list; Claude Code 2.1.326 changes nothing else compared here.