Interactive vs Non-Interactive
Interactive Mode (default):Core Commands
codex
Run Codex interactively or with a prompt
exec
Run Codex non-interactively for automation
review
Run code reviews on commits or branches
Session Management
apply
Apply latest diff from Codex to working tree
resume
Resume a previous interactive session
fork
Fork a previous interactive session
Authentication
login
Authenticate with ChatGPT or API key
logout
Remove stored credentials
Integration & Tooling
mcp
Manage external MCP servers
mcp-server
Run Codex as an MCP server (stdio)
app-server
Start Codex as an app server for IDEs
Utilities
completion
Generate shell completion scripts
sandbox
Run commands within Codex sandbox
features
Inspect and manage feature flags
feedback
Submit feedback about Codex
debug
Debugging tools for app server
Global Flags
These flags work with most commands:-c, --config <KEY=VALUE>- Override config.toml settings-p, --profile <NAME>- Use a specific config profile-m, --model <MODEL>- Specify the AI model to use--oss- Use open-source/local model providers--enable <FEATURE>- Enable a feature flag--disable <FEATURE>- Disable a feature flag
Common Usage Patterns
Quick One-Off Tasks
Code Reviews
Using Different Models
Configuration Overrides
Exit Codes
Codex CLI uses standard exit codes:0- Success1- Error occurred during execution