Projects Blog Tools Music Contact
← All Posts
Tech July 13, 2026

Codex vs Claude Code: A Hands-On Comparison (2026)

By: Evgeny Padezhnov

Illustration for: Codex vs Claude Code: A Hands-On Comparison (2026)

Codex and Claude Code promise the same outcome: an AI agent that reads, edits, and runs code from the terminal. They get there differently. Codex is OpenAI's agent, built around a ChatGPT account and an open-source CLI. Claude Code is Anthropic's agent, built terminal-first around Claude models. The differences are not cosmetic. They change how work gets delegated, reviewed, and shipped.

This comparison covers architecture, setup, configuration, extensibility, and cost. It sticks to durable facts, not benchmark scores that shift every release. Numbers on SWE-bench move monthly and mean little for daily work.

Two tools, two philosophies

Claude Code runs as an agent loop in the terminal. It also ships an IDE extension for VS Code and JetBrains, a desktop app, and a web version at claude.ai/code. The terminal is the primary surface. Everything else mirrors it.

Codex is a family, not a single binary. The Codex CLI is open source and written in Rust. It lives on GitHub at openai/codex. There is also Codex cloud, a delegated agent that runs tasks in sandboxed cloud containers. Codex integrates directly into ChatGPT and offers a VS Code extension.

Key point: Codex CLI is open source. Claude Code is not. Developers can read Codex source, fork it, and audit its sandbox behavior. Claude Code ships as a closed npm package. For teams with strict supply-chain review, that difference matters.

In plain terms: Claude Code is one strong tool with mirrors. Codex is a set of entry points wrapped around one account.

Setup and models

Both install in minutes. Claude Code installs via npm: npm install -g @anthropic-ai/claude-code, then claude in a project directory. Codex installs via npm or Homebrew: npm install -g @openai/codex or brew install codex, then codex.

Authentication splits the same way as billing. Claude Code signs in through a Claude account (Pro or Max) or an Anthropic API key. Codex signs in through a ChatGPT account (Plus, Pro, Business, Enterprise) or an OpenAI API key.

Models are the obvious divide. Claude Code runs Claude's current lineup: Opus for hard tasks, Sonnet for balance, Haiku for speed. Codex runs GPT-5-class models tuned for code. Each agent is optimized for its own model. That coupling matters. The harness and the model are designed together, so raw model benchmarks do not predict agent quality.

Common mistake: judging either tool by a leaderboard number. The agent scaffold — how it plans, retries, and reads files — often decides success more than the base model.

Configuration: CLAUDE.md vs AGENTS.md

Both tools read a project instruction file. This file is where a repository teaches the agent its conventions, commands, and gotchas.

Claude Code reads CLAUDE.md. It loads hierarchically: a global file at ~/.claude/CLAUDE.md, then a project file, then nested directory files. Global rules override defaults. Project files pin build commands, test runners, and architectural notes.

Codex reads AGENTS.md. This follows the open AGENTS.md convention, a cross-tool standard now adopted by several agents. The format is plain Markdown with sections for build, test, and style. Claude Code also recognizes AGENTS.md alongside its own file, so a single AGENTS.md can serve both tools.

Key point: one well-written AGENTS.md reduces lock-in. It works across Codex, Claude Code, and other agents that adopt the standard. Teams switching tools keep their project context.

Try it: add a 20-line AGENTS.md with exact build and test commands. Both agents stop guessing and start using your real scripts. This single file removes most "wrong command" failures.

Permissions and sandboxing

Autonomy control is where the two tools feel most different in practice.

Claude Code uses permission modes. It asks before running commands or editing files by default. An allowlist grants standing permission to trusted commands. Plan mode lets the agent research and propose steps without touching the filesystem. Hooks fire on tool events — PreToolUse, PostToolUse, Stop — so teams can gate or log any action.

Codex pairs an approval policy with a sandbox mode (read-only, workspace-write, or full-access). It runs code inside an OS sandbox. On macOS it uses Apple's Seatbelt. On Linux it uses Landlock and seccomp. Network access is disabled by default in the sandbox. A full-auto shortcut runs unattended but stays boxed.

In practice, Codex leans harder on OS-level isolation. Claude Code leans harder on event hooks and explicit allowlists. Both aim to stop an agent from running rm -rf on the wrong directory. The mechanisms differ.

Common mistake: running either agent in full-auto on an unclean working tree. Commit or stash first. An agent that rewrites uncommitted work leaves no undo. Tested in production: a clean git state is the real safety net, not the sandbox.

Extensibility: MCP, hooks, subagents

Both tools support the Model Context Protocol, the open standard for connecting agents to external tools and data. MCP servers add database access, browser control, ticket systems, and custom APIs. A server written once works in both Codex and Claude Code. That portability is real and worth designing around.

Claude Code goes further on in-harness orchestration. It supports subagents — separate agent instances spawned for parallel search or scoped tasks. It supports skills, reusable prompt-plus-tool bundles invoked by name. It supports custom slash commands and a persistent memory directory. These features let one session fan out work across many contexts.

Codex focuses its extensibility on MCP and the open CLI. Because the CLI is open source, teams can patch behavior directly. Codex cloud adds a different axis: parallel task delegation. A developer files several tasks, and cloud containers work them independently, then return diffs as pull requests.

Key point: Claude Code parallelizes inside one session with subagents. Codex parallelizes across cloud containers. One scales context depth. The other scales task throughput. The right choice depends on whether the bottleneck is a single hard problem or many independent chores.

Cloud and delegation

Codex cloud is a headline feature. From ChatGPT or a GitHub repo, a developer assigns a task. A cloud sandbox clones the repo, works, runs tests, and opens a pull request. Several tasks run at once. Review happens on the resulting diffs. This suits well-scoped, independent work: bug fixes, dependency bumps, small features across many files.

Claude Code answers with its web version and background execution. It runs long tasks asynchronously and integrates with GitHub Actions for CI-triggered agent runs. The web app carries the same session model as the terminal. The emphasis stays on a driven, interactive session rather than fire-and-forget delegation.

In plain terms: Codex is stronger at "here are ten chores, come back with ten PRs." Claude Code is stronger at "sit with me and solve this one gnarly bug." Both can do the other. Each is tuned for one.

Where each tool wins

Neither tool wins outright. Fit depends on the workflow.

Claude Code fits deep, interactive sessions. Subagents, skills, hooks, and hierarchical memory reward teams that invest in configuration. The terminal-first design keeps a human in the loop on hard problems. Practice shows it excels when the task needs sustained reasoning across a large codebase.

Codex fits teams already living in ChatGPT and OpenAI billing. The open-source CLI wins on auditability and forkability. Cloud delegation wins on parallel chore throughput. The OS sandbox appeals to security-conscious teams that want isolation enforced by the kernel, not the agent.

Honest limitation for both: agents still produce confident wrong diffs. Neither tool removes code review. Both occasionally run a build command that does not exist, or edit the wrong file. If it works — it is correct, but verification stays a human job. Run the tests. Read the diff.

Another shared weakness: cost is hard to predict. Long agent sessions burn tokens fast. A single large refactor can consume a meaningful slice of a monthly quota. Watch usage on both.

Pricing

Pricing tracks the parent account, not a separate product.

Claude Code is included in Claude Pro at roughly $20 per month, and in Max plans at higher tiers for heavier limits. Pay-as-you-go through the Anthropic API is the alternative. Heavy Opus use raises API cost quickly.

Codex is included in ChatGPT Plus at roughly $20 per month, in Pro at a higher tier, and in Business and Enterprise plans. The OpenAI API is the metered alternative. Codex cloud usage draws on the same plan limits.

Key point: the subscription route is cheaper for steady daily use. The API route is better for automation and CI, where per-run metering and separate keys matter. Most teams end up using both: subscription for interactive work, API keys for pipelines.

What to try right now

Install both and run the same task in each. Pick a real, contained job: fix a failing test, add one endpoint, or upgrade one dependency. Give each tool an identical AGENTS.md with your exact build and test commands.

Watch three things: how each agent plans, how often it asks permission, and how clean the final diff is. That thirty-minute test tells more than any benchmark table. The better tool is the one that fits your review habits and your billing — not the one with the higher leaderboard score.

Information is accurate as of the publication date. Terms, prices, and regulations may change — verify with relevant professionals.

✦ Squeeze AI
  1. Codex CLI is open source (Rust, on GitHub) while Claude Code ships as a closed npm package — teams with supply-chain review requirements must account for this architectural difference when choosing between the two.
  2. Each agent is coupled to its own model family by design, so raw benchmark scores do not predict real-world agent quality; the scaffold — how the agent plans, retries, and reads files — often determines success more than the base model.
  3. Claude Code loads CLAUDE.md hierarchically (global file → project file → nested directory files), letting teams layer conventions from broad to specific without duplicating instructions.

Powered by B1KEY