Cheat Sheet · Commands & Shortcuts
Codex
A quick reference for OpenAI's Codex CLI, how to launch it, the in-session slash commands, approval modes and the flags you'll actually use.
CLI commands & flags
codex | Start an interactive Codex session |
codex "refactor utils" | Start with an initial prompt |
codex exec "…" | Run non-interactively (automation / CI) |
codex --model <name> | Choose the model |
codex resume | Continue a previous session |
codex --help | Show all commands and flags |
In-session & approvals
/approvals | Set how much Codex can do without asking |
/diff | Show the pending changes as a diff |
/clear | Clear the conversation context |
Suggest mode | Codex proposes changes; you approve each one |
Auto-edit mode | Codex edits files but asks before running commands |
Full-auto mode | Codex edits and runs in a sandbox without prompts |
Run an agent without the setup
Spin up a hosted open-source AI agent with Creative Tim, bring your own key or run it on credits.
Frequently asked questions
What are Codex approval modes?
They control autonomy: suggest (approve every change), auto-edit (edits freely, asks before commands), and full-auto (works in a sandbox without prompts).
Can I run Codex in CI?
Yes, use codex exec for non-interactive runs in scripts and pipelines.
Codex or Claude Code?
Both are terminal agents from rival labs; the choice usually comes down to model preference and ecosystem, see our Claude Code vs Codex comparison.
Compare Codex