Codex CLI vs Claude Code: Same Bug, Same Token Price, $0.05 Against $0.09 to $0.10 per Fix
Codex CLI and Claude Code fixed the same bug and passed the same hidden tests. Codex used fewer tokens in every run. Here is where the difference comes from.
Updated November 18, 2026: rewritten around our own test of both tools. The April launch coverage this post used to carry (computer use, plugins, memory) is gone, because we never tested those features.
Codex and Claude Code now sit at the same price twice over. Both sell a $20 plan, ChatGPT Plus and Claude Pro, and the everyday models behind them, GPT-6.2 Sol and Claude Sonnet 5.5, both cost $2 per million input tokens and $10 per million output. So we gave both tools the same bug and counted what each one spent on it.
Both fixed it, every time. Codex did it for $0.053. Claude Code's list-price figure was $0.103 at high effort and $0.090 at medium.
How we tested: One bug-fix task ran four times in Claude Code 2.1.323 (Claude Sonnet 5.5) and twice in Codex CLI 0.170.0 (GPT-6.2 Sol, through an API key on OpenRouter) in November 2026, each run in a fresh copy of the same small Python repository. Eight hidden tests the agents never saw graded every run. Every number below comes from those runs.
What did each tool spend on the same fix?
The task is the one we used for OpenCode and Pi. Two support tickets describe usage landing on the wrong invoice. Behind them are a boundary bug and a time-zone bug in three small files. The agent has to find both, fix them, keep the existing tests passing and add tests of its own. The untouched code passes 2 of the 8 hidden tests.
| Codex CLI + GPT-6.2 Sol | Claude Code + Sonnet 5.5, effort high | Claude Code + Sonnet 5.5, effort medium | |
|---|---|---|---|
| Hidden tests passed | 8 of 8, 8 of 8 | 8 of 8, 8 of 8 | 8 of 8, 8 of 8 |
| Cost per fix | $0.054, $0.051 | $0.108, $0.098 | $0.086, $0.094 |
| Input tokens per run | 65,597 and 52,797 | 135,857 and 111,833 | 89,384 and 90,403 |
| Output tokens per run | 1,226 and 942 | 4,267 and 3,953 | 3,037 and 3,619 |
| Tests the agent added | 3 and 2 | 5 and 3 | 3 and 5 |
| Wall time | 23 s and 12 s | 32 s and 30 s | 25 s and 27 s |
Codex's cost is what OpenRouter billed our key. Claude Code's cost is its own list-price figure. It ran on a Claude subscription, so no money changed hands for those runs. Prices per token are from OpenAI's and Anthropic's pricing pages, both checked November 18, 2026. Treat the wall times loosely. Codex ran inside a Docker container, Claude Code ran on the host, and one pair of runs overlapped.
Codex ran with its own sandbox off, because the container was the sandbox. Claude Code ran with a short list of pre-approved commands, and in one high-effort run that list refused a read command and cost it one extra request.
Two runs per column is a small sample. The two Codex runs agreed with each other, and so did each pair of Claude Code runs, which is why we stopped there.
Why was Codex cheaper when the token prices are the same?
Three things, and you can see all of them in the logs.
Its requests are smaller. Both tools read the code in one step. Claude Code made 6 and 5 model requests at high effort and 4 at medium. Codex logs one total per run, and its steps and totals fit 5 requests in run 1 and 4 in run 2. Every request sends the whole conversation again. The average request was about 13,000 tokens in Codex and about 22,000 in Claude Code.
It starts smaller. A Codex session that only says "ok" sent 11,618 tokens of instructions and tool definitions. Claude Code's first request on this task, task text included, was 19,954 tokens. Every later request carries that base again, mostly from cache.
It wrote far less. Codex produced 1,226 and 942 output tokens. Claude Code produced about four times that at high effort. Thinking is a small part of the gap. Claude Code reported 464 and 586 thinking tokens at high effort. Codex, with no reasoning setting, reported 45 and 50. So this compares the tools as we configured them, not at equal reasoning. We didn't run Codex at a higher effort.
Did the extra thinking buy Claude Code anything here? Not on the hidden tests. Both tools passed all eight every time. Claude Code added 5 tests in two runs and 3 in the other two. Codex added 3 and 2.
Where does the money go inside each bill?
In both tools, the biggest line is writing the prompt to the cache.
For Codex, cache writes were 68% and 74% of each run's bill. Run 1 wrote 14,742 tokens to the cache at $2.50 per million, which is $0.037 of a $0.054 total. And the second run, two minutes later, wrote about 15,000 tokens again. One codex exec session didn't reuse the cache of the one before it. In our setup (OpenRouter, --ephemeral) each short job paid that entry fee. We didn't check OpenAI's API directly. Claude Code did reuse one. In every run its first request read 13,423 of its roughly 20,000 tokens from a cache that already existed, and wrote only the rest. A cold start would also pay to write those tokens, about $0.03 more at the five-minute rate. That's arithmetic, not a run.
For Claude Code at high effort, run 1 breaks down like this.
- Cache write, 13,150 tokens at $4.00 per million: $0.053
- Output, 4,267 tokens at $10.00: $0.043
- Cache reads, 122,695 tokens at $0.10: $0.012
On a subscription, Claude Code writes its cache with a one-hour lifetime, which Anthropic prices at twice the input rate. With an API key its default is the five-minute cache (checked November 18, 2026) at $2.50, and the same run would be $0.088, and the high-effort average $0.084. That's arithmetic from the price list, not a run. Even on that basis Codex's $0.053 is lower. We measured the one-hour cache and what it does to a subscription limit in our Claude Code limit test.
How do these runs sit next to the other agents we tested?
Same task, same hidden tests, earlier dates. These were not rerun today.
| Agent and model | Date | Fixes | Cost per fix |
|---|---|---|---|
| Codex CLI 0.170.0 + GPT-6.2 Sol | Nov 18, 2026 | 2 of 2 | $0.053 |
| Claude Code 2.1.323 + Sonnet 5.5, effort high | Nov 18, 2026 | 2 of 2 | $0.103 |
| OpenCode 2.0.29 + GPT-6.1 Terra | Nov 4, 2026 | 2 of 2 | $0.053 |
| OpenCode 2.0.29 + Sonnet 5.5 | Oct 15, 2026 | 3 of 3 | $0.078 |
| Pi 1.5.2 + Sonnet 5.5 | Nov 12, 2026 | 1 of 1 | $0.039 |
Codex, OpenCode + Sonnet and Pi are billed amounts. Claude Code and Terra are list-price figures.
Nobody failed this bug. What changes from row to row is how much context each agent sends and how many round trips it makes. The Terra row also runs a model that costs half as much per token. Claude Code is the most expensive row in this table.
What do the $20 plans give you?
We could not test this part, and it's the part the $20 buys. We have no ChatGPT plan, so Codex ran on an API key. What follows is from the vendors' pages, checked November 18, 2026.
ChatGPT Plus is $20 a month and includes Codex in the CLI, the IDE extension, the web and iOS. OpenAI estimates 17 to 180 local messages per five-hour window on GPT-6.2 Sol for Plus, and says those are estimates, not fixed limits. Pro starts at $100 a month and has no five-hour limit.
Claude Pro is $20 a month, or $17 a month billed yearly, and includes Claude Code with a limit every five hours and every week. Max is $100 with 5x Pro's usage. Ultra is $200 and has no five-hour limit for verified accounts.
Neither page turns its limit into tokens. So our numbers tell you how hungry each tool is per task, and they don't tell you how many tasks a $20 plan covers. Our test also used an API key for Codex, and we didn't check whether a ChatGPT login sends the same requests.
Which one should you pick?
If you pay per token, for CI jobs or scripts or because you refuse subscriptions, Codex CLI on GPT-6.2 Sol did this job for $0.053 against $0.084 for Claude Code at high effort on five-minute cache pricing, about a third less, with the same result. That figure assumes Claude Code starts on a warm cache, which ours did. Watch the cache write on short jobs.
If you already pay for Claude Pro or Max and it covers your week, nothing here is a reason to move. Both tools fixed the bug on every attempt. Claude Code spent more tokens doing it, and on a plan those tokens come out of an allowance you've already paid for.
If you're choosing a first $20 plan, this test can't settle it, and we'd be guessing if we said otherwise. One small Python bug says nothing about a large repository or a three-hour session. Try your own task on both. Codex CLI is open source, so the API-key route above costs a few cents to try.
Got a task where the two came out differently? Tell us on X at @devtoolpicks.
Frequently Asked Questions
Can I use Codex CLI without a ChatGPT subscription?
Yes. Codex CLI is open source and runs with an API key, and OpenAI's Codex pricing page lists an API Key option next to the ChatGPT plans (checked November 18, 2026). We ran it that way for this test, through OpenRouter, with a custom provider in its config file. You then pay per token. Our fix cost about five cents on GPT-6.2 Sol. What you don't get with a key is the plan allowance, and we didn't test the features that need a ChatGPT login.
Get honest tool comparisons in your inbox
Join 50+ indie hackers and solo developers who get new comparisons, pricing changes, and tool picks. No spam. Unsubscribe anytime.
Related Articles
Moving From Cursor to Claude Code: Which Cursor Rules Still Work (5 Rules, 36 Test Sessions)
Claude Code read none of a project's five Cursor rules until we ported them. The...
Pi vs Claude Code: An 8x Smaller Prompt and a Third of the Cost on One Bug Fix
We gave Pi the billing bug Claude Code and OpenCode fixed in October, on the sam...
Prompt Caching on Claude, GPT and Gemini, Measured: Same Price, Different Bills
Claude Sonnet 5.5, GPT-6.1 Sol and Gemini 4 Argon list the same cache price. We...