Claude Code and Codex are the same kind of tool: a coding agent that runs in your terminal, reads the repository, edits files and runs commands. Claude Code is Anthropic’s and runs the Claude models. Codex is OpenAI’s and runs the GPT models. The differences that matter day to day are the instructions file each one reads, how each one is fenced in by default, and what the plan you pay for lets you use. I gave both the same small job. Both fixed all six planted bugs; Codex took 1 minute 33 seconds and wrote 22 tests, Claude Code took 2 minutes 48 seconds and wrote 310.
Claude Code is my daily tool. In October I wrote that my whole Codex history was four threads in an editor extension. Since then I’ve started using the Codex CLI as the fallback when my Claude usage limit runs out, so this post updates that one. I tested with Claude Code 2.1.330 and Codex CLI 0.171.0.
Claude Code vs Codex: the differences#
| Claude Code | Codex CLI | |
|---|---|---|
| Made by | Anthropic | OpenAI |
| Source | Proprietary | Open source, Apache-2.0 |
| Project instructions | CLAUDE.md; reads AGENTS.md only when there is no CLAUDE.md | AGENTS.md, from ~/.codex and from each folder between the repository root and where you are |
| Default safety | Asks before it edits files or runs commands; looser permission modes and a sandbox are opt-in | In a git repository: a workspace-write sandbox with the network off, and approvals on request. Outside one: read-only |
| Non-interactive | claude -p | codex exec |
| Extending | MCP servers, skills, plugins, hooks, subagents | MCP servers, skills, plugins, hooks, subagents |
| Where it runs | Terminal, desktop app, web, editor extensions | Terminal, editor extension, the ChatGPT desktop app, cloud tasks |
| Plans that include it | Pro $20 a month, Max $100, Ultra $200 | ChatGPT Plus $20 a month, Pro from $100 |
The extension row is the same on both sides, and I checked it against both sets of docs. Both tools now have skills in SKILL.md folders, plugins, hooks around tool calls and subagents, so the feature list no longer decides it.
The safety row is the real difference in feel. Codex starts inside a sandbox and mostly gets on with it. Claude Code starts by asking, and you choose how much to loosen that. I run Claude Code with permissions bypassed most of the time, which is my choice and not its default.
The same task in both#
The job was the one from my ultracode test: a throwaway Python library of six small modules, about 100 lines, with one planted bug in each and a README stating the intended behaviour. The prompt asked for pytest tests for every module, a test run, and fixes for whatever the tests revealed. A checker the agents never saw had one assertion per planted bug.
| Claude Code | Codex CLI | |
|---|---|---|
| Model | Fable 5.2, medium effort | GPT-6 Luna, medium reasoning |
| Time | 2 min 48 s | 1 min 33 s |
| Planted bugs fixed | 6 of 6 | 6 of 6 |
| Tests written | 310 | 22 |
| Output tokens | 17,828 | 3,806 |
| Cost reported | $1.37 at API list prices | None; token counts only |
Both did the job. Codex did it in a little over half the time and wrote about a fifth of the output. Claude Code wrote fourteen times as many tests and went looking for trouble the README never mentioned, such as a crash on a digit-like character. Which of those you want depends on the task. For a fallback on a small job, Codex’s short answer is what I’m after.
These aren’t the two companies’ best models against each other. GPT-6 Luna was the strongest model my ChatGPT Plus sign-in could use in the CLI. When I asked for GPT-6.2 Sol, which OpenAI’s docs recommend for everyday coding, the CLI refused: “not supported when using Codex with a ChatGPT account”. So the table shows what each tool gives me on the plans I pay for. It’s also one run each on a tiny repository.
Three things went wrong on the Codex side before that clean run, and each is worth knowing.
It hung on standard input. Started from a script, codex exec printed “Reading additional input from stdin…” and sat there for twelve minutes until I stopped it. Closing standard input fixed it:
codex exec --json -s workspace-write \
"write tests for every module and fix what they find" < /dev/nullIt couldn’t find my tools. Codex runs each command through a login shell, and the virtualenv I had put on PATH didn’t survive that. python3 -m pytest reported that pytest wasn’t installed, and installing it failed because the sandbox has no network.
It carried on anyway, and said so. On that run Codex wrote the tests and fixes without being able to run anything, fixed five of the six bugs, and ended its report with a plain statement that the suite still needed running somewhere pytest exists. I’d rather have that than a claim that everything passes. Once the prompt named the interpreter, it got all six.
The fix for the second problem belongs in the instructions file, which the section on AGENTS.md below covers.
What does Codex cost next to Claude Code?#
I pay for Claude Max and ChatGPT Plus.
On the OpenAI side, the Codex pricing page says Codex comes with the ChatGPT plans, and the CLI is listed from Plus up. Plus is $20 a month. Its limits are counted as local messages per five-hour period, and the page gives a range for each model, 350 to 3,000 for GPT-6 Luna, with the warning that these are estimates and that weekly limits may also apply. Pro starts at $100 a month and currently has no five-hour limit. You can also sign in with an API key and pay per token.
On the Anthropic side, the pricing page has Pro at $20 a month, Max at $100 and Ultra at $200, all with Claude Code included. Pro and Max have a five-hour session limit and a weekly limit, shared between the Claude apps and Claude Code. Max is described as five times Pro’s usage.
Neither company publishes absolute numbers you could compare, so I can’t tell you which $20 goes further. What I can say is that the two limits run on separate clocks. When one runs out, the other is usually untouched, and that is the whole reason a second $20 plan earns its place beside a larger one.
How I use both: Codex as the fallback#
When Claude’s limit runs out in the middle of something, I open Codex in the same repository and keep going. That’s the only time I reach for it.
It works for small, clear tasks, the well-scoped kind where it’s obvious when the job is done. The measured run above is that kind of job, and Codex was quick and correct on it. I save the bigger and fuzzier work for when Claude is back. That includes anything that needs a long investigation, a design choice, or the context that has built up in a Claude Code session over an afternoon. A fresh Codex thread has none of that context.
So this is no verdict on which is better. My setup, my habits and months of project notes are all built around Claude Code. Codex gets the jobs that need none of that.
Switching mid-task: what AGENTS.md does#
A switch is only cheap if the second tool knows the project’s rules. Codex reads AGENTS.md before it does anything. In my test its first command was a search for one. Claude Code reads CLAUDE.md, and reads AGENTS.md only if there is no CLAUDE.md at all.
The repositories I switch in keep an AGENTS.md beside the CLAUDE.md. The arrangement I’d recommend puts the shared rules in AGENTS.md, with a CLAUDE.md that imports it and adds the few Claude-only lines:
@AGENTS.md
## Claude Code
- Notes that only apply to Claude Code go here.After my test, one line I’d put in every AGENTS.md is where the tools are: the interpreter or virtualenv to use, and how to run the tests. Claude Code inherited my shell’s PATH. Codex didn’t, and had no way to guess.
It also helps to commit before switching. The second agent then starts from a clean diff, and you can see what each one changed.
The short version#
Claude Code and Codex now have nearly the same feature list. They differ in the file they read (CLAUDE.md or AGENTS.md), in their defaults (Claude Code asks first, Codex starts sandboxed with the network off), and in what your plan gives you. On one small measured job both fixed every planted bug; Codex was faster and terse, Claude Code slower and far more thorough. I use Claude Code daily and Codex on a $20 plan as the fallback when Claude’s limits run out, for small, clear tasks only. A shared AGENTS.md makes that switch cheap.
Further reading#
On this site:
How I Run Claude Code Day to Day: tmux, Permission Modes and My Phone, for the setup Claude Code sits in and my first, short try of Codex
Claude Code Worktrees: Running Parallel Agents Without Collisions, for keeping two agents out of each other’s files
What Is Ultracode in Claude Code? Workflows, Cost and When to Use It
Elsewhere:
- Custom instructions with AGENTS.md in the Codex docs
- Agent approvals and security in the Codex docs, for the sandbox and approval defaults
- How Claude remembers your project in the Claude Code docs, for
CLAUDE.mdand theAGENTS.mdimport - The Codex CLI repository, for the source and the licence
