Compare

Claude Code vs OpenAI Codex: two terminal coding agents

Anthropic's and OpenAI's coding agents compared on setup, sign-in, project instructions and openness.

Verdict

They're close in spirit, so let your existing subscription decide. If you already pay for Claude, use Claude Code. If you already pay for ChatGPT, use Codex. Choose Codex if you want an open-source CLI, and Claude Code if skills and hooks matter to you.

Claude Code and OpenAI Codex both put an AI agent in your terminal. You describe a task, and the agent reads your files, edits them and can run commands. Here is how they differ on things we could verify in each vendor's docs.

The short version

Claude CodeOpenAI Codex
Made byAnthropicOpenAI
Installcurl -fsSL https://claude.ai/install.sh | bash (macOS, Linux, WSL), or Homebrew, WinGet, npmnpm install -g @openai/codex (Homebrew also listed)
Sign in withA Claude plan, a Claude Console account or a supported cloud providerA ChatGPT account (Plus, Pro, Business, Edu or Enterprise), or an API key
Free planNoTied to ChatGPT plans or API use. OpenAI's page lists a Free plan for quick tasks, but check what it includes
Open sourceNoThe CLI is open source on GitHub
Project instructionsCLAUDE.mdAGENTS.md
MCPYesYes (documented in OpenAI's Codex docs)
Other ways to use itTerminal, with IDE and desktop optionsCLI, IDE extension and cloud

Check each vendor's pricing page for current prices. We don't quote them because they change often.

Getting started

Both start the same way: open a terminal in your project folder and run the command (claude or codex). The first run walks you through signing in. If you've never used a terminal, our Claude Code install guide covers the basics, and the same ideas carry over to Codex.

Giving the agent standing instructions

Both read a plain-text Markdown file in your project so you don't have to repeat yourself:

  • Claude Code reads CLAUDE.md. Anthropic recommends keeping each file under about 200 lines, and /init can generate a starting file by analysing your project.
  • Codex reads AGENTS.md, a convention several other tools also read, including Cursor.

If you use more than one tool, an AGENTS.md is the most portable choice.

Extending the agent

Both support MCP servers (a standard for plugging extra tools into an AI). Claude Code also has skills (folders with a SKILL.md file that teach it a repeatable job), hooks and subagents. See our skills guide for a walkthrough.

Where each one fits

  • Claude Code: the more extensible of the two in our view, and the obvious choice if you're already a Claude subscriber.
  • OpenAI Codex: attractive if you're a ChatGPT subscriber, if you value an open-source CLI, or if you want a cloud option alongside the CLI.

Our verdict

This is a tool you're likely to choose by subscription. If you're paying for neither, try each for a week on a small real task. Their interfaces are similar enough that switching later is cheap.