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.
Install
Section titled “Install”Requires Node.js 22+. Works on macOS, Windows, and Linux.
npm install -g @openai/codexRun codex and sign in with your ChatGPT account when prompted:
codexVerify:
codex --versionFull walk-through: Getting Started with OpenAI → Install Codex. The Codex section also covers the Codex tab in the ChatGPT app and the IDE extension.
What you can do with it
Section titled “What you can do with it”- 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
Related
Section titled “Related”- CLI building block — how CLIs fit alongside APIs, SDKs, and agents
- Skills on OpenAI — skills support in Codex
- Building Agents on OpenAI — Codex, Agents SDK, and orchestration patterns
- Official Codex CLI docs · GitHub