How to Automate Code Reviews with OpenAI Codex CLI
Codex CLI can read a git diff, flag real bugs, and post review comments. Here is how to wire it into a repeatable review step…
Codex CLI is OpenAI's open-source terminal coding agent, now powered by GPT-5
OpenAI Codex CLI is a free, open-source coding agent that runs in your terminal. Install it with npm i -g @openai/codex, authenticate with ChatGPT or an API key, and it reads your repository, writes patches and executes shell commands on request.
Codex CLI is a Rust-based command-line agent published by OpenAI under the Apache-2.0 licence. It’s the terminal counterpart to the Codex IDE extensions and the cloud Codex agent. You point it at a working directory, describe a change, and it proposes diffs that you approve or reject before anything touches disk.
The original 2025 release defaulted to o4-mini; current versions let you select GPT-5 and GPT-5-Codex tiers, which are tuned for longer agentic runs.
~/.codex/config.toml — set default model, approval mode and per-project overrides.The tool is free. What you pay for is model access. Signing in with a ChatGPT Plus ($20/month) or Pro ($200/month) account includes Codex usage with periodic rate limits. Alternatively, paste an OpenAI API key and pay per token — GPT-5 at $1.25 per million input and $10 per million output. Codex also accepts compatible third-party providers, so you can point it at a cheaper endpoint if you want.
If you’re comfortable in a shell and want an agent without switching editors, this is one of the cleaner options available. The approval flow is sensible, and the sandbox on Full Auto is a real safeguard rather than a marketing line.
If you want inline completions, tab-to-accept ghost text and a graphical diff view, a VS Code extension or Cursor will feel more natural. Codex CLI is deliberately terse. And Full Auto still deserves caution on repos containing credentials — the sandbox helps, but the agent will happily rewrite files it misjudges.
npm i -g @openai/codex; sign in with ChatGPT or an API key.