Claude Code vs Codex: which is better

Claude Code vs Codex CLI compared: what Codex CLI is, how the two agents differ on safety, project files and skills, and how to run both with Claude.

· 5 min read

Claude Code vs Codex is the comparison most developers make once they try an agent in the terminal. Both read your project, edit files and run commands on their own, yet they are built around different ideas. This guide explains what Codex CLI is, compares the two point by point and shows how to run both with Claude models.

New to Claude Code itself? Start with what Claude Code is and how to use it.

What is Codex CLI

Codex CLI is a coding agent from OpenAI that runs in your terminal. Its source code is open under the Apache-2.0 license, so anyone can read how it works. You install it with a single npm command, and on Windows there is also a PowerShell install script.

Beyond the terminal, Codex is available as an editor extension, inside the ChatGPT app and as a cloud version that runs tasks on a remote machine. Settings live in ~/.codex/config.toml, and a project can carry its own file in a .codex folder. That project file is only read once you mark the folder as trusted.

Codex CLI answering a first question in PowerShell
A first question in Codex CLI: the active model is shown at the bottom of the screen.

Claude Code vs Codex: side by side

Both agents take plain-language tasks, see the whole project folder and ask before risky actions. The differences are in the details: where project rules live, how safety works and where else you can run the agent.

Comparison table of Claude Code and Codex CLI across six points
The main differences in one table: project notes, settings, safety, skills, where it runs and source code.
PointClaude CodeCodex CLI
Project rulesCLAUDE.md, created with /initAGENTS.md, also via /init
Settings file~/.claude/settings.json~/.codex/config.toml
Safetypermission modes, Shift+Tabsandbox plus approval policy
Skills.claude/skills folder.agents/skills folder
Where it runsterminal, editor, desktop app, webterminal, editor, app, cloud
Source codeclosedopen, Apache-2.0

In short, these are two mature tools with different priorities. Claude Code leans on flexible permission modes and deep integration with Claude models. Codex leans on an OS-level sandbox and open source code.

Safety: permission modes and the sandbox

Claude Code has six permission modes. In default mode it asks before every edit and command, in acceptEdits it accepts file changes on its own, and in plan mode it only reads the project and writes a plan. You cycle through modes with Shift+Tab while it works.

Codex splits safety into two settings. The first is the sandbox: read-only, write access inside the workspace, or full access. The second is the approval policy: ask on request, or never ask.

Codex CLI asking for approval before running a git command
Before running a command, Codex shows it in full and offers three ways to answer.

Project files: CLAUDE.md and AGENTS.md

Both agents read a plain text file with project rules: how to run tests, which code style to follow, what not to touch. Claude Code uses CLAUDE.md, Codex uses AGENTS.md. In both cases the /init command drafts the first version for you.

Codex merges these files from the repository root down to the current folder, so a module can keep its own rules next to its code. By default the combined size is capped at 32 KiB, and anything beyond that is not read. If your team uses both agents, keep shared rules in one file and point to it from the other.

Running Codex with Claude models

Codex is not limited to OpenAI models. Through Hummbit you can run it with Claude models: the address and key go into its settings, and you pick the model with the -m flag at launch.

Starting Codex CLI with the -m flag and claude-haiku-5-5
The Claude model is set with a flag at launch and then shows in the Codex status line.

Step-by-step setup with ready commands is on the Codex CLI page. The same guide for Claude Code is on the Claude Code page, and Claude Code with an API key explains what connecting by key actually changes.

Which one to choose

Choose Claude Code if you want the most out of Claude models: skills, plugins, plan mode, and the same engine in the terminal and the desktop app. Choose Codex if open source code, a strict sandbox or an existing AGENTS.md workflow matters more to your team.

Claude Code created a file and summed up what it did
The same kind of task in Claude Code: the agent created a file and described the result in one paragraph.

Nothing stops you from keeping both. One Hummbit key works with Claude Code and with Codex, so you can give the same task to each and compare the result on your own project. For picking the model behind either agent, see Claude Opus vs Sonnet vs Haiku.

FAQ

Is Codex better than Claude Code?

There is no single winner. Output quality depends more on the model and on how well your project rules are written than on the program itself. The simplest test is to run both on the same task.

Can Claude Code use AGENTS.md?

Claude Code reads its own CLAUDE.md. If your rules already live in AGENTS.md, reference that file from CLAUDE.md and Claude will read both.

Do skills work in both agents?

Yes, the format is the same: a folder with a SKILL.md file. Only the folder the agent searches differs. More in Claude Skills: what they are and how to use them.

Where do I start?

Sign up, copy your key from the dashboard and follow the steps on the getting started page. Other apps that work with the same key are listed in all setup guides.

Try it with your own tools

Create an account, get a key and connect Claude Code or any other app in a few minutes.

More posts

All posts