← Agentic AI Tools

Claude Code vs Codex (Codex vs Claude Code)

Two local coding agents tested on the same failing JavaScript test with observed patches and timings.

Both Claude Code and OpenAI Codex fixed the same failing JavaScript test with a minimal 1-line patch and passed independent test reruns (2/2 tests passing). Codex finished slightly faster on this fixture (45s vs 52s), while both required paid plans or API billing. Checked .

Codex vs Claude Code at a Glance

DimensionClaude CodeOpenAI Codex
CLI version testedClaude Code CLI 2.1.322Codex CLI 0.171.0
Elapsed time (same fixture)52 seconds45 seconds
Independent npm test rerun2/2 passing (0 test edits)2/2 passing (0 test edits)
CLI source availabilitySource-available npm/CLI distributionOpen-source CLI (Apache-2.0 on GitHub)
Billing & accessPaid Claude plan (Pro/Max/Team) or Anthropic APIPaid ChatGPT plan (Plus/Pro/Business) or OpenAI API
MCP & Skills supportNative MCP servers + .claude/skills SKILL.mdNative MCP servers + .agents/skills SKILL.md
Best everyday fitDeep terminal refactors, multi-file explanations, Anthropic ecosystemFast CLI diffs, open-source harness, cloud + local Codex workflows

The shared brief

Reusable prompt
Fix the failing cart total test in this small repository. Return the final total in integer cents after applying the discount. Preserve the API and the passing behavior. Update the implementation, keep the existing tests intact, and run npm test.

Each tool starts from the same independent checkout (1 passing, 1 failing at baseline). The evaluator reruns npm test outside the agent and inspects the diff.

Observed verification capture

Terminal benchmark verification comparing Codex vs Claude Code on the failing cart.js test fixture, showing 1/2 baseline failure and 2/2 passing tests after each 1-line patch
Independent Node.js test runner verification of the baseline fixture (1/2 passing) and the observed 1-line patches produced by Claude Code and OpenAI Codex (both 2/2 passing, zero edits to cart.test.js).

Observed results

Claude Code

Result
Changed cart.js to round subtotal * (100 - discountPercent) / 100. Independent npm test rerun passed 2/2 tests with zero test-file edits.
Elapsed time
52 seconds (Claude Code CLI 2.1.322)
Access and cost
Paid Claude plan or Anthropic API billing. The first headless attempt hit a sign-in error; the successful run loaded existing local user settings. Per-run token cost was not separately metered.

Observed patch (cart.js)

--- a/cart.js
+++ b/cart.js
@@ -1,4 +1,4 @@
 export function totalInCents(items, discountPercent = 0) {
   const subtotal = items.reduce((sum, item) => sum + item.unitPriceCents * item.quantity, 0);
-  return subtotal - Math.round(subtotal * discountPercent / 100);
+  return Math.round(subtotal * (100 - discountPercent) / 100);
 }

OpenAI Codex

Result
Changed cart.js to subtract the unrounded discount before rounding the final total. Independent npm test rerun passed 2/2 tests with zero test-file edits.
Elapsed time
45 seconds (Codex CLI 0.171.0)
Access and cost
Paid ChatGPT subscription or OpenAI API billing. Used an existing ChatGPT login. Per-run token cost was not separately metered.

Observed patch (cart.js)

--- a/cart.js
+++ b/cart.js
@@ -1,4 +1,4 @@
 export function totalInCents(items, discountPercent = 0) {
   const subtotal = items.reduce((sum, item) => sum + item.unitPriceCents * item.quantity, 0);
-  return subtotal - Math.round(subtotal * discountPercent / 100);
+  return Math.round(subtotal - subtotal * discountPercent / 100);
 }

Both Claude Code and OpenAI Codex produced clean, mathematically equivalent 1-line fixes without modifying tests. Because both are reliable on small bug fixes, your choice usually comes down to existing subscription coverage (Claude vs ChatGPT), whether you want Codex's open-source CLI harness, and how each performs on your own multi-file repository.

Related guides

Fix code in an existing repoGive an agent a reproducible failure and get a reviewable patch with test output.Open Source AI AgentsCompare licenses, runtimes, and self-hosting requirements across open-source agents.AI Coding AgentsCompare CLI, IDE, and browser coding agents for real repositories.Best Free AI AgentsSee which AI agents offer genuinely usable free tiers or open-source runtimes.

Frequently asked questions

Is Codex faster than Claude Code?

On our verified two-test JavaScript checkout benchmark, OpenAI Codex CLI (0.171.0) completed the patch and test run in 45 seconds compared to 52 seconds for Claude Code CLI (2.1.322). Latency varies by model tier, prompt size, and API load, so run both on a representative test in your own repository.

Can I use Claude Code or OpenAI Codex for free?

No full free tier is included for either agent. Claude Code requires a paid Claude subscription or Anthropic API credits, while Codex requires an eligible paid ChatGPT subscription or OpenAI API billing (even though the Codex CLI repository itself is open source). For coding agents with free starter tiers, check our Best Free AI Agents guide.

Did either tool modify the test file to make the test pass?

No. We inspected git diff after both runs and confirmed zero modifications to cart.test.js. Both agents edited only cart.js with a single-line rounding fix and passed independent npm test reruns (2/2).

Do both Codex and Claude Code support MCP servers and SKILL.md skills?

Yes. Both CLIs support connecting Model Context Protocol servers such as GitHub MCP, Playwright MCP, and Context7 MCP, and both can load reusable SKILL.md instruction packs.