Skip to content
ML2

OpenAI Codex CLI

Added Updated

Published Last verified Released

Our verdict

A strong terminal agent if you already pay for ChatGPT or use OpenAI models. The default Auto mode edits and runs commands inside your project with network access off, and asks before going further, so it's safer to leave running than most. It's Apache-2.0 and scriptable with codex exec. You're tied to OpenAI's models and plans, and the sandbox only protects what's outside the workspace, so keep work on a clean git branch.

Who it's for
Developers who prefer terminal workflows and OpenAI models
Leverage
Local, inspectable agent loop on your own machine
Effort
Low
Date added

What OpenAI Codex CLI does

Codex CLI is OpenAI's open-source coding agent that runs locally in your terminal. It reads your repository, edits files, runs your installed tools and shows commands and diffs as it goes. Two settings control it: the sandbox mode decides what it can technically touch (read-only, workspace-write or full access) and the approval policy decides when it must stop and ask. You sign in with a ChatGPT plan (Plus, Pro, Business, Edu or Enterprise) or an API key, and the same agent also runs non-interactively with codex exec, reviews changes with /review and connects to MCP servers with codex mcp.

How builders use OpenAI Codex CLI

  • Run /init in a new repo so Codex writes an AGENTS.md, then add your build, test and lint commands to it.
  • Use /review before committing: it reports prioritised findings on uncommitted changes, a commit or a base branch without editing your files.
  • Plan or explore with /permissions set to read-only, then switch back to Auto when you want edits.
  • Call codex exec from a script or CI job, starting with --sandbox read-only for checks that shouldn't change anything.
  • Pass a screenshot of an error or a design with codex --image so the first prompt has visual context.

Sandbox and approval settings

From OpenAI's Codex security docs, checked 16 Nov 2026. By default commands run with network access off and writes limited to the current workspace, enforced by the operating system.

ModeFlagsWhat Codex can do
Auto (default)workspace-write, on-requestRead, edit and run commands in the workspace; asks before editing outside it or using the network
Read-onlyread-only, on-requestRead files and run commands that don't write; good for planning or exploring
Read-only CIread-only, neverNever asks; the pattern OpenAI lists for non-interactive checks
Full access--yoloNo sandbox and no approvals; OpenAI marks it not recommended

Ways to run it

  • Interactive: run codex in a project folder and steer the turn as commands and diffs appear; codex resume reopens an earlier chat.
  • Scripted: codex exec runs a task without the interactive UI, for pipelines and repeatable jobs.
  • Review: /review checks changes and reports findings without modifying your working tree.
  • Cloud hand-off: codex cloud submits work to a configured cloud environment and applies the result locally later.
  • Install: a standalone installer for macOS, Linux and Windows, or npm install -g @openai/codex, or Homebrew.

OpenAI Codex CLI: limits and gotchas

  • It's built around OpenAI's models and sign-in. If you want to switch freely between providers, a model-agnostic agent fits better.
  • Inside the workspace the default mode can edit and run commands without asking, so a wrong change lands in your files; OpenAI recommends a feature branch, a clean git status and frequent commits.
  • Network access is off by default, so installs or tests that need the internet will ask for approval or fail until you enable it.
  • Full-access mode removes the sandbox entirely. OpenAI's docs say to use it only inside a container you treat as the security boundary, with trusted repositories.
  • Usage counts against your ChatGPT plan's limits or your API bill; the CLI itself is free and Apache-2.0.

OpenAI Codex CLI compared with other tools here

  • Claude Code: Anthropic's terminal agent on Claude models, with hooks, subagents and skills; the closest like-for-like rival.
  • Gemini CLI: Google's open-source terminal agent for Gemini models, worth a look if you're in Google's ecosystem.
  • Aider: a terminal pair programmer that works with many model providers and commits each change to git.
  • OpenCode: an open-source terminal agent that isn't tied to one model provider.
  • Codex Cloud: the same Codex agent running tasks in OpenAI's cloud sandboxes, so you review diffs instead of watching a terminal.

When to pick OpenAI Codex CLI

  • Pick Codex CLI if you already have a ChatGPT plan and want a sandboxed agent in your terminal.
  • Pick Claude Code if you prefer Claude models and want hooks and subagents.
  • Pick Aider or OpenCode if you want to switch model providers freely.
  • Use codex exec with a read-only sandbox if you want automated checks in CI that can't change code.

OpenAI Codex CLI questions

Is Codex CLI free?

The CLI is open source under Apache-2.0. Model usage comes from your ChatGPT plan (Plus, Pro, Business, Edu or Enterprise) or from an OpenAI API key billed per use.

Can Codex CLI delete files outside my project?

Not in the default mode. The OS-level sandbox limits writes to the workspace and Codex asks before going outside it. Full-access mode removes that protection.

Does Codex CLI read AGENTS.md?

Yes. /init creates an AGENTS.md with instructions for Codex, and you can edit it to add your build and test commands.

How is Codex CLI different from Codex Cloud?

Codex CLI runs on your machine against your local files. Codex Cloud runs tasks in OpenAI-managed containers; the CLI can hand work to it with codex cloud.

Related discoveries

See the newest picks →
  • ToolCoding & Shipping Agents

    Aider

    Open-source A.I. pair programming in your terminal, with git commits built in.

    Effort: Low#Local / BYO model#Open source

  • ToolCoding & Shipping Agents

    Gemini CLI

    Google's open-source agent that brings Gemini into your terminal.

    Effort: Low#Open source#CLI

Get the best new A.I. picks in your inbox

The best new agent workflows and tools we’ve vetted, with a clear verdict on each. Short, occasional, useful.

More in Coding & Shipping Agents →

Free. No spam. Unsubscribe anytime.