# Codex vs Claude Code: The Same 25 Real PRs, Two Harnesses

> Codex vs Claude Code on 25 real merged PRs: Claude Code solved 23 for $81.79, Codex 21 for $14.86. October 2026 prices, limits, sandboxes and when to pick each.

Most Codex vs Claude Code Reddit threads read like two people describing different weeks. One says Claude Code writes the better fix; the other says Codex never runs out of usage. Both are reporting something real, and neither is reporting a measurement.

We have one. Our benchmark ran both agents, stock, on the same 25 tasks taken from real merged pull requests, and the projects' own held-out tests decided pass or fail.

**The short answer:** Claude Code is the more thorough agent; Codex is the faster and far cheaper one. In [our 25-task benchmark](/blog/coding-agent-benchmark-real-prs) (2026-07-30 snapshot), Claude Code with claude-opus-5 solved 23 for $81.79 in 6.7 hours, and Codex with gpt-5.6-sol solved 21 for $14.86 in 1.0 hour. Default to Codex when a test suite or reviewer will catch a miss before merge. Default to Claude Code when nothing will. Or run Codex first and hand only its failures to Claude Code, which in our data matched Claude Code's 23 solves for about a third of its bill.

## Codex or Claude Code? The quick verdict

Codex wins on cost, speed and default safety; Claude Code wins on solve rate. Benchmark rows come from [our benchmark post](/blog/coding-agent-benchmark-real-prs); plan, sandbox and license rows were checked against vendor docs on 2 October 2026.

|                             | Codex                                                            | Claude Code                                                                     |
| --------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| Our benchmark (2026-07-30)  | 21/25 solved, $14.86, 1.0 h                                      | 23/25 solved, $81.79, 6.7 h                                                     |
| Cost per solved task        | $0.71                                                            | $3.56                                                                           |
| Entry plan for daily coding | ChatGPT Plus, $20/month (Free and Go at $8 get lighter access)   | Claude Pro, $20/month or $17/month billed yearly (Free excludes Claude Code)    |
| Heavy-use plans             | Pro at $100, $200 or $500/month                                  | Max 5x $100, Max 20x $200/month                                                 |
| Sandbox on first run        | OS sandbox on: writes limited to the workspace, network off      | Bash sandbox off until you run `/sandbox`; a classifier reviews actions instead |
| Sandbox on native Windows   | Yes                                                              | No (WSL2 only)                                                                  |
| Instruction file            | `AGENTS.md`                                                      | `CLAUDE.md`, or `AGENTS.md` when no `CLAUDE.md` exists (v2.1.277+)              |
| Models                      | GPT-6.1 Sol, GPT-6 Sol, Luna and Astra; local models via `--oss` | Opus 5.5, Sonnet 5.5, Haiku 4.5, Fable 5.1                                      |
| CLI license                 | Apache-2.0                                                       | Proprietary ("All rights reserved")                                             |

### Choose Codex if

- **Your tasks arrive specified and your CI catches regressions.** Codex finished every benchmark case in four minutes or less and cost $0.71 per solved task.
- **You want guardrails without configuring them.** Workspace-only writes and no network are the default, on macOS, Linux and native Windows.
- **You already pay for ChatGPT.** Plus at $20 includes the CLI, IDE extension, cloud tasks and GitHub code review.
- **You run many agents at once.** In parallel or in CI, a 5.5× cost gap and a 6.7× time gap multiply.
- **You want to read or patch the agent itself.** The CLI is Apache-2.0.

### Choose Claude Code if

- **A missed edge case costs more than the price gap.** Claude Code solved two benchmark cases where Codex's fix failed the maintainers' tests, and Codex solved none that Claude Code failed.
- **There's no test that would catch a miss.** If review is your only safety net, pay for the agent that misses less.
- **You want memory and triggers built in.** Claude Code writes its own [auto memory](https://code.claude.com/docs/en/memory) notes across sessions, and its cloud Routines can fire on GitHub events ([Claude Code overview](https://code.claude.com/docs/en/overview)).
- **Your team already standardized on Claude.** Every paid Claude plan includes Claude Code, and chat and terminal draw from one usage pool.

## What happened when both ran the same 25 real PRs

Both agents solved the same 21 tasks, so the whole Claude Code vs Codex gap is two cases, and both are thoroughness traps. The setup: 25 tasks harvested from PRs merged in 2026 across Python, PHP, Rust, C++ and JavaScript, each graded by the merged fix's own tests, which the agent never saw ([benchmark post](/blog/coding-agent-benchmark-real-prs)). Each tool ran its stock invocation, listed in the [octobench BENCHMARK.md](https://github.com/Muvon/octobench/blob/8aa39684ff6103782aacb1bd79ea98e96e50d6cf/BENCHMARK.md) at the pinned commit: `claude -p --output-format stream-json --dangerously-skip-permissions` on claude-opus-5, and `codex exec` on gpt-5.6-sol.

Only four of the 25 cases produced a failure from either agent. Pass/fail is the hidden tests' verdict; j is the LLM judge's 0–100 quality score:

| Case (language)                     | Codex                    | Claude Code               |
| ----------------------------------- | ------------------------ | ------------------------- |
| yaml-cpp octal scalars (C++)        | fail, j=40, $0.55, 4 min | pass, j=92, $2.19, 8 min  |
| guzzle cookie prefixes (PHP)        | fail, j=55, $1.32, 4 min | pass, j=95, $3.52, 9 min  |
| pino-pretty control characters (JS) | fail, j=72, $0.89, 3 min | fail, j=68, $4.21, 10 min |
| commonmark fenced-code tabs (PHP)   | fail, j=25, $0.36, 2 min | fail, j=55, $2.11, 6 min  |

The guzzle case is the clearest example of what "thoroughness" means here: a 27-line fix with three independent traps, where the obvious one-condition fix fails half the tests. The two cases both agents failed are harder still. Pino-pretty's hidden tests punish over-broad sanitizing, and commonmark's bug report came as a screenshot whose root cause sits in tab arithmetic.

Everywhere else, Codex was simply faster and cheaper. From the per-case table: Codex was cheaper on 24 of 25 cases and faster on 24 (one tie). Its median case cost $0.53 and took 2 minutes; Claude Code's median was $2.46 and 9 minutes. Claude Code's slowest case, Carbon's period-end sync, took 164 minutes and $15.31. Codex passed the same case in 3 minutes for $0.89.

When both passed, quality was close. The judge preferred Claude Code's diff in 11 of those 21 cases and Codex's in 3, with 7 ties, but the average scores differ by under a point: 93.0 against 92.1.

## Is Claude Code's thoroughness worth 5.5× the bill?

Only when you can't tell that Codex missed. If your tests or review catch Codex's failures, running Codex first and escalating just those failures to Claude Code reproduces Claude Code's solve count for a third of the money. The table is arithmetic on the benchmark's published per-case numbers, not a new run:

| Strategy                                    | Solved | Cost   | Agent time |
| ------------------------------------------- | ------ | ------ | ---------- |
| Claude Code on everything                   | 23/25  | $81.79 | 403 min    |
| Codex on everything                         | 21/25  | $14.86 | 60 min     |
| Codex first, Claude Code on Codex's 4 fails | 23/25  | $26.89 | 93 min     |

Going straight to Claude Code buys two extra solves for $66.93, or about $33 each. The cascade spends $12.03 on four escalations to get the same two.

The catch is detection. In the benchmark, hidden tests flagged the misses for us; in your repo, only your own suite or reviewer can. The cascade also isn't a cure-all: on the two trap cases Codex missed and Claude Code also missed, escalation spent $6.32 and fixed nothing.

So the rule I'd use: **escalate by detectability, not by difficulty.** Send Codex anything a test or reviewer will check before merge. Give Claude Code the first pass where nothing checks it, for example a module with no coverage or a spec that lives in someone's head. Keep review on both, because two of the 25 cases beat both agents.

## Codex vs Claude Code pricing in October 2026

Both start at $20 a month; they diverge at the top and in how they meter. Prices below come from [OpenAI's Codex pricing page](https://learn.chatgpt.com/docs/pricing), [Claude's pricing page](https://claude.com/pricing) and Anthropic's [Max plan article](https://support.claude.com/en/articles/11049741-what-is-the-max-plan), checked 2 October 2026.

| Tier                  | OpenAI (Codex)                                                       | Anthropic (Claude Code)                                                 |
| --------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Free                  | $0: quick tasks, GPT-6 Luna in the desktop app as it rolls out       | $0: no Claude Code                                                      |
| Budget                | Go, $8: lightweight tasks                                            | none                                                                    |
| Entry                 | Plus, $20                                                            | Pro, $20 monthly or $17/month billed yearly                             |
| Heavy use             | Pro, $100, $200 or $500                                              | Max 5x $100, Max 20x $200                                               |
| Teams                 | Business, $25/user monthly or $20 billed yearly (2+ users)           | Team standard seat $25 monthly or $20 yearly; premium seat $125 or $100 |
| Pay per token instead | API key: CLI, SDK and IDE only, no cloud features like GitHub review | Console API billing at token rates                                      |

If you bill Claude Code through the API instead, Anthropic's [Claude Code costs guide](https://code.claude.com/docs/en/costs) says enterprise deployments average about $13 a developer for each active day, or $150–250 a month per developer.

Limits in two lines. Claude meters a rolling five-hour window plus weekly caps, shared between chat and Claude Code, and Max buys 5× or 20× Pro's usage. Codex estimates 15–160 GPT-6.1 Sol local messages per five hours on Plus, OpenAI says Pro plans currently have no five-hour limit, and Plus and Pro users who hit a limit can buy additional credits. For the Claude side in depth, see our [Claude Code rate limits guide](/blog/claude-code-rate-limits-2026).

- **GPT-5.5 is leaving Codex.** OpenAI's [Codex models page](https://learn.chatgpt.com/docs/models) schedules its retirement from ChatGPT sign-in for October 14, 2026. Scripts and configs that pin `gpt-5.5` should move to `gpt-6-sol` or `gpt-6.1-sol`. API-key use isn't affected.
- **An exported `ANTHROPIC_API_KEY` changes how you pay.** Claude Code authenticates with the key instead of your subscription, so usage bills at API rates rather than drawing on Pro or Max ([Anthropic's Claude Code with Pro or Max article](https://support.claude.com/en/articles/11145838-use-claude-code-with-your-pro-or-max-plan)). Unset it if you meant to use the plan.
- **Fable isn't in Pro's allowance.** On Pro, Fable, Claude's most capable model, runs on paid usage credits; the Max plans list it at "50% of weekly limits" ([Claude pricing](https://claude.com/pricing)).

## Sandboxes and approvals: which one is safer to leave running?

Codex, out of the box. Its operating-system sandbox is on from the first run, while Claude Code's equivalent is off until you enable it. Claude Code's default protection is a model that reviews actions, not an OS boundary.

**Codex** recommends workspace-write mode with on-request approvals in version-controlled folders, and read-only everywhere else. Network access is off by default ([Codex approvals and security docs](https://learn.chatgpt.com/docs/agent-approvals-security)). The boundary is Seatbelt on macOS, `bwrap` plus seccomp on Linux, and a native sandbox on Windows. Even inside the workspace, `.git`, `.agents` and `.codex` stay read-only. `--yolo`, the alias for `--dangerously-bypass-approvals-and-sandbox`, turns all of it off.

I ran that boundary directly with `codex sandbox`, which executes a shell command under Codex's sandbox without calling a model (codex-cli 0.160.0, macOS):

```bash
# paths shortened; runs the command locally, no model call
codex sandbox --permission-profile :workspace -C ./ws -- sh -c \
  'touch inside.txt; touch <a-dir-outside-ws>/probe; curl -sS https://example.com'
```

The write inside `./ws` succeeded. The write to a project directory outside it failed with `Operation not permitted`, and curl failed with `Could not resolve host: example.com`. Under `:read-only`, even the in-workspace write failed. One surprise: my workspace sat under `/tmp`, and a write to its parent directory also succeeded, because Codex counts temp directories such as `/tmp` as part of the workspace. Anything you keep under `/tmp` is writable by the agent.

**Claude Code** sets behavior through [permission modes](https://code.claude.com/docs/en/permission-modes): `default` (shown as Manual), `acceptEdits`, `plan`, `auto`, `dontAsk` and `bypassPermissions`. Since v2.1.283, `auto` is the starting mode for interactive terminal and VS Code sessions, so a classifier model reviews actions in your place. The OS-level [Bash sandbox](https://code.claude.com/docs/en/sandboxing) is off by default. It uses Seatbelt on macOS and bubblewrap plus socat on Linux and WSL2, and it doesn't exist on native Windows. If it can't start, Claude Code runs commands unsandboxed unless you tell it to fail instead:

```json
{
	"sandbox": {
		"enabled": true,
		"failIfUnavailable": true
	}
}
```

That goes in `~/.claude/settings.json`. Running `/sandbox` in a session turns the sandbox on for one project instead, saved to `.claude/settings.local.json`. For unattended runs, both vendors document a least-privilege form:

```bash
# Codex: exec defaults to read-only, so grant workspace writes explicitly
codex exec --sandbox workspace-write "fix the failing test in tests/test_api.py"

# Claude Code: exact allowlist; anything that would prompt is denied
claude -p "run the test suite" --permission-mode dontAsk --allowedTools "Bash(npm test)" "Read"
```

The Codex failure mode follows from its [non-interactive docs](https://learn.chatgpt.com/docs/non-interactive-mode): a `codex exec` job in CI that "finishes" with an empty diff probably ran with the read-only default. Add `--sandbox workspace-write`.

## Can one repo serve both? AGENTS.md, CLAUDE.md and MCP

Yes. Write `AGENTS.md` once: Codex reads it natively, and Claude Code reads it too from v2.1.277 when no `CLAUDE.md` is present.

Codex builds its instructions by reading `~/.codex/AGENTS.md`, then walking from the repo root down to your working directory. It takes at most one file per directory, lets `AGENTS.override.md` win, and stops at 32 KiB by default (`project_doc_max_bytes`) ([Codex AGENTS.md guide](https://learn.chatgpt.com/docs/agent-configuration/agents-md)).

Under the default **Project instructions** setting (`claude-md-or-agents-md`), Claude Code skips `AGENTS.md` when a `CLAUDE.md`, `CLAUDE.local.md` or `.claude/CLAUDE.md` sits in your working directory or a parent of it ([Claude Code memory docs](https://code.claude.com/docs/en/memory)). Files in `.claude/rules/`, an org-managed `CLAUDE.md` and your personal `~/.claude/CLAUDE.md` don't count; they still load next to `AGENTS.md`. Switch the setting to `claude-md-and-agents-md` to load both. A `CLAUDE.md` up the path is the usual reason "my AGENTS.md isn't loading". If you need Claude-only lines, import the shared file instead of copying it:

```markdown
<!-- CLAUDE.md -->

@AGENTS.md

- Claude-only notes go below the import.
```

Going the other way, a repo that only has `CLAUDE.md` can feed Codex through a fallback filename:

```toml
# ~/.codex/config.toml
project_doc_fallback_filenames = ["CLAUDE.md"]
```

MCP servers port the same way. Here is one remote server added to each, with syntax confirmed against `claude mcp --help` (2.1.287) and `codex mcp add --help` (0.160.0):

```bash
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
codex mcp add sentry --url https://mcp.sentry.dev/mcp
```

Claude Code keeps local and user servers in `~/.claude.json`, and team servers in a committed `.mcp.json` with `--scope project` ([Claude Code MCP docs](https://code.claude.com/docs/en/mcp)). Codex writes `[mcp_servers.<name>]` tables to `~/.codex/config.toml`, or to a project's `.codex/config.toml` in trusted projects ([Codex MCP docs](https://learn.chatgpt.com/docs/extend/mcp)). Both also do hooks and skills now. Older comparisons that say Codex has neither predate the [Codex hooks docs](https://learn.chatgpt.com/docs/hooks).

## Codex CLI vs Claude Code: surfaces, models and licenses

The terminal tools are peers; the products around them differ. Codex is one piece of a ChatGPT subscription that also covers the desktop app and cloud tasks. Claude Code is one engine Anthropic ships into terminal, IDE, desktop, web and chat.

|                 | Codex                                                                                                                         | Claude Code                                                                                                                                                                        |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Surfaces        | CLI, IDE extension (VS Code, Cursor, Windsurf), ChatGPT desktop app, cloud tasks on web and iOS, GitHub review, Slack, Linear | Terminal, VS Code and Cursor, JetBrains, desktop app, web at claude.ai/code, Claude mobile app, Slack, GitHub Actions                                                              |
| Cloud tasks     | Codex Cloud: tasks keep running while your computer sleeps                                                                    | Cloud sessions on Pro, Max and Team; `claude --cloud` and `--teleport` move work between terminal and cloud                                                                        |
| Models          | GPT-6.1 Sol, GPT-6 Sol, Luna and Astra; GPT-5.6 models during the rollout; `--oss` for local Ollama or LM Studio              | Claude only: Opus 5.5, Sonnet 5.5, Haiku 4.5, Fable 5.1, via Anthropic, Bedrock, Google Cloud or Foundry                                                                           |
| Source          | [openai/codex](https://github.com/openai/codex), Apache-2.0, 127.6k stars; IDE extension and cloud closed                     | [anthropics/claude-code](https://github.com/anthropics/claude-code), 148.9k stars, [LICENSE](https://github.com/anthropics/claude-code/blob/main/LICENSE.md) "All rights reserved" |
| Version checked | codex-cli 0.160.0 (released 2026-10-01)                                                                                       | Claude Code 2.1.287 (released 2026-10-01)                                                                                                                                          |

Sources: the [Codex open-source page](https://learn.chatgpt.com/docs/open-source), the [Codex Cloud docs](https://learn.chatgpt.com/docs/cloud), Claude Code's [model configuration](https://code.claude.com/docs/en/model-config) and [cloud sessions](https://code.claude.com/docs/en/claude-code-on-the-web) docs. Star counts and releases are from the GitHub API on 2 October 2026.

The licensing row matters more than it looks. You can fork, audit and pin Codex's CLI. Claude Code's GitHub repo holds issues, plugins and examples under an all-rights-reserved license, so there's nothing you're licensed to fork.

Trying both costs one line each on macOS or Linux, per the [Codex CLI docs](https://learn.chatgpt.com/docs/codex/cli) and the [Claude Code overview](https://code.claude.com/docs/en/overview):

```bash
curl -fsSL https://chatgpt.com/codex/install.sh | sh   # Codex; or: npm install -g @openai/codex
curl -fsSL https://claude.ai/install.sh | bash         # Claude Code; or: brew install --cask claude-code
```

Then run `codex` or `claude` inside a project and sign in with the ChatGPT or Claude account that holds your plan.

## Where Octomind fits (we make it)

Octomind is ours, and it ran in the same benchmark: with glm-5.2, an open model, it solved 24 of 25 for $63.43 in 3.6 hours ([benchmark post](/blog/coding-agent-benchmark-real-prs)). Its README notes that run used a staged tap and a binary override, so it measured the full setup, not a bare install.

The relevant part for this decision is narrower. Octomind is one harness that runs both families. Models are `provider:model` strings (Anthropic, OpenAI and open models among them), and `/model` switches mid-session while session cost totals carry across the switch. So the cheap-first, escalate-on-failure pattern above becomes a model switch inside one session, not a tool switch. It reads `AGENTS.md` and has no instruction format of its own. `--sandbox` confines writes to the working directory through Landlock on Linux and Seatbelt on macOS.

Cons, plainly: a smaller community than either, a sandbox that restricts writes but not reads, and no approval prompts at all. Guardrails are scripts, so if you want a human click before every command, it isn't built for that. Longer comparisons: [Octomind vs OpenAI Codex](/blog/octomind-vs-openai-codex) and [Octomind vs Claude Code](/blog/octomind-vs-claude-code).

## What this comparison can't tell you

- **The models have moved.** The benchmark ran claude-opus-5 and gpt-5.6-sol on 2026-07-30. Today's recommended models are Opus 5.5 (Claude Code's `opus` alias) and GPT-6.1 Sol, and both list cheaper than their predecessors. Opus 5.5 lists $4/$20 per million input/output tokens against Opus 5's $5/$25, and GPT-6.1 Sol bills half GPT-5.6 Sol's credit rate per input and output token. We haven't rerun, so treat the solve gap as July's.
- **One run per case, 25 cases.** A two-task gap has no error bar; a rerun could move it a task either way.
- **Dollars are API token costs.** On Plus, Pro or Max you pay in limit consumption, not per run, and the five-hour and weekly windows decide your real capacity.
- **Stock means stock.** No tuning or custom prompts, and Claude Code ran with `--dangerously-skip-permissions`. A tuned setup may close or widen the gap.
- **It's our benchmark, and our product is in it.** That's why the per-case table, traces and judge verdicts are public at a pinned commit.
- **Not measured:** IDE and desktop UX, cloud task quality, PR review bots, frontend work.

**[Get Octomind](https://octomind.run)** — run Claude, GPT and open models in one harness, and switch mid-session when a task needs the thorough one.

## FAQ

### Is Codex better than Claude Code?

It depends on what a miss costs you. On our 25 real-PR benchmark (2026-07-30), Claude Code solved 23 tasks to Codex's 21, while Codex cost $14.86 against $81.79 and finished in 1.0 hour against 6.7. Codex is the better default when tests catch failures; Claude Code is the safer first pass when nothing will.

### Which is cheaper, Codex or Claude Code?

Codex, by a wide margin in our run: $0.71 per solved task against $3.56 for Claude Code at API rates. On subscriptions both start at $20 a month, ChatGPT Plus or Claude Pro. OpenAI says its Pro plans ($100, $200, $500) currently have no five-hour limit; Claude's Max plans ($100, $200) keep both five-hour and weekly windows.

### Is Codex free, or do you need ChatGPT Plus?

Partly. ChatGPT Free and Go ($8) include lighter Codex access. For daily coding, ChatGPT Codex comes with Plus ($20/month): the CLI, the IDE extension, cloud tasks, iOS, and GitHub code review. Claude Code is not in Claude's Free plan and starts with Pro at the same $20.

### Can Claude Code read AGENTS.md?

Yes, from Claude Code v2.1.277. Under the default setting it reads `AGENTS.md` when no `CLAUDE.md`, `CLAUDE.local.md` or `.claude/CLAUDE.md` exists in your working directory or a parent; your `~/.claude/CLAUDE.md` and `.claude/rules/` don't block it. If a project `CLAUDE.md` does exist, put `@AGENTS.md` at the top of it, or set Project instructions to `claude-md-and-agents-md` to load both. Codex reads `AGENTS.md` natively, so one file can serve both tools.

### Is Codex open source? Is Claude Code?

Codex CLI is open source under Apache-2.0 in the openai/codex repository; its IDE extension and Codex Cloud are not. Claude Code is not open source: its GitHub repository's license reads "All rights reserved" under Anthropic's Commercial Terms.
