Core Features
Three Approval Modes
| Mode | Behavior |
|---|---|
suggest |
Shows suggestions, you approve each one |
auto-edit |
Auto-applies file edits, asks for commands |
auto |
Full autonomy — edits and runs commands |
codex --mode auto "Refactor the database layer to use connection pooling"Sandbox Execution
Commands run in a sandboxed environment by default:
- Network access disabled
- File system restricted to project directory
- Configurable permissions
Multi-Model Support
# Use different models
codex --model o4-mini "Quick fix for the typo in README"
codex --model o3 "Design and implement a caching layer"
codex --model gpt-4o "Explain the authentication flow"Context-Aware
Codex reads your project structure, git history, and relevant files to understand context before making changes.
Typical Workflow
# Navigate to your project
cd my-app
# Ask Codex to help
codex "The login endpoint returns 500 when the email has uppercase letters"
# Codex:
# 1. Reads relevant files (auth/login.ts, models/user.ts)
# 2. Identifies the case-sensitivity bug
# 3. Proposes a fix
# 4. Shows diff for approval
# 5. Applies the change
# 6. Runs tests to verifyConfiguration
# ~/.codex/config.yaml
model: o4-mini
mode: auto-edit
approval:
file_edits: auto
commands: manual
context:
max_files: 50
include_git_diff: trueKey Stats
- 20,000+ GitHub stars
- Official OpenAI product
- 3 approval modes
- Sandboxed execution
- Multi-model support (o4-mini, o3, GPT-4o)
FAQ
Q: What is OpenAI Codex CLI? A: The official OpenAI terminal coding agent that reads your codebase, writes code, runs commands, and manages files from the command line.
Q: Is Codex CLI free? A: The CLI is open-source. You need an OpenAI API key with usage-based billing.
Q: How does Codex CLI compare to Claude Code? A: Both are terminal coding agents. Codex uses OpenAI models (o4-mini, o3), Claude Code uses Claude models. Core functionality is similar — code editing, command execution, and project context awareness.