Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
This is an old revision of the document!
OpenAI Codex CLI is an open-source, terminal-native coding agent built in Rust by OpenAI.1) It reads, edits, and executes code locally with optional cloud-sandboxed execution, featuring Git integration, configurable approval policies, and support for multiple execution modes.
ai_agent cli coding openai rust terminal open_source
| Repository | https://github.com/openai/codex |
| Website | https://developers.openai.com/codex/cli/ |
| Language | Rust |
| License | Open Source |
| Stars | 67,000+ |
| Creator | OpenAI |
Codex CLI brings OpenAI's coding capabilities directly into the terminal. Built in Rust for performance, it operates as an autonomous agent that analyzes repositories, proposes code changes, executes them with configurable approval, and iterates based on feedback.2) It supports local, worktree (isolated Git branch), and cloud execution modes, making it suitable for everything from quick edits to complex multi-file refactors.
untrusted (always prompt), on-failure, on-request, never (full auto)openai/codex-action@v1 for CI/CD integration3)Codex CLI follows an agent loop: analyze the repository, generate changes, execute with approval, and iterate on feedback. The Rust core ensures low latency and efficient resource usage.4)
gpt-5-codex/model commandModel configuration via TOML:
model = "gpt-5-codex" model_provider = "openai-chat-completions" [model_providers.openai-chat-completions] base_url = "https://api.openai.com/v1" env_key = "OPENAI_API_KEY" wire_api = "chat"
# Via npm npm i -g @openai/codex # Via Homebrew brew install codex # From source (Rust) cargo install codex # First run prompts for authentication: # - ChatGPT account (Plus/Pro/Business/Enterprise) # - or API key codex
# Start interactive session codex # Switch models during session /model gpt-5.4 # MCP server management codex mcp add docs -- docs-server --port 4000 codex mcp list --json codex mcp get docs codex mcp remove docs # Use profiles codex --profile enterprise --model o3 # GitHub Actions integration # Uses openai/codex-action@v1 in workflow YAML