OpenAgents
Guides5 min read

Claude Code vs Codex: Same 3 Coding Tasks, Real Test

We gave Claude Code and Codex the same 3 coding tasks and graded them with hidden tests. Both scored 11/11. Codex was faster; Claude Code wrote more tests and caught an extra bug.

Is Claude Code better than Codex? Instead of arguing about it, we gave both agents the exact same three coding tasks on a small Python project and graded the results with hidden tests they never saw. Both passed every check. But they got there in very different ways, and only one of them caught a bug we never asked about.

Watch on YouTube

Claude Code vs Codex at a glance

Claude CodeCodex
Hidden checks passed11 / 1111 / 11
Total time (3 tasks)55 s38 s
Tests added169
Lines added15489
Flagged a bug we didn't ask aboutYesNo
Model usedOpus 5.5GPT-6.2 Sol
Starting priceClaude Pro, $20/moChatGPT Plus, $20/mo

Three small tasks with one run each is a quick real-world check, not a benchmark. We recorded everything on December 4, 2026.

How we tested

  • Same project: a tiny Python shop (cart, coupons, tax, a small command-line tool) with 3 passing tests to start.
  • Same prompts: typed once into each agent, word for word.
  • Default models: Claude Code on Opus 5.5 and Codex on GPT-6.2 Sol, both allowed to run commands without asking (Claude Code's auto mode, Codex with approvals off in a workspace-write sandbox).
  • Fresh copy per task: each agent started every task from the same clean copy of the project.
  • Hidden grading: after each run we ran acceptance tests the agents never saw, and counted the tests and lines each agent added.

Task 1: fix a bug

Prompt: "Two coupon tests are failing. Find the bug, fix it, and add a test for an unknown coupon code."

Tax was being applied before the discount. Both agents fixed it and added a test for an unknown coupon. (To be fair, the code had a comment pointing at the bug.)

  • Claude Code: 14 s, 3/3 hidden checks, +1 test, +7 lines
  • Codex: 13 s, 3/3 hidden checks, +1 test, +7 lines

Claude Code and Codex side by side fixing the coupon bug, with their results: both 3/3 checks.

Task 2: build a new feature

Prompt: "Add a BOGO coupon code: buy one, get the cheapest item free (one unit). Add tests and run the test suite."

Both got it right, including two units of the same item.

  • Codex: 11 s, 3/3 hidden checks, +3 tests, +26 lines
  • Claude Code: 16 s, 3/3 hidden checks, +5 tests, +28 lines. Its extra tests covered edge cases like an empty cart and a single item.

Task 3: make a command-line tool robust

Prompt: "Make cli.py robust: if the order file is missing, is not valid JSON, or has an item with a negative price or quantity, print a clear error message and exit with code 1 instead of crashing. Add tests and run the test suite."

This is where their styles split.

  • Codex: 14 s, 5/5 hidden checks, +5 tests, +56 lines
  • Claude Code: 25 s, 5/5 hidden checks, +10 tests, +119 lines. It also handled a missing file argument and non-numeric prices.

The scoreboard: both 11/11 hidden checks; Codex 38 s and 89 lines; Claude Code 16 tests added and an extra bug flagged.

The bug nobody asked about

While fixing the coupon bug, Claude Code added a note: "SAVE10 on a cart under $10 makes the total negative, because the discount isn't capped at the subtotal." That's a real bug in the project, and we never asked about it. Codex didn't mention it.

Claude Code's summary in the terminal, with the note about SAVE10 making the total negative highlighted.

What about harder tasks?

These were small tasks. On a harder public benchmark, the Terminal-Bench 4.1 leaderboard (max effort, as of November 30, 2026), Claude Code with Opus 5.5 solves 65.8% of tasks and Codex with GPT-6.2 Sol solves 61.5%. But Claude Code's full run cost about $4.7k, against about $0.3k for Codex: roughly 15 times more.

Terminal-Bench 4.1: Claude Code 65.8% vs Codex 61.5% of tasks solved; one full run costs $4.7k vs $0.3k.

Which should you pick?

Pick Codex if you already pay for ChatGPT (Codex CLI comes with Plus at $20/month), you want fast, lean changes, and value matters most.

Pick Claude Code if you want the most careful work, hard or messy problems matter most, and you don't mind paying more (Claude Pro is $20/month, Max $100/month; Claude Code isn't on the free plan).

Prices are as of November 30, 2026. For a deeper feature-by-feature comparison, see our Codex vs Claude Code guide.

Or use both

You don't have to choose. In OpenAgents Workspace, your local Claude Code and Codex sit in the same thread: let Claude Code plan and review, and let Codex build. Switching agents is just an @mention.

FAQ

Is Claude Code better than Codex?

In our test of 3 small coding tasks, both passed all 11 hidden checks. Codex was faster (38 s vs 55 s in total) and wrote less code; Claude Code wrote almost twice as many tests (16 vs 9) and flagged an extra bug. On the harder Terminal-Bench 4.1 benchmark, Claude Code scores higher (65.8% vs 61.5%) but costs about 15 times more per full run.

Is Codex faster than Claude Code?

In our test, yes: Codex finished the three tasks in 38 seconds in total and Claude Code in 55 seconds. The gaps per task were small (13 vs 14 s, 11 vs 16 s, 14 vs 25 s), and each task was run once.

Which is cheaper, Claude Code or Codex?

Both start at $20/month (ChatGPT Plus includes Codex CLI; Claude Pro includes Claude Code). On Terminal-Bench 4.1, a full Codex run cost about $0.3k versus about $4.7k for Claude Code.

Can I use Claude Code and Codex together?

Yes. OpenAgents Workspace connects your local agents to one thread, so one can plan or review while the other builds, and you switch between them with an @mention.

Sources

  • Test runs recorded by OpenAgents on December 4, 2026 (Claude Code 2.1.332 with Opus 5.5; Codex CLI 0.172.0 with GPT-6.2 Sol), one run per task, graded with hidden acceptance tests.
  • Benchmarks: Terminal-Bench 4.1 leaderboard, max effort, as of November 30, 2026.
  • Prices: claude.com/pricing and developers.openai.com/codex/pricing, as of November 30, 2026.
  • The presenter's voice and video in the video are AI-generated.