Codex CLI
Codex CLI is OpenAI’s open-source terminal coding agent.
Overview
Section titled “Overview”| Type | CLI |
| Open Source | Yes (April 2025) |
| Best For | OpenAI models, ChatGPT subscribers |
Key Features
Section titled “Key Features”- Agentic — File editing, terminal commands
- Multi-file — Understands project structure
- Sandbox Mode — Isolated execution
- ChatGPT Integration — Works with existing subscription
Installation
Section titled “Installation”npm install -g @openai/codexAccess Model
Section titled “Access Model”The Codex CLI client is open source. Usage depends on your OpenAI account access, either through API usage or eligible ChatGPT plans.
Works with:
- ChatGPT account access
- OpenAI API directly
As of Feb 25, 2026, the openai/codex repository is active and regularly released.
Privacy
Section titled “Privacy”| Setting | Value |
|---|---|
| Open Source | Yes (client) |
| Training | OpenAI terms |
| Jurisdiction | US (OpenAI) |
Models Available
Section titled “Models Available”Model availability changes quickly. In practice, Codex CLI uses current GPT-5/Codex model families based on account access.
Getting Started
Section titled “Getting Started”# With API keyexport OPENAI_API_KEY=sk-...codex
# Or authenticate with ChatGPTcodex authSandbox Mode
Section titled “Sandbox Mode”Codex CLI includes a sandbox for safer execution:
# Run with sandboxed terminalcodex --sandbox
# Sandbox restricts:# - Network access (configurable)# - File system access (project only)# - Process execution (limited)Key Commands
Section titled “Key Commands”| Command | Action |
|---|---|
/help | Show commands |
/clear | Reset context |
/sandbox | Toggle sandbox mode |
/model <name> | Switch model |
SWE-bench Performance
Section titled “SWE-bench Performance”Codex CLI with Codex 5 achieves 74.9% on SWE-bench verified, one of the highest scores for agentic coding.
| Model | SWE-bench |
|---|---|
| Codex 5 | 74.9% |
| GPT-5.2 | 72.1% |
- Use Codex 5 for coding tasks (optimized)
- Enable sandbox for untrusted projects
- ChatGPT subscription works — no separate API key needed