Book a Free Strategy Call
Skip the read: talk to Walid in 30 min.
Free strategy call. We map your AI engineering team, you keep the notes.
Updated July 2026
OpenAI Codex CLI is a terminal coding agent. You install it, point it at a repository, and it reads your code, writes patches, runs commands, and reports back, all from the command line instead of a chat window or an IDE panel. It is one of the two agents most engineering teams now compare when they ask "should we run Claude Code or Codex," alongside GitHub Copilot's agent mode.
Quick answer:
- Install:
npm install -g @openai/codex(orbrew install --cask codex) - Run
codexin your repo, then choose Sign in with ChatGPT - Type a task in plain English; Codex reads the repo and proposes changes
That gets a session running in under two minutes. The rest of this guide covers what Codex CLI actually is, every install path, how authentication and access work, and what to check before you hand it real work.
What is OpenAI Codex CLI
Codex CLI is OpenAI's open source, terminal-based coding agent, distinct from Codex Web (the cloud-hosted version that runs tasks in a sandboxed container you review in a browser) and the Codex IDE extension. The CLI runs locally against your actual filesystem: it reads files, proposes edits, and can execute shell commands, subject to the approval settings you configure.
The project is released under the Apache 2.0 license and lives at github.com/openai/codex, where it has passed 101,000 stars and 8,400+ commits as of this writing. The codebase is written primarily in Rust. As of July 21, 2026, the latest tagged release is version 0.145.0, which gives a sense of how fast it ships: multiple releases most weeks.
Codex CLI is not a code-completion plugin. It works the way Claude Code and Copilot's agent mode work: you describe a task, it plans and executes across multiple files and terminal commands, and you review the result as a diff before it lands.
Related Reads
How to install Codex CLI
OpenAI documents four install paths. Pick one and stick with it, mixing installers is the fastest way to end up with a stale binary shadowing a newer one on your PATH.
| Method | Command | Best for |
|---|---|---|
| npm | npm install -g @openai/codex | Teams already standardized on Node tooling |
| Homebrew (macOS) | brew install --cask codex | Mac users who manage CLIs with brew |
| Install script (macOS/Linux) | curl -fsSL https://chatgpt.com/codex/install.sh | sh | No Node dependency, one-line setup |
| Install script (Windows) | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" | Native Windows, no WSL |
A fifth option exists for locked-down environments: download a prebuilt binary directly from the project's GitHub Releases page (separate archives for macOS Apple Silicon, macOS x86_64, Linux x86_64, and Linux arm64), extract it, and rename the binary to codex on your PATH.
Confirm the install landed:
codex --version
Free weekly brief
Steal our production automations
The exact n8n flows, Claude Code setups, and prompts we ship for clients, broken down step by step. No spam, unsubscribe anytime.
How to authenticate Codex CLI
Run codex from your terminal and it walks you through sign-in on first launch. You have two options, per OpenAI's own documentation:
- Sign in with ChatGPT. Recommended if you already pay for ChatGPT Plus, Pro, Business, Edu, or Enterprise. Your Codex CLI usage draws from the same plan you already have.
- API key. Authenticate with an OpenAI API key instead, with billing metered separately through the OpenAI platform rather than your ChatGPT subscription. OpenAI notes that some features may not be available in this mode.
Codex CLI itself is free and open source software; what costs money is the underlying ChatGPT plan or API usage behind it, exactly like Claude Code is free to install while the Anthropic account or API key behind it is what's billed. Exact plan pricing and rate limits change often enough that we're not reproducing dollar figures here, check OpenAI's current pricing page before you commit a team to a tier.
First commands: what running Codex actually looks like
Once you're signed in, the basic loop is:
cdinto the repository you want Codex to work on- Run
codex - Type what you want done in plain language, "add input validation to the signup form" or "find why the build fails on Node 20"
- Codex reads the relevant files, proposes a plan and a diff, and asks for approval before it edits files or runs commands, unless you've configured it to run with less oversight
- Review the diff, approve or reject, iterate
For scripted or CI use, Codex also ships a non-interactive mode (codex exec), so you can hand it a task from a script without the interactive prompt loop. This is the mode teams reach for when they want Codex to run inside a pipeline rather than a terminal session someone is watching.
Is Codex CLI free?
The CLI itself, yes: it's open source under Apache 2.0 and costs nothing to install. What it draws on is not free. Signing in with ChatGPT bills against whichever ChatGPT plan you're on (Plus, Pro, Business, Edu, or Enterprise all work); signing in with an API key bills token usage directly through the OpenAI platform. There's no separate "Codex CLI fee" on top of either.
Codex CLI vs the rest of the terminal-agent field
Codex CLI is not the only agent living in a terminal now. If you're choosing between it and the alternatives, the honest short version:
- Claude Code is Anthropic's equivalent, more established in enterprise engineering orgs as of mid-2026, with a broader third-party ecosystem of MCP servers, hooks, and sub-agents. See how to set up Claude Code if you're weighing that path.
- GitHub Copilot's agent mode leans on GitHub-native workflows (PRs, Actions, Issues) more than either Codex or Claude Code. We cover that trade-off in GitHub Copilot vs Claude Code.
- Cursor is IDE-first rather than terminal-first; see Cursor vs Claude Code if your team lives in an editor instead of a terminal.
None of these tools is strictly better across every axis. Codex CLI's real advantage is being OpenAI-native: if your team already standardizes on ChatGPT and the OpenAI API, Codex CLI is the path of least friction for billing and account management. If your team is Anthropic-native, that same logic points the other way.
What this means for you
- Install once, pick one method. Mixing npm, brew, and the install script creates PATH conflicts that waste an afternoon.
- Sign in with ChatGPT if you already have a paid plan. It's the simpler billing path; reach for an API key only if you specifically need usage-based billing or hit a feature the ChatGPT sign-in path doesn't cover.
- Review every diff before approving. Codex CLI asks for approval by default; don't loosen that setting on a repo you can't afford to have edited wrong.
- Use
codex execfor scripted or CI runs, not the interactive session, when nobody is watching the terminal. - Compare before you standardize a team on it. Weigh Codex CLI against Claude Code and GitHub Copilot's agent mode on your own workflow before committing budget to either.
FAQ
What is OpenAI Codex CLI? Codex CLI is OpenAI's open source, terminal-based coding agent. It reads your repository, proposes and applies code changes, and can run shell commands, distinct from Codex Web (cloud-hosted) and the Codex IDE extension.
Is Codex CLI free? The CLI is free and open source (Apache 2.0). What it uses is not necessarily free: you authenticate either with a paid ChatGPT plan (Plus, Pro, Business, Edu, Enterprise) or an OpenAI API key billed separately.
How do I install Codex CLI?
npm install -g @openai/codex, brew install --cask codex on macOS, or the official install script (curl -fsSL https://chatgpt.com/codex/install.sh | sh on macOS/Linux, a PowerShell equivalent on Windows). Prebuilt binaries are also available from the project's GitHub Releases.
What are the main Codex CLI commands?
Run codex to start an interactive session in your current repository. Run codex exec for non-interactive, scriptable runs, useful in CI. Run codex --version to confirm your installed version.
Does Codex CLI require a ChatGPT subscription? Not strictly. You can sign in with a ChatGPT account (Plus, Pro, Business, Edu, or Enterprise) or authenticate with an OpenAI API key instead, billed through the API. OpenAI notes some features may not be available via the API-key path.
Is Codex CLI the same as Codex Web? No. Codex Web runs tasks in a cloud sandbox you review in a browser. Codex CLI runs locally against your own filesystem and terminal, with local approval prompts before it edits files or runs commands.
How is Codex CLI different from Claude Code? Both are terminal-based coding agents with a similar core loop: describe a task, review a diff, approve. They differ in ecosystem maturity, model provider, and billing path.
What language is Codex CLI written in? The public repository is primarily Rust.
Sources: OpenAI Codex CLI on GitHub, Codex quickstart, OpenAI
Continue Reading
GTM Engineer at Clay: What the Role Looks Like Day to Day (2026)
Clay is the most-searched tool tied to this title. Here is what GTM engineering work at Clay actually looks like: waterfalls, Claygents, custom functions, and CRM sync, verified against Clay's own product pages.
How to Become a GTM Engineer: Skills, Path, and Salary (2026)
The real path into GTM engineering: the skills to build, where to actually learn them, how to search for the job, and sourced salary ranges. No fake certifications.
Forward Deployed Engineer Tools: The Real Toolchain, Not the Hype
The real FDE toolchain: agent orchestration, evaluation, guardrails, and observability, in that order. No vendor list, no fabricated tool claims, just the four disciplines that matter.
Book a Free Strategy Call
Building this in production?
Walid runs a 30-min call to map your AI engineering team. Free, no slides.
Free weekly brief
Steal our production automations
The exact n8n flows, Claude Code setups, and prompts we ship for clients, broken down step by step. No spam, unsubscribe anytime.

Walid founded AY Automate to help businesses ship AI workflows that actually move revenue. He leads strategy and oversees every client engagement end-to-end.
Full Bio →


