Skip to content

Codex CLI

Codex CLI is OpenAI’s open-source terminal coding agent.

TypeCLI
Open SourceYes (April 2025)
Best ForOpenAI models, ChatGPT subscribers
  • Agentic — File editing, terminal commands
  • Multi-file — Understands project structure
  • Sandbox Mode — Isolated execution
  • ChatGPT Integration — Works with existing subscription
Terminal window
npm install -g @openai/codex

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.

SettingValue
Open SourceYes (client)
TrainingOpenAI terms
JurisdictionUS (OpenAI)

Model availability changes quickly. In practice, Codex CLI uses current GPT-5/Codex model families based on account access.

Terminal window
# With API key
export OPENAI_API_KEY=sk-...
codex
# Or authenticate with ChatGPT
codex auth

Codex CLI includes a sandbox for safer execution:

Terminal window
# Run with sandboxed terminal
codex --sandbox
# Sandbox restricts:
# - Network access (configurable)
# - File system access (project only)
# - Process execution (limited)
CommandAction
/helpShow commands
/clearReset context
/sandboxToggle sandbox mode
/model <name>Switch model

Codex CLI with Codex 5 achieves 74.9% on SWE-bench verified, one of the highest scores for agentic coding.

ModelSWE-bench
Codex 574.9%
GPT-5.272.1%
  • Use Codex 5 for coding tasks (optimized)
  • Enable sandbox for untrusted projects
  • ChatGPT subscription works — no separate API key needed