← tools directory● official

Tool · OpenAI

Codex.

OpenAI's terminal-native coding agent. The Claude Code analog from the other model lab. Rust-built, open source, agent mode by default.

$ npm install -g @openai/codex

Codex is OpenAI's CLI coding agent and the closest thing to a one-to-one analog of Claude Code in the wild. It reads your repo, edits files in place, executes commands, and runs in agent mode by default. The interesting part is not that it exists, since Anthropic shipped first; it is that OpenAI built it in Rust, open-sourced the whole thing on GitHub, and made it boring in all the right ways.

If you are already deep in the OpenAI ecosystem (GPT-5, ChatGPT subscription, custom GPTs), Codex is the obvious choice. If you are not, it is still worth installing, because running both Codex and Claude Code on the same task is the cleanest way to develop a real opinion about model differences without the marketing noise.

§01What you get

The shape is familiar from Claude Code or Aider: the CLI reads files, modifies them in place, and runs shell commands inside the project. The framing that sets it apart is that agent mode is the default rather than an opt-in, and the prompts before destructive operations are explicit enough that you know what is about to happen.

Authentication is flexible in a useful way. You can sign in with a ChatGPT account or with an API key, which maps cleanly onto the difference between individuals and teams. The whole project lives at github.com/openai/codex, so the source is available to fork, audit, or file PRs against. The Rust build matters more than it sounds: startup is fast and memory overhead is low, which is noticeable when you spin up agents many times a day.

§02When it earns its keep

Anytime you would reach for Claude Code but want OpenAI's models running the loop. Multi-file changes in a repo you have worked in. Refactors that span more than a single buffer. Investigations where you would otherwise tab between editor and terminal too many times.

It is also the right tool when the goal is to compare. Run the same prompt through Codex and Claude Code on the same branch, and the diffs are usually small but the differences are illustrative. You will learn more about each model's character that way than from any benchmark.

§03Setup

# npm
npm install -g @openai/codex

# or homebrew
brew install --cask codex

# first run, auth via ChatGPT account or API key
cd ~/Code/your-project
codex

The first run prompts you to sign in. ChatGPT-account auth is the friction-free path; API-key auth is what you want for scripted or shared environments. Either way, the agent then runs in the current directory.

◆ pull quote

The real value of two well-resourced labs shipping CLI agents in the same year is not that you have two choices. It is that the conventions stop being one company's preferences and start being conventions.

§04Caveats

Codex is locked to GPT-family models, so for model-agnostic CLI work, Aider is still the answer. The ecosystem around it is younger than Claude Code's: there is no first-party MCP-equivalent yet, and the skills, hooks, and statusline community is much larger on the Claude side. Catching up, but not there yet. Token costs are real, the same warning that applies to any agent: an unsupervised loop will burn through credits, so set a spend limit. And open source is not the same as free; the CLI is open, the models still cost money to call. Read the auth and billing docs once, before the first long task.