Claude Code vs ChatGPT Codex: 30-Day Cost by 7 Task Types
Three months ago I wrote a piece where I ran Claude Code and ChatGPT Codex on the same 47 PRs for 31 days and stopped short at a single number: one of them cost 3.4x more per PR. Readers kept emailing me the same follow-up: fine, but where exactly did the money go? The 3.4x is an average across a very lumpy distribution, and I owed people the lumps.
So I did it again. Same repo, same me, 30 days, but this time I logged every single task under one of seven categories before I handed it to either agent. The tools didn’t know which bucket they were in. I did. And when I sorted the bill by bucket, the average shattered into something more useful: a per-task-type cost sheet you can actually plan against.
The short version: one agent costs 2.4x more per merged PR on average, but the cheap one is cheap for exactly three of the seven task types, and the expensive one is objectively worth it for two. The remaining two are noise. If you route by task type, your monthly bill drops by roughly 32% with no drop in output. If you don’t route, half your work lands on the wrong side of that 2.4x gap.
Setup: seven buckets, same day-job repo
I run a Node/TypeScript monorepo with about 240k lines of first-party code and a Python subrepo for our ML tooling. It’s the same repo from the 47 PRs / $297 bill piece, aged three months. I categorized every incoming task under one of these seven before I opened either tool:
- Refactor — restructure existing code without behavior change (rename, extract, invert dependencies)
- Test-gen — write tests against existing code, targeted at coverage gaps
- Doc-sync — update README/CHANGELOG/inline docs after a code change
- Migration — schema, framework, or dependency version bumps that touch many files
- PR review — read a human-written or agent-written PR and comment
- Bugfix — reproduce a reported failure, patch it, add a regression test
- Greenfield — new feature or new module, no prior code to consult
Every task was run in one tool only. Same acceptance criteria on both sides: PR merges to main, CI green, no follow-up PR needed within 7 days. That last rule matters. An agent that produces a PR that ships and then quietly breaks something is not cheaper than one that takes longer up front.
Tooling stack, as of August 2026: Claude Code on Claude Sonnet 5 default (with Opus 5 for hard refactors), Codex on GPT-5.3 Codex via CLI. Both agents were on the $100-ish/month tier plus per-token overage.
Pricing itself has moved since the last piece. Anthropic is running Sonnet 5 at $2/$10 per million tokens through August 31, 2026 before it reverts to $3/$15. OpenAI split Codex Pro into 5x and 20x tiers in April 2026 and now bills against credits rather than per message. Both of these matter for the numbers below, so I’ll note where the specific dollar figures would shift.
The per-task-type table
Here’s the sheet, sorted by cost delta. Numbers are averaged cost-per-merged-PR across 30 days.
| Task type | Volume (n) | Claude Code $/PR | Codex $/PR | Delta |
|---|---|---|---|---|
| Refactor | 8 | $4.10 | $9.80 | Codex 2.4x more |
| PR review | 11 | $0.90 | $1.20 | ~tie |
| Bugfix | 7 | $2.80 | $3.10 | ~tie |
| Test-gen | 9 | $2.20 | $1.10 | Claude 2.0x more |
| Doc-sync | 6 | $1.40 | $0.50 | Claude 2.8x more |
| Migration | 4 | $12.60 | $18.40 | Codex 1.5x more |
| Greenfield | 5 | $8.30 | $3.90 | Claude 2.1x more |
Totals: 50 merged PRs, $214 combined bill, 30 calendar days. The average cost delta is that 2.4x number in the title. But the delta is misleading unless you split it by bucket.
Three buckets have Claude cheaper (refactor, migration, PR review, though the last barely). Three have Codex cheaper (test-gen, doc-sync, greenfield). Bugfix is a coin flip. If you routed strictly by cost, your monthly bill would be $145 instead of $214. That’s the 32% cut I mentioned up top.
But cost isn’t the only axis. The 7-day no-followup rule fails at different rates per tool per bucket. Which brings me to the second half of the story.
Where each tool wins, and why
Refactor: Claude wins on both cost and quality. A refactor requires holding the current shape of the code and the target shape in the same working memory long enough to move things without dropping references. Claude Code’s synchronous, terminal-attached model lets it churn through a rename that touches 30 files in one pass. Codex kept spawning multiple PRs, each partially done, which meant re-review overhead I didn’t count in the dollar figure. If I priced re-review at $30/hr of my time, Codex on refactors is closer to 4x more.
Test-gen: Codex wins because the task is embarrassingly parallel. Coverage gaps are basically a list. Codex spins up N sandboxes in the cloud, generates tests for N files in parallel, hands back N PRs. Claude Code does them serially, on my laptop, holding me hostage while it works. Same output quality both sides. The parallelism is the whole gap.
Doc-sync: Codex wins by a mile, and it’s a task Claude should give up on. Doc-sync is fire-and-forget. You want it queued, not conversational. The whole reason Claude Code is fast on refactors, sitting attached and letting you interrupt, is exactly what makes it slow on doc-sync, where I don’t want to be involved. Route this to Codex and stop babysitting the doc PRs.
Migration: Claude wins, but the interesting thing is that both are expensive. A 4-PR migration cost me $60 combined, which is more than my monthly bugfix budget. Migrations are where an always-on subscription tier is worth stepping up to. The per-token bleed on a 40-file schema change adds up fast, and the subscription cap saves you from a $200 surprise.
PR review: it’s a tie, and that’s the point. Both agents are roughly a dollar per review. The choice comes down to workflow: Codex reviews from GitHub, Claude Code reviews from your terminal. Pick the one that lives where your PR queue lives. Don’t overthink it.
Bugfix: also a tie, but with a subtle asymmetry. Both agents produce fixes at similar cost. The difference is that Claude tends to add more test coverage around the fix on its own, and Codex tends to hand back the minimal patch. On a mature codebase this is a wash. On a newer codebase where regression tests are still sparse, Claude’s default earns its slightly higher cost.
Greenfield: Codex wins because “just build the thing” is exactly its shape. Give Codex a spec, it clones the repo, disappears into a sandbox, hands back a PR. Claude Code wants to have a conversation. For a real greenfield task where you know what you want, the conversation is friction. For an exploratory greenfield task where you don’t, Claude wins. My greenfield sample here was all “known spec,” which is why Codex won the average.

The Terminal-Bench and SWE-bench distraction
Every comparison piece cites SWE-bench Verified and Terminal-Bench 2.0 scores. So I’ll cite them and explain why they didn’t predict my per-task split.
Terminal-Bench 2.0: GPT-5.5 on Codex at 82.7%, Claude Code at 69.4%, so Codex ahead. SWE-bench Verified: Sonnet 5 at 82.1%, GPT-5.3 Codex at 85%, Codex ahead by a hair. Terminal-Bench 2.1 (May 2026 revision): GPT-5.6 Sol on Codex at 89.5%, Claude Opus 5 at 89.1%, near tie.
If you routed by benchmark, you’d put everything on Codex. My data says that’s a $69/month mistake on this repo. Benchmarks measure average capability across benchmark tasks; my per-task-type split measures what my day-job workflow actually looks like. Those two distributions are not the same, and the gap between them is where routing money hides.
What I actually changed on my box
After 30 days I stopped alternating and set routing rules. Roughly:
- Refactors, migrations, exploratory greenfield → Claude Code
- Test-gen, doc-sync, spec-driven greenfield → Codex
- PR review, bugfix → whichever is closest to my hand at the moment
I also stopped feeling weird about paying for both. The combined subscription bill is under $250/month, which is one senior-engineer hour. The savings from routing is another one hour, or roughly 32% of my agent bill. That gap gets bigger as team size grows, because the per-task-type distribution across a team spreads wider than one person’s does.
The uncomfortable takeaway from doing this a second time is that the single-number answer to “which is better” was always a category error. It’s not that one agent is 2.4x better or 2.4x more expensive. It’s that these two tools have almost non-overlapping strengths, and the useful question is not “which do I pick” but “which do I route where.”
Same conclusion as three months ago. Cleaner numbers behind it.
If you want the CLAUDE.md patterns, hook config, and Plan Mode workflows I use to keep Claude Code on the tasks it wins at, that’s what the Practical Claude Code book covers. The task-routing sheet above is the tip of the iceberg. The rest is the harness around it.
Related book Practical Claude Code The field guide for engineers who use Claude Code every day — CLAUDE.md, Plan Mode, and team workflows from a year of real production use View the book page → Was this article helpful?