Skip to content

Codex CLI

Codex CLI is OpenAI’s terminal-native AI coding agent. It works with your files and shell, is sandboxed by default, and supports both interactive and headless modes. Codex is included with every ChatGPT plan, including Free and Go — usage limits vary by plan, and Free covers local tasks only.

Requires Node.js 22+. Works on macOS, Windows, and Linux.

Terminal window
npm install -g @openai/codex

Run codex and sign in with your ChatGPT account when prompted:

Terminal window
codex

Verify:

Terminal window
codex --version

Full walk-through: Getting Started with OpenAI → Install Codex. The Codex section also covers the Codex tab in the ChatGPT app and the IDE extension.

  • Interactive coding — refactor, debug, explore a codebase with Codex reading files, running commands, and iterating
  • Sandboxed execution — Codex runs in a sandbox by default, so it won’t touch files outside your project without approval
  • Headless automation — pass a prompt as an argument for CI/CD pipelines and scheduled jobs
  • Multiple surfaces — same Codex logic across the CLI, the Codex tab in the ChatGPT app, and the IDE extension