Claude Code vs Codex comes down to three things: the models behind them (Anthropic’s Claude vs OpenAI’s GPT models), how they keep you safe (permission modes vs an operating-system sandbox) and which subscription you already have. Both are terminal coding agents that read your repository, edit files, run commands, support MCP and take instructions from a file in your repo. For most day-to-day work either one will do the job.
This post compares the two honestly, without invented benchmarks, and then explains why a lot of people end up using both, and how to run them side by side without them getting in each other’s way.
What they are
Claude Code is Anthropic’s coding agent. You install it, run claude in a project folder and talk to it. It also exists as a desktop app, in VS Code and JetBrains, on the web and in CI, but the CLI is the core.
Codex CLI is OpenAI’s terminal coding agent. You run codex in a project folder. Its source is on GitHub (openai/codex), and OpenAI also offers Codex in an IDE extension, a desktop app and in the cloud.
The basic loop is the same: you describe a task, the agent reads the code it needs, proposes or makes edits, runs tests and reports back. The differences are in the details.
Claude Code vs Codex at a glance
| Claude Code | Codex CLI | |
|---|---|---|
| Maker | Anthropic | OpenAI |
| Command | claude | codex |
| Models | Claude models (Opus, Sonnet, Haiku families) | OpenAI GPT models, including Codex-tuned ones |
| Sign-in | Claude Pro, Max, Team or Enterprise, a Console account or a cloud provider | ChatGPT account or OpenAI API key |
| Safety model | Permission modes (Manual, accept edits, plan, auto) and an optional Bash sandbox | OS sandbox (read-only, workspace-write, full access) plus an approval policy |
| Project instructions | CLAUDE.md (reads AGENTS.md when there is no CLAUDE.md) | AGENTS.md |
| MCP | Yes, claude mcp add or /mcp | Yes, codex mcp add |
| Non-interactive runs | claude -p "..." | codex exec "..." |
| Built-in review | /review | /review |
| Switch model | /model | /model |
Models and plans
Claude Code runs Claude models. /model lets you switch between them, and /effort sets how hard the model thinks. Codex runs OpenAI’s models, and its /model command picks both the model and the reasoning effort.
Model versions change every few months, so a comparison that names exact versions goes stale fast. What lasts is this: each tool is built around its own vendor’s models and tuned for them. If your team already trusts one model family for code, that’s a reasonable tiebreaker.
On pricing, both work with a subscription or with pay-per-token API access:
- Claude Code signs in with a Claude Pro, Max, Team or Enterprise plan, with a Claude Console account (prepaid API credits), or through Amazon Bedrock, Google Cloud or Microsoft Foundry.
- Codex signs in with a ChatGPT account, using the Codex usage included in your ChatGPT plan, or with an OpenAI API key billed at API rates.
Subscription plans come with usage windows (a rolling 5-hour window and a weekly one), and heavier plans give more. Check the vendors’ pricing pages for current numbers. If you already pay for ChatGPT or Claude, start with the tool that comes with it. More on how the limits behave in Claude Code usage limits.
Sandboxing and approvals
This is the biggest real difference.
Codex: a sandbox first
Codex runs the commands it executes inside an operating-system sandbox. There are three sandbox modes:
- read-only: it can read files, but editing or running commands needs your approval.
- workspace-write: the usual default for local work. It can edit inside the project folder and run routine commands there. Network access is off by default.
- danger-full-access: no sandbox at all.
On top of that sits an approval policy (untrusted, on-request, never) that decides when Codex stops to ask. You change both with /permissions in a session. The flag --dangerously-bypass-approvals-and-sandbox turns everything off, and the name is honest about it.
Claude Code: permission modes
Claude Code starts from the other end: it asks before it acts, and you decide how much to let through. Press Shift+Tab to cycle the permission modes:
- Manual (
default): only reads run without asking. - Accept edits: file edits and simple filesystem commands go ahead.
- Plan mode: Claude researches and writes a plan but doesn’t edit source until you approve it.
- Auto mode: a second model, a classifier, reviews each action instead of you. Recent versions start in this mode by default.
You can add allow, ask and deny rules with /permissions, and turn on a Bash sandbox with /sandbox on macOS, Linux and WSL2. --dangerously-skip-permissions skips the prompts entirely; Anthropic’s docs say to use it only inside a container or VM.
What this means in practice
Codex’s default puts a wall around the agent, so a careless command can’t reach outside the project or the network. Claude Code’s default puts you, or a classifier, in front of each risky action. Neither makes an agent safe to run with full access on your main machine. If you want an agent to work unattended, give it a git worktree at minimum, and a container if it can run arbitrary commands.
CLAUDE.md vs AGENTS.md
Both tools read a Markdown file of project instructions at the start of every session: build and test commands, conventions, things to avoid.
- Codex reads
AGENTS.md. It looks in~/.codex/for global rules, then walks from the repo root down to your current folder, joining the files it finds. AnAGENTS.override.mdin a folder wins over theAGENTS.mdnext to it. The combined size is capped (32 KiB by default). - Claude Code reads
CLAUDE.md: a project one, a personal~/.claude/CLAUDE.mdand a git-ignoredCLAUDE.local.md. Anthropic suggests keeping each file under about 200 lines. Recent versions also readAGENTS.mdwhen there is noCLAUDE.md, and aCLAUDE.mdcan pull it in with an@AGENTS.mdimport.
Both have /init, which scans the repo and writes a first version of the file. Claude Code’s /init even offers to carry over an existing Codex or Gemini CLI setup.
If you use both tools, the simplest setup is one shared AGENTS.md with the real rules, and a short CLAUDE.md that imports it and adds only what’s specific to Claude.
MCP and tools
Both support MCP, the standard way to give an agent extra tools such as a browser, a database or an issue tracker. Claude Code manages servers with claude mcp add and the /mcp command; Codex uses codex mcp add and stores servers in its config file. Local and remote servers work in both. If MCP is new to you, start with what an MCP server is.
The catch when you use both tools: you configure every server twice, in two formats.
Strengths, honestly
Benchmarks for coding agents shift with every model release and depend heavily on the task, so here are the differences you can check yourself instead:
- Claude Code has a wide set of building blocks around the agent: subagents, hooks, skills, plan mode, checkpoints with
/rewind, and a large ecosystem of plugins. If you like to shape how the agent works, there’s a lot to configure. - Codex has a strong default sandbox, a clean config file, an open repository you can read, and
AGENTS.mdas its native format, which many other agents read too. - Both review code (
/review), resume old conversations, run headless in CI and follow instructions better when they’re short and concrete.
The honest test is simple: give both the same real task in your own repo (a bug with a failing test works well), let each finish, and compare the diffs. That tells you more than any leaderboard.
Why many people use both
Once you have both installed, using them together is natural:
- Second opinion. One agent writes the change, the other reviews it. A different model misses different things.
- Limits. When one plan’s window runs out mid-afternoon, the other tool keeps you going.
- Fit. Some tasks suit one model better. Having both lets you pick per task rather than per year.
The friction is coordination: two terminals, two sets of MCP config, two places to watch for approvals, and the risk that both agents edit the same file. That’s the same problem as running multiple coding agents in parallel, just with two vendors.
Running Claude Code and Codex side by side in AgentVera
AgentVera is a desktop app for macOS, Windows and Linux that opens Claude Code and Codex (and 16 other CLI agents) in real terminals, using the logins already on your machine. Your Claude and ChatGPT plans work as they are.
| Need | In AgentVera |
|---|---|
| See both agents at once | A grid per project, from 1×1 to 5×4; each pane shows the agent’s status and live context size |
| Keep them out of each other’s files | Worktree panel: create a worktree and start an agent right in it |
| Set how much each agent may do | Permissions in the agent dialog: Ask, Auto or Full access, per agent |
| Configure MCP once | MCP manager: register a server once and it attaches to both Claude Code and Codex |
| Have one check the other | Automatic code review: when a turn ends, a Claude model you choose reviews the code |
| Keep going when a limit runs out | Account switching with separate chains for Claude and Codex accounts |
A simple setup
- Add the project from the projects screen.
- Create two worktrees in the Git panel, say
feat/claudeandfeat/codex, or one for the feature and one for tests. - Open the agents. Under New agent, pick Claude Code for one and Codex for the other, choose each one’s worktree, model and effort. In Role and instructions, give each a narrow job, for example “build the endpoint” and “write tests for the endpoint, don’t touch src/”.
- Pick permissions. Ask is the CLI’s normal behaviour. Auto uses each CLI’s own auto mode. Full access never asks, so keep it to agents in a worktree or container.
- Review and merge. Turn on automatic review in the project settings, look at the findings in the Reviews tab, then merge the branches one at a time from the Git panel.
The grid, worktrees, code review and MCP manager are on the free plan. Account switching and flows (which pass one agent’s reply to another automatically) are on Pro and Team.
For a step-by-step worktree setup, see git worktrees for parallel agents. Weighing an AI IDE instead? Read Claude Code vs Cursor and Gemini CLI vs Claude Code.
Which should you pick?
- You already pay for Claude, or want plan mode, hooks and subagents: start with Claude Code.
- You already pay for ChatGPT, or want a strict sandbox by default: start with Codex.
- You hit limits, want a second opinion on important changes, or work on several tasks at once: use both, each in its own worktree.
Whichever you start with, keep your rules in AGENTS.md so switching later costs nothing. When you want both in one window, download AgentVera for free and open a Claude Code agent next to a Codex agent. For a wider look at the field, see the best AI coding CLI tools.