Codex vs Claude Code: Which Coding Agent to Use (2026)
Codex vs Claude Code compared on sign-in, plans, approvals, resume, MCP and usage limits, plus how to run both on the same task to judge them on your repo.
ComparisonUpdated 10 min read
On this page
In the Codex vs Claude Code choice, pick Codex if you already pay for a ChatGPT plan or want an open-source CLI. Pick Claude Code if you already pay for a Claude plan, or if you want hooks that let another tool stop an action before it runs.
Both are terminal coding agents. Both edit your repo, show permission prompts before some actions and can resume earlier sessions. Because they are this close, the best tiebreaker is your own code. Run both on the same task in separate git worktrees and compare the diffs. This page covers the differences you notice day to day (sign-in, approvals, resume, MCP, usage limits) and shows how to run that side-by-side test.
The short answer
Pick Codex CLI if:
- You have a paid ChatGPT plan or an OpenAI API key and want your usage to come from that.
- You want an open-source CLI. Codex is licensed under Apache 2.0.
- You also use Codex in the cloud.
codex applybrings the latest diff from a Codex cloud chat into your local working tree.
Pick Claude Code if:
- You have a paid Claude plan (Pro or Max) or an Anthropic Console account.
- You want to connect the agent to other tools through hooks, including a hook that can block a tool call.
- You work in VS Code or Cursor and want Anthropic's official extension next to the terminal.
Use both if one keeps hitting its usage limit, or if you can't tell which writes better code for your project. The test below takes one task and two worktrees.
We make Sledbot, a Mac app that runs both agents (and others) side by side, so weigh our view accordingly. We've tried to be fair to both tools. Competitor facts below are as of November 2026.
Codex vs Claude Code at a glance
| Codex CLI | Claude Code | |
|---|---|---|
| Maker | OpenAI | Anthropic |
| Command | codex | claude |
| Sign in with | ChatGPT account, API key or access token (codex login) | Paid Claude plan, Anthropic Console account or a third-party provider (run claude) |
| Paid plans (third-party figures) | ChatGPT Plus $20/mo; Pro $100, $200 or $500/mo | Claude Pro $20/mo ($17/mo yearly); Max $100 or $200/mo |
| Resume a session | codex resume <id>, codex resume --last | claude --resume <id>, claude --continue |
| Can Sledbot block an action before it runs? | No. Sledbot mirrors and answers Codex's own prompts | Yes, through the PreToolUse hook |
| MCP servers | Supported | Supported |
| Subscription usage caps | Rolling 5-hour limits (per third-party pricing guides) | 5-hour billing windows (shown by ccusage blocks) |
| Licence | Open source, Apache 2.0 | Not stated in our sources |
Models, plans and price
Codex. The CLI itself is free. Usage comes from your ChatGPT plan or is billed through your OpenAI API account. As of November 2026, third-party pricing pages list:
- ChatGPT Plus: $20/month.
- Pro: $100, $200 or $500/month.
- Business: $20/user/month, billed annually.
Sources disagree on whether the Free and Go plans include Codex in the CLI, so check OpenAI's plans page before you rely on them.
Claude Code. Anthropic's support page lists the plans Free, Pro, Max, Ultra, Team and Enterprise, with Claude Code on the paid plans only. Third-party pages checked in October 2026 list:
- Pro: $20/month, or $17/month billed yearly.
- Max: $100/month (5x) or $200/month (20x).
- Team: from $20 per seat.
Instead of a subscription, you can also use Claude Code with an Anthropic Console account or a third-party model provider.
Neither agent has a free-choice model picker in Sledbot: both use their own vendor login. If you want a Claude Code-style workflow with other models, see OpenCode vs Claude Code.
Platforms and install
- Codex CLI: OpenAI's standalone installer covers macOS and Linux, and the CLI reference also describes behavior on Windows. Codex ships very often (640 tagged releases as of March 2026), so flags in older articles may be out of date. Check the Codex CLI docs.
- Claude Code: it runs as the
claudecommand in a terminal. It is also part of Anthropic's desktop app (macOS 13 or later, Windows 10 or later, and Linux in beta) and comes as a VS Code extension (VS Code 1.94.0 or later, plus Cursor and other VS Code forks). Some extension features need a recent Claude Code CLI version. See Anthropic's Claude Code docs, or our guide to installing Claude Code on a Mac.
Permissions and safety: how each asks before acting
Both CLIs show their own permission prompt in the terminal before they run certain actions. If you are tempted to turn prompts off entirely, read a safer alternative to --dangerously-skip-permissions first.
The difference shows up when you put another tool on top of the agent.
Claude Code has a hook that can block. Its PreToolUse hook lets an outside program see a tool call before it runs and stop it. In Sledbot, Claude Code's actions go through your approval rules and wait as cards in Needs you until you allow or deny them. Built-in rules always ask first for:
- pushes to protected branches;
- deploy and package-publishing commands;
- anything run with
sudo; rm -ror file writes outside the worktree.
Codex is detect-and-answer. Sledbot mirrors Codex's own on-screen permission prompt as a card and answers it by typing keys. It cannot stop an action that Codex runs without asking. Sledbot's settings put it plainly: "Agents without hooks can only be watched, not stopped."
So with Codex, its own prompts are your only guard. With Claude Code, a second layer can enforce rules on top.
One safety step works the same for both: give each agent its own git worktree so it can't touch your main checkout. See Claude Code worktrees. For git repos, Sledbot starts agents in a new worktree by default, under <repo>/.sledbot/worktrees/.
Resuming sessions and long-running work
Both agents keep conversation history and can pick it up again:
- Codex:
codex resume <id>orcodex resume --last. Codex also has session subcommands such ascodex fork,codex archiveandcodex queue. - Claude Code:
claude --resume <id>orclaude --continue.
An agent started in an ordinary terminal window ends when you close that window, and you resume the conversation later. To keep it working, run it inside a terminal multiplexer such as tmux. Our guide to keeping Claude Code running after you close the terminal covers the options.
In Sledbot, both agents run in a background engine, so quitting the app doesn't stop them. If a reboot or crash kills an agent, the engine runs that agent's own resume command in the same folder the next time it starts. Restart on a stopped agent brings it back with its conversation where possible.
MCP, hooks and extensibility
MCP. Both agents read MCP servers from their own config files, so if you use both, you configure each server twice. If you only use Claude Code, see adding MCP servers to Claude Code.
Sledbot writes each server you connect into both agents' configs at launch. Secrets are passed in the terminal's environment, not written into your project.
Hooks. Sledbot hooks into these Claude Code events on each launch: SessionStart, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, Notification and Stop. That is how it blocks actions and knows when Claude Code needs you (see get notified when Claude Code needs you). For Codex, Sledbot uses its notify hook, which reports status but can't stop an action.
Editor. Claude Code's VS Code extension adds inline diffs, @-mentions, plan review and conversation history inside the editor, and its Marketplace listing shows over 30 million installs. Codex leans the other way: an open-source CLI with frequent releases and a cloud side you can pull diffs from.
Usage limits and what happens when you hit one
On subscription plans, both agents work within rolling windows. Third-party pricing guides describe rolling 5-hour limits for Codex, and the ccusage tool's blocks command shows Claude Code's 5-hour billing windows. When you hit a limit, you wait for the reset or move to pay-per-use API billing.
To see what you've used:
- Claude Code:
ccusagereads Claude Code's local JSONL logs and gives daily, weekly, monthly and per-session reports without an account. See how to check Claude Code usage and limits. - Both agents in one view: Sledbot's Insights reads Claude Code and Codex logs, read-only, and shows tokens and cost by model, provider and agent. Each cost is marked exact or estimated from list prices.
Sledbot also lets a teammate use an ordered list of accounts (subscription logins or API keys). When one hits its limit, Sledbot:
- Sends Ctrl-C twice to stop the agent (and kills it if needed).
- Starts the next entry in the same worktree.
- Hands it a prompt with the task, the last plan,
git status --short,git diff --stat, thegit diff(cut at 12,000 characters) and the last 200 screen lines.
A Claude subscription is never chained into another Claude subscription. Some providers also restrict using several personal subscriptions this way, so check their terms. Details are in AI providers, accounts and fallback.
Run both side by side on the same task
Benchmarks measure someone else's code. A short test on your own repo tells you more. Pick a small, real task with a clear finish line, such as a failing test or a small feature with tests.
The free way: two git worktrees
In your repo, create a worktree and branch for each agent. This adds two folders next to your repo:
bash git worktree add -b try/codex ../myapp-codex git worktree add -b try/claude ../myapp-claudeOpen two terminal windows and
cdinto one new folder in each.Start
codexin the first window andclaudein the second.Paste the same prompt into both.
When both finish, run
git statusandgit diffin each folder to see what changed, then run your tests in each.From your main repo, remove the worktrees. Git refuses if a folder has uncommitted changes:
bash git worktree remove ../myapp-codex git worktree remove ../myapp-claude
This permanently deletes the branch and any commits that exist only on it:
git branch -D try/codexWhat this method can't do: you watch two windows yourself, nothing tells you which agent is waiting on you, and closing a window stops that agent.
With Sledbot: Compare agents
Sledbot's Compare agents does the same setup in one step for 2 to 4 agents. It needs macOS 14 or later, a git repository, and both CLIs installed and logged in.
- Add your repo as a space: File ▸ Add Project Folder… (⌘O, Command-O).
- Choose Agents ▸ Compare Agents…, or press ⌘K (Command-K) and run Compare agents….
- Type the task, choose Claude Code and Codex CLI, and click Start 2 agents.
- Each agent gets its own worktree on a branch named
compare/<slug>-<agent>-<n>, and both open side by side in one tab. - When an agent is done, click Review changes and go through its changes hunk by hunk. Press A to accept, R to reject, or C to send a comment back to the agent.
- Once every hunk is reviewed, click Merge or Open PR. Open PR needs the GitHub CLI (
gh).


Approval requests from both agents collect in Needs you, and Insights shows what each run cost. For every option, see Start an agent on a task and Review an agent's changes.
Sledbot is part of MacSuite; you can try it free for 7 days.
What to compare
- Did the tests pass, and did the agent run them on its own?
- How big is the diff, and did it stay inside the task?
- How often did it stop to ask you, and were those good questions?
- How much of your plan's window or API spend did it use?
Decision table
| If you… | Pick |
|---|---|
| Already pay for ChatGPT Plus or Pro | Codex |
| Already pay for Claude Pro or Max | Claude Code |
| Need an open-source licence for the CLI | Codex (Apache 2.0) |
| Want another tool to block the agent's risky actions | Claude Code (PreToolUse hook) |
| Pull work from a cloud session into your local tree | Codex (codex apply) |
| Work mostly inside VS Code or Cursor | Claude Code (official extension) |
| Keep hitting one plan's 5-hour window | Keep both available and switch when one is at its limit |
| Can't decide on output quality | Run both in worktrees on a real task |
For options beyond these two, see the best AI coding agents for Mac and how to run multiple Claude Code agents in parallel.
FAQ
Can Codex and Claude Code work on the same repo at once?
Yes, as long as each has its own git worktree. In a single checkout they would edit the same files and overwrite each other's changes.
Is Codex CLI free?
The CLI is free, open-source software, but using it needs a ChatGPT plan or an OpenAI API key. Sources disagree on whether the Free and Go plans include it, so check OpenAI's plans page.
Does Claude Code need a paid plan?
Anthropic puts Claude Code on its paid plans. You can also use it with an Anthropic Console account or a third-party provider.
Can I use two logins of the same agent on one Mac?
Not easily by default: logging in again with the same CLI uses the same config folder. Sledbot gives each account its own folder (through CLAUDE_CONFIG_DIR or CODEX_HOME), so several logins of the same CLI don't overwrite each other.