Neither tool is better across the board. On Artificial Analysis's Coding Agent Index v2.0, the top Claude Code setup scores 62 and the top Codex setup scores 55, but Codex costs far less per task at API prices. Choose by three things: the score you need, the price per task, and which models you want to run. Plan limits matter too, and each vendor meters them differently.
Benchmark results: Claude Code leads on score
The Artificial Analysis Coding Agent Index v2.0 averages three tests: FrontierCode v1.1, which grades changes to real open-source repositories on whether a maintainer would merge them; Terminal-Bench 4.0, which covers terminal tasks; and SWE-Atlas-QnA-AA, which asks agents to trace and explain a codebase. Each task is attempted three times and the scores are averaged. The figures below are from the index's Claude Code vs Codex comparison page, read on 26 October 2026.
| Agent and model | Index | API cost per task | Agent time per task | Tokens per task |
|---|---|---|---|---|
| Claude Code, Opus 5.5 (max) | 62 | $11.42 | 1.0 h | 14.5M |
| Claude Code, Sonnet 5.5 (max) | 59 | $13.30 | 1.3 h | 24.1M |
| Claude Code, Haiku 5.5 (max) | 37 | $2.67 | 1.2 h | 16.1M |
| Codex, GPT-6 Astra (max) | 55 | $7.04 | 24.8 min | 3.2M |
| Codex, GPT-6.1 Sol (max) | 54 | $1.50 | 23.7 min | 3.9M |
| Codex, GPT-6 Luna (max) | 31 | $0.16 | 21.3 min | 8.9M |
Source: Artificial Analysis, Claude Code vs. Codex comparison, Coding Agent Index v2.0. Cost is the pay-per-token API price of a run, not a plan price. Time is agent wall time, which leaves out environment startup and verifier time. The methodology page sets out the rules.
Opus 5.5 leads GPT-6 Astra on each sub-test: 63% against 56% on Terminal-Bench 4.0, 56% against 49% on FrontierCode, and 66% against 59% on SWE-Atlas-QnA-AA. Sonnet 5.5 scores 59 at a higher cost than Opus.
Price per task: Codex is far cheaper for a near-equal score
GPT-6.1 Sol scores 54 for $1.50 a task. Opus 5.5 scores 62 for $11.42. Sol costs about 13% of Opus per task, for eight fewer index points. That ratio is our own calculation from the table, not a figure the index reports. GPT-6 Astra sits between them at 55 for $7.04.
Claude Haiku 5.5 is the cheapest Claude Code row at $2.67, but it scores 37, below both top Codex models. Per task, Opus also used about 3.7 times the tokens Sol did (14.5M against 3.9M, again our calculation). Plan allowances are not published in tokens, so treat that gap as a relative guide: on the same plan, a heavier token load means fewer tasks before the limit resets.
The per-task price only compares directly if you would pay API rates. If you pay a monthly plan, what counts is how far the plan's allowance goes, covered in the next section.
How long a plan lasts
Durability here means how far one plan's allowance stretches before its limits reset. The two vendors publish it in different units, so the numbers below cannot be compared head to head.
On Codex, OpenAI publishes estimates of local messages per five hours. On Plus, the estimates are 15 to 160 messages for GPT-6.1 Sol, 5 to 45 for GPT-6 Astra and 350 to 3,000 for GPT-6 Luna. Pro has no five-hour limit, though weekly limits may still apply. OpenAI calls these figures estimates, not fixed limits.
On Claude, Claude Code is included in Pro, with a session allowance that resets every five hours and a weekly limit on top. Max gives five or twenty times Pro's usage. Anthropic publishes multiples, not message counts.
The Plus range for Sol runs from 15 to 160 messages, which is wide. The only reliable test is your own week: run the same kind of task on each tool and note what each one's usage display shows afterwards. Both prices and limits are on the vendors' pages: Claude's pricing and Codex's pricing, checked on 25 October 2026.
Models: what each tool can run
Claude Code is built around Claude's models. Anthropic's gateway guide says it "doesn't support routing Claude Code to non-Claude models through any gateway" (code.claude.com/docs/en/llm-gateway). Claude Code can still run Claude models hosted by Amazon Bedrock, Google Cloud or Microsoft Foundry. The index's table does list two Claude Code runs on non-Claude models, Qwen3.8 Max and Step 5 Preview, so the benchmark setup and Anthropic's support statement differ.
Codex runs OpenAI's GPT-6 models by default. Its configuration guide lets you add a model provider in config. with wire_api = "responses", and its examples include an LLM proxy, a local Ollama server and Mistral (learn.chatgpt.com/docs/config-file/config-advanced). A custom provider must speak the Responses API, and the IDs openai, ollama and lmstudio are reserved. The index's table also lists Codex runs on DeepSeek V4.1 Flash.
In short, both tools can reach other models. Codex documents that route, and Claude Code's documentation says it is not supported.
Sandbox, permissions and source
Codex's security documentation says the agent runs with network access off by default. The CLI uses an OS-enforced sandbox that limits writes, typically to the current workspace, plus an approval policy that decides when it must ask first (developers.openai.com/codex/agent-approvals-security). Those are two settings: a sandbox mode and an approval policy.
Claude Code's sandbox is off by default. Turn it on with /sandbox. It covers shell commands only: file tools, MCP servers and hooks run outside it. It works on macOS, Linux and WSL2. On native Windows, Claude Code runs commands unsandboxed (code.claude.com/docs/en/sandboxing).
The Codex CLI is open source under the Apache-2.0 license, at github.com/openai/codex, so you can read, patch and fork it. We did not find an open-source license for Claude Code in this review.
Where each one fits
Choose Claude Code if you want Claude's models, the highest score in the comparison, or you already pay for Claude Pro or Max.
Choose Codex if the API price per task matters, you want an open-source CLI, you want the sandbox on from the first run, or you want to route work to a model your team hosts through the Responses API.
If you are still unsure, run the same task on both and compare the score you get with what each run costs you.
Can you use both, and switch when one runs out?
Yes, and it is the question that comes up most. One Reddit user asked it plainly: "Start coding with CC, then switch mid session to Codex when you hit the quotas? Would they compete and lose time/tokens on restyling?" (reddit.com/comments/1rqephk). A commenter in the same thread answered the first half: "Yes, you can mix the two, no issues." Whether the new agent wastes effort restyling the first one's work, that thread does not settle, and we have not tested it.
What carries over is the repository, not the conversation. Each agent starts from its own empty context, so the handoff is whatever you write down: the task, the decisions already made, the approaches you ruled out and the next step. Keep that note in the repo, and either agent can pick it up. Skills do not move automatically either. Before you assume a skill will run in both, check whether a Codex skill can run in Claude Code.
How do you keep one set of rules for both?
Put the shared rules in one file that both agents read, and keep the agent-specific notes apart.
- Write the shared rules in AGENTS.md: stack, build and test commands, and what done means.
- Keep the combined instruction files under 32 KiB, the default cap Codex applies.
- Let Claude Code read AGENTS.md in place of CLAUDE.md, or keep a short CLAUDE.md for Claude-only notes.
- Ask each agent at startup which instruction files it loaded, and fix any it missed.
The Codex side is documented. It reads a global ~/. first, then at most one file per directory from the project root down to where you work, and it stops adding files at the size cap (developers.openai.com/codex/guides/agents-md). Claude Code's memory documentation says it can read a repository's AGENTS.md in place of CLAUDE.md (code.claude.com/docs/en/memory). Anthropic's documentation also says instruction files are context, not enforced configuration. To block an action every time, use a PreToolUse hook. Put hard rules in tooling, and treat CLAUDE.md and AGENTS.md as strong guidance.
How do you see what each agent costs per task?
Plan limits hide the cost of a single task. Every request carries the system prompt, the tool definitions and the earlier messages, and those tokens count against your allowance whether or not the answer is useful.
We make cost-xray, an open-source project from Tigerless Labs. It captures the API traffic that Claude Code and Codex send, and splits tokens and dollars across the parts of each request, down to a single tool call. It needs no API keys and no account, and it only observes: it does not change what the agent does or what it costs. It captures from the day you install it, not your past history. Project page: tigerless.ai/labs/cost-xray. For the Claude Code side in detail, read how to see exactly what Claude Code sends to the API and what each part costs.
Conclusion
Use Claude Code if you want Claude's models, the top score in this comparison, or a plan you already pay for. Use Codex if the cost per task matters most, if you want an open-source CLI, or if you want to route work to other models. Pick the plan whose limits fit your week, not the one with the lowest sticker price. If you end up with both, keep one AGENTS.md, write the handoff note into the repo and switch by task.
The next step is small. This week, run one real task on each tool, record the score you get and the usage each one shows afterwards, and decide from your own numbers.
Explore Tigerless Labs for the other open-source agent tools we publish, or read more on the insights blog.
FAQ
Is Codex cheaper than Claude Code?
Per task at API prices, yes. In the Artificial Analysis index, GPT-6.1 Sol costs $1.50 a task and scores 54, while Opus 5.5 costs $11.42 and scores 62. On plans, both paid entry tiers cost $20 a month, so compare what each plan's allowance covers for your work.
Can Claude Code run models other than Claude's?
Anthropic's documentation says it does not support routing Claude Code to non-Claude models through any gateway. The Artificial Analysis table still lists two Claude Code runs on non-Claude models, so the benchmark setup and the official support statement differ. Check the current documentation before you rely on it.
Can Claude Code and Codex share the same instructions file?
Yes. Codex reads AGENTS.md directly, and Claude Code can read it in place of CLAUDE.md. Keep the combined instruction files under Codex's default 32 KiB cap so the rules are not cut short.
Do I need to pay for both?
Only if one plan's limits stop your work before the week ends, or you have two kinds of task and want a different agent for each. For most people, one plan covers the work.
Does switching agents lose my work?
The code stays in your repository, but the conversation does not move on its own. Write the task, the decisions and the next step into the repo before you switch, so the new agent starts from that note.
Which one should a beginner start with?
Start with the one you already pay for. Codex comes with any ChatGPT plan, and Claude Code comes with Pro. Learn one agent well before you split work across two.
