Three shipping surfaces on one backend. Codex CLI (Rust, terminal), ChatGPT Codex (agent inside ChatGPT), Codex Cloud (remote parallel tasks in sandboxed VMs). All backed by gpt-5-codex via the Responses API. Not the retired 2021 Codex model — this is the modern agent-first product line.
| Key | Value |
|---|---|
| Default model | gpt-5-codex |
| CLI install | npm install -g @openai/codex or brew install codex |
| User config | ~/.codex/config.toml |
| Session store | ~/.codex/sessions/ |
| Auth (default) | ChatGPT OAuth → ~/.codex/auth.json |
| Auth (scripted) | OPENAI_API_KEY |
| Repo primer file | AGENTS.md |
| Docs | developers.openai.com/codex |
| Source (CLI) | openai/codex |
Pick the surface based on where the work fits, not on what Codex can do — all three run the same model.
Terminal-native. Local repo. Approval-gated shell + file edit. Rust binary; open source. Best for inline dev work, scripting, CI.
Inside ChatGPT on web / desktop / mobile. Each task runs in an attached container. Codex edits files in the sandbox, opens PRs on GitHub. Best for tasks you want to launch and monitor from a browser.
Remote agent. Async. Fires off in a sandboxed VM. Good for 15-minute-plus work you don't want to babysit — overnight runs, parallel branch experiments.
| Use case | Surface |
|---|---|
| Quick edit while you're in the terminal anyway | CLI |
| Scripted / CI / automation | CLI with codex exec + --dangerously-bypass-approvals-and-sandbox |
| Browsing issues, want to fire off 5 fixes in parallel | ChatGPT Codex |
| Phone or tablet; you want to kick off work away from your laptop | ChatGPT Codex mobile |
| "Do this thing, take as long as needed, open a PR when done" | Codex Cloud |
| Long-running multi-branch experiment | Codex Cloud with per-repo setup script |
Codex CLI installs in seconds; ChatGPT Codex needs nothing beyond a ChatGPT plan.
No separate install — reached from ChatGPT Codex by choosing "run remotely" when starting a task, or from the API. Per-repo setup script + environment variables get configured once in the ChatGPT Codex settings.
--dangerously-bypass-approvals-and-sandbox for CI pipelines.Rust binary. Interactive TUI + non-interactive exec mode. Sandboxed by default; approval-gated.
| Command | Effect |
|---|---|
| codex | Interactive TUI in the current dir |
| codex exec "<prompt>" | Non-interactive one-shot — prompt → tool calls → response → exit |
| codex resume | Interactive session picker |
| codex resume --last | Resume the most recent session |
| codex login / logout | Swap ChatGPT auth on/off (falls back to OPENAI_API_KEY) |
| codex whoami | Show the active auth method |
| codex mcp | Run Codex itself as an MCP server — other agents can call it |
| Flag | Effect |
|---|---|
| --model <name> | Pin model (gpt-5-codex, gpt-5, gpt-4o) |
| -p <profile> | Load profile from config.toml |
| --cwd <path> | Override working directory |
| -a, --ask-for-approval <mode> | Set approval mode at launch |
| --dangerously-bypass-approvals-and-sandbox | YOLO mode. For sandboxed external contexts only. |
Codex inside ChatGPT. Each task runs in a sandboxed container tied to your repo.
The model that makes ChatGPT Codex distinct from the CLI: you can fire off multiple tasks in parallel against the same repo on separate branches. No working-tree contention. Great for batch fixes ("apply these five linter fixes in parallel") or exploring alternative implementations.
ChatGPT Codex works on the ChatGPT mobile apps. Kick off a task from your phone, walk away, come back to a PR when it's done. Same sandbox + PR flow as web/desktop.
| Plan | Codex access |
|---|---|
| Free | Not included — Codex requires a paid plan |
| Plus | Codex included, standard quota |
| Pro | Higher quota + priority |
| Business / Enterprise | Org-scoped repo access · SSO · audit log |
Codex running on OpenAI infra in a sandboxed VM. Async. Good for long-running work you'd rather not tie up a chat for.
Per-repo hook that runs once when the Cloud VM is provisioned. Install dependencies, warm caches, pre-build. Same shape as a GitHub Action step.
Configure per-repo env vars in the ChatGPT Codex settings. Injected into the Cloud VM at run time. Never echoed to chat output. Typical use: DATABASE_URL for a test DB, OPENAI_API_KEY for a repo that itself calls the OpenAI API, signing tokens.
DATABASE_URL means Codex can hit that DB. Don't ship production creds to Cloud; use a test environment.npm install fails, the task fails. Treat the setup script like CI.Two paths. ChatGPT OAuth (default, entitlement-funded) or API key (metered).
codex login — opens a browser.~/.codex/auth.json.chatgpt.com/backend-api/codex — a.k.a. codex_responses. It's not a public API surface; it returns intermittent empty response.output=[] under load. Fine for interactive use where you retry. Third-party wrappers (like the Hermes Pi harness) need self-heal paths to handle the flakiness.
export OPENAI_API_KEY=sk-...codex login — swap to ChatGPT auth.codex logout — clear cached creds.OPENAI_API_KEY set → Codex prefers API-key mode regardless.codex whoami — show which path is active + current quota status.| Scenario | Auth |
|---|---|
| Daily dev on your laptop with a ChatGPT plan | ChatGPT OAuth |
| Shared team CI | API key in the CI secret store |
| Scripted third-party agent | API key (stable surface) |
| Personal home-lab that wants entitlement-funded calls | ChatGPT OAuth + self-heal fallback (see Hermes Pi harness) |
Built-in tool surface + MCP in both directions.
Run commands inside the sandbox. Subject to approval mode. Long-running commands stream output.
Read/write files relative to the working directory. Writes prefer apply_patch format for reliability.
Unified-diff-like block. Atomic application. Use this for any multi-file edit instead of freeform writes.
Live search. On by default in ChatGPT Codex; opt-in via config in the CLI.
Full browser tool in ChatGPT Codex. Take screenshots, click through pages, scrape.
Codex can emit images (screenshots of running apps, generated assets) — returned as attachments in ChatGPT, stored as files in the CLI.
Codex is an MCP client. Configure external MCP servers in ~/.codex/config.toml:
Inverse direction — expose Codex itself so other MCP clients can delegate coding tasks to it. Run codex mcp; register the resulting stdio process in Claude Code, Cursor, or any MCP-compatible host. Useful for heterogeneous agent pipelines where a supervising agent wants a Codex-class tool as a sub-agent.
Also supports *** Add File: <path> followed by the full content and *** Delete File: <path>. Claude Code uses a different format (exact-string replacement); if you move between the two, remember they're not interchangeable.
TOML files and the one repo file that matters.
Named presets. Select at launch with codex -p fast. Useful for switching model, approval mode, or MCP-server set without editing the default block.
Repo-root markdown file read by every Codex surface on every turn. Equivalent role to Claude Code's CLAUDE.md. Cascading — a nested src/AGENTS.md applies when Codex is working under src/. Conventional contents:
generated/, never commit to main).Transcripts live under ~/.codex/sessions/. One .jsonl file per session. Safe to prune. codex resume reads from here.
Same product class, different vendors, different sharp edges.
| Dimension | Codex | Claude Code |
|---|---|---|
| Binary | Rust, codex | Node.js, claude |
| Default model | gpt-5-codex | claude-opus-4-7 |
| Repo primer file | AGENTS.md (cascading) | CLAUDE.md (project-level) |
| Config file | ~/.codex/config.toml | ~/.claude/settings.json |
| Project config | AGENTS.md + profile | .claude/settings.json + skills |
| Safety surface | Approval modes + sandbox (seatbelt/landlock) | Permission modes + hooks + allowlist |
| Custom procedures | Implicit via AGENTS.md | Explicit .claude/skills/<name>/SKILL.md |
| Interception | Approval prompts only | 6 hook types (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SubagentStop, SessionStart) |
| Remote surface | Codex Cloud (parallel async) | None first-party; Duraclaw covers the space |
| Patch format | apply_patch unified diff | Exact-string replace (Edit tool) |
| MCP | Client + server | Client + server |
| Free tier | Not available — paid plan required | API key pay-as-you-go |
| Entitlement path | ChatGPT OAuth, entitlement-funded | API key only |
codex mcp) and call it from Claude Code, or vice versa. For heterogeneous pipelines where one agent is supervising and another is executing, this is the cheapest interop.