OpenAI Codex CLI
Use case: Coding agents
Lightweight coding agent that runs locally in your terminal with sandboxed execution.
Codex CLI is a coding agent from OpenAI that runs locally on your computer. You start it by running codex in a project directory, and it can inspect files, make edits and run the tools already installed on your machine. You choose the model, reasoning effort and permissions for each run, and the /permissions command shows what Codex is allowed to do. The documentation also describes codex exec for non-interactive runs in scripts and CI, a review feature that runs against uncommitted changes, a commit or a base branch, and codex mcp for connecting MCP servers.
Pick Codex CLI when you want a local, terminal-based agent with explicit control over permissions and an open-source codebase you can read. It also supports skills, subagents for splitting up an investigation, saved sessions you can reopen with codex resume, images passed with codex --image and live web search with codex --search. If you prefer another surface, OpenAI also offers Codex in IDEs, a desktop app and a cloud agent, Codex Web, at chatgpt.com/codex.
The repository is licensed under Apache-2.0. You can install the CLI with a standalone installer, with npm install -g @openai/codex or with Homebrew. For access, OpenAI recommends signing in with your ChatGPT account so Codex is used as part of a Plus, Pro, Business, Edu or Enterprise plan. You can instead use an API key, which needs additional setup. OpenAI lists plans and usage limits on its Codex pricing page, and API-key sessions are billed at API rates instead of your ChatGPT allowance.
How we use Codex CLI
We run Codex CLI every week on the machine that builds this site. Our agents hand it a written prompt on stdin with codex exec, so it runs headless with no chat window, and it works in a throwaway copy of the site rather than the live code.
Every prompt starts with the same rules: preview only, no deploy, no commit, no push, print no secrets. Then it lists small numbered diffs, like fixing a clipped nav button at 390px or removing a dropped vendor from the CSP. Codex makes the edits and a separate QA step checks them before anything ships.
We also use it as a second opinion next to Claude Code: one agent writes a change, the other reviews it. It's signed in with a ChatGPT account, not an API key.
Like OpenAI Codex CLI? Find tools like it on X.
Follow @AgentstackDaily, plus the free Top 25 Agent Tools checklist.
At a glance
- Category
- Coding agents
- Best for
- Best AI coding agents in 2026 · Coding agents use cases
- Pricing
- CLI included with ChatGPT Plus, Pro, Business, Edu and Enterprise plans (Pro at $100, $200 or $500/mo), or pay API rates with an API key (as of Nov 2026, official pricing)
- Official site
- github.com
- Link checked
- November 4, 2026
- Data
- JSON
How OpenAI Codex CLI fits an agent workflow
In an agent stack, OpenAI Codex CLI belongs to the Coding agents category, which covers the development layer, where an agent reads, writes and runs code in a repository or terminal. You will also find it in our curated list: Best AI coding agents in 2026. Other Coding agents entries worth a look alongside it include Cline, OpenHands and Gemini CLI.
OpenAI Codex CLI alternatives
- Claude Code — Anthropic's agentic coding CLI
- Cursor — AI code editor with background/cloud agents, rules and MCP support.
- Aider — Terminal pair-programmer that edits files in your git repo and commits changes.
- Cline — Autonomous coding agent for VS Code that plans, edits and runs commands with approval.
- OpenHands — Open platform for software-development agents (formerly OpenDevin) that can run in a sandb
- Gemini CLI — Google's open-source terminal agent bringing Gemini to your shell with MCP support.
All Coding agents tools → · Best AI coding agents in 2026
Related tools
- GitHub Copilot coding agent
Assign an issue to Copilot and it opens a PR from an Actions-powered environment.
- Continue
Open-source IDE extensions and CLI for custom coding assistants and agents.
- SWE-agent
Princeton/Stanford agent that turns LMs into software engineers resolving GitHub issues.
- Goose
Open-source extensible local agent, now under the Linux Foundation's Agentic AI Foundation, that automates engineering t
- opencode
Open-source terminal coding agent supporting many model providers.
FAQ
How do I install Codex CLI?
On macOS or Linux run curl -fsSL https://chatgpt.com/codex/install.sh | sh. It can also be installed with npm install -g @openai/codex or brew install --cask codex. Then run codex in your project.
How do I sign in to Codex CLI?
Run codex and choose Sign in with ChatGPT. You can also use an OpenAI API key, which requires additional setup.
Is Codex CLI open source?
Yes. The openai/codex repository is licensed under Apache-2.0.
Can Codex CLI run in scripts or CI?
Yes. The documentation says you can call codex exec from repeatable workflows and pipelines, as well as use Codex interactively in the terminal.
Does Codex CLI work on Windows?
Yes. OpenAI's CLI page has a Windows install option alongside macOS/Linux, npm (npm install -g @openai/codex) and Homebrew.
Can Codex CLI search the web?
Yes. You can switch a run to live web search when a task depends on current releases or docs, and the searches stay visible in the transcript.
Get new agent tools and tips as they're added
Follow @AgentstackDaily on X for new tools and copy-paste tips. Free.