⏱ 8 Reading Time
OpenAI Codex CLI is an open-source, terminal-based coding agent that installs locally, reads and edits files in a chosen directory, and executes commands with developer approval. It runs on OpenAI’s GPT-5 model family, including GPT-5.4, and ships free with every ChatGPT plan from Free through Enterprise.
What Is OpenAI Codex CLI?
Codex CLI is OpenAI’s terminal-native coding agent, built in Rust, that runs locally and connects to GPT-5-series models through a ChatGPT account or an API key.
Codex CLI installs on macOS, Windows, and Linux through a single shell command or a package manager. It differs from the Codex app (a desktop client) and Codex web (OpenAI’s cloud-hosted agent at chatgpt.com/codex) — the CLI is the terminal surface, and all three share the same underlying model and account context. The tool is open source on GitHub under the openai/codex repository, which lets developers audit sandboxing behavior before granting it file-system or shell access.
| Attribute | Value |
|---|---|
| Developer | OpenAI |
| Interface type | Terminal (CLI), open source, written in Rust |
| Primary model (at launch of this review cycle) | GPT-5.4 |
| Current recommended model | GPT-5.5 (superseded GPT-5.4 as Codex’s default during 2026 rollout) |
| Platforms | macOS, Windows (native PowerShell or WSL2), Linux |
| Context window (GPT-5.4) | Up to 1,000,000 tokens |
| Entry price | $0/month (ChatGPT Free plan, limited usage) |
| Authentication | ChatGPT account sign-in or OpenAI API key |
Install Codex CLI on macOS or Linux with curl -fsSL https://chatgpt.com/codex/install.sh | sh, or on Windows with the PowerShell installer irm https://chatgpt.com/codex/install.ps1 | iex. After installation, running codex opens an interactive terminal session inside the current repository.
What Are Codex CLI’s Key Features?
Codex CLI combines local file editing, sandboxed command execution, subagent delegation, and cloud task handoff inside one terminal session.
- Edit and run code locally. Codex CLI reads a repository, proposes file edits, and executes shell commands inside a sandbox, with approval modes that range from manual confirmation to full autonomy.
- Switch models mid-session with
/model. Developers move between GPT-5.4, GPT-5.4 mini, GPT-5.5, and the research-preview GPT-5.3-Codex-Spark model without restarting a session. - Delegate work to cloud tasks. Codex CLI launches Codex Cloud tasks from the terminal, then pulls the resulting diff back into the local session without switching tools.
- Get automated code review before committing. A separate Codex review agent checks a diff and flags issues before the developer pushes or merges.
- Run subagents in parallel. Codex CLI splits larger tasks across multiple subagents, using GPT-5.4 mini for lighter exploration work (codebase search, large-file review) and GPT-5.4 for planning and final judgment.
- Connect external tools through MCP. The CLI supports the Model Context Protocol, letting it pull additional context or trigger third-party tools during a session.
- Attach images and design specs. Developers paste screenshots or wireframes directly into the CLI so Codex can reference visual context alongside a written prompt.
- Script Codex with
codex exec. This non-interactive mode runs Codex CLI as part of CI pipelines or other automated workflows.
How Much Does OpenAI Codex CLI Cost?
Codex CLI itself is free and open source; access to the underlying GPT-5.4 model is bundled into ChatGPT subscriptions, priced from $0 to $200 per month, based on OpenAI’s official pricing page.
| Plan | Price | Codex Access |
|---|---|---|
| Free | $0/month | Limited trial access, shared usage window |
| Go | $8/month | Entry paid tier, higher limits than Free |
| Plus | $20/month | Codex CLI, IDE extension, web, and iOS access |
| Pro | $100/month | 5x Plus usage limits |
| Pro (higher tier) | $200/month | 20x Plus usage limits |
| Business | $20/user/month (annual) or $25/user/month (monthly), 2-user minimum | Organization-wide access with admin controls, SSO, and no default training on business data |
| Enterprise | Custom (sales-quoted) | SCIM, Enterprise Key Management, RBAC, audit logs via Compliance API |
As of April 2, 2026, OpenAI moved Codex from per-message pricing to token-based credit billing on Plus, Pro, and Business plans. Under this system, usage draws from a shared 5-hour rolling window, and developers who exhaust that window can buy additional credits or switch to the lower-cost GPT-5.4 mini model to extend it. Developers connecting Codex CLI with their own API key instead of a ChatGPT login are billed separately at standard OpenAI API token rates, outside the ChatGPT plan allowance.
What Are the Pros and Cons of Codex CLI?
Codex CLI’s biggest advantages are its open-source transparency and native terminal integration; its main limitation is that Codex-specific usage is shared across a single rolling time window rather than sold as an isolated, predictable quota.
Pros:
- Open-source codebase on GitHub, so the sandboxing and permission logic is auditable rather than a black box.
- Runs natively across macOS, Windows, and Linux, including a native Windows sandbox alongside WSL2 support.
- GPT-5.4 supports up to a 1,000,000-token context window in Codex, letting an agent hold a large codebase or a long multi-step task in working memory.
- Model switching (
/model) lets a developer trade off cost and speed mid-session instead of committing to one model per subscription. - Included with existing ChatGPT plans rather than requiring a separate purchase.
Cons:
- Codex usage shares a rate-limit window with other agentic ChatGPT features (for example, ChatGPT for Excel), so heavy multi-tool use can exhaust the window faster than Codex-only use would.
- Token-based credit billing, introduced April 2, 2026, makes month-to-month cost less predictable than the flat per-message pricing it replaced.
- GPT-5.4 was already succeeded by GPT-5.5 as Codex’s recommended default model during 2026, so documentation and defaults change quickly enough that teams need to track OpenAI’s changelog directly.
- Enterprise pricing is not published and requires a sales conversation.
How Does Codex CLI Compare to Claude Code?
Codex CLI and Claude Code both provide terminal-based coding agents with agentic file editing and command execution, but they run on different model families and different account/billing systems.
| Attribute | Codex CLI (GPT-5.4) | Claude Code |
|---|---|---|
| Model family | OpenAI GPT-5 series | Anthropic Claude models |
| License | Open source (Rust) | Not fully open source |
| Context window | Up to 1,000,000 tokens (GPT-5.4) | Varies by model |
| Billing | Bundled into ChatGPT plans, $0–$200/month, or API-key billing | Bundled into Claude plans or API-key billing |
| Platform | macOS, Windows (native + WSL2), Linux | macOS, Windows, Linux |
Developers who already standardize on OpenAI’s ecosystem — ChatGPT seats, the Responses API, existing GPT-5.4 workflows — get the most value from Codex CLI, since model access, billing, and support all sit under one OpenAI account. Read the full breakdown in Claude Code vs OpenAI Codex CLI: Which Terminal AI Agent Wins in 2026.
Who Should Use Codex CLI?
Codex CLI fits individual developers who want an agent embedded directly in their terminal and engineering teams standardized on ChatGPT seats for both general work and coding.
- Solo and indie developers already on ChatGPT Plus get Codex CLI at no additional cost beyond their existing $20/month subscription.
- Engineering teams on GitHub-centric workflows benefit from Codex’s built-in code review agent and cloud task handoff, which opens pull requests directly from delegated work.
- Organizations needing admin controls — SSO, audit logs, no-training-by-default data handling — are the target for the Business and Enterprise tiers rather than individual Plus/Pro plans.
- CI/CD and automation teams can script Codex non-interactively through
codex exec, billed via API key rather than a ChatGPT seat.
What Are the Best Alternatives to Codex CLI?
- Claude Code — Anthropic’s terminal-based coding agent, positioned as Codex CLI’s closest direct competitor for agentic, model-agnostic-adjacent terminal workflows. Read the full review in Claude Code Review: Anthropic’s Terminal AI Coding Agent.
- Cursor — an AI-native code editor built on top of VS Code, aimed at developers who prefer an IDE-embedded experience over a terminal-first one. Read the full review in Cursor AI Review: Features, Pricing, and Performance.
- GitHub Copilot — Microsoft and OpenAI’s IDE-integrated coding assistant, priced separately from ChatGPT plans and focused on inline autocomplete plus chat rather than a standalone terminal agent. Read the full review in GitHub Copilot Review: Is It Still Worth It in 2026?
Frequently Asked Questions
Is Codex CLI free? Codex CLI the software is free and open source. Access to GPT-5.4 through Codex requires a ChatGPT plan (Free through Enterprise) or a separately billed API key.
Does Codex CLI still use GPT-5.4? GPT-5.4 remains available as a selectable model inside Codex CLI, but OpenAI’s rollout moved GPT-5.5 into the default, recommended position for most coding tasks during 2026.
Can Codex CLI run without an internet connection? No. Codex CLI executes commands and edits files locally, but it requires an active connection to authenticate and send requests to OpenAI’s models.
What operating systems does Codex CLI support? macOS, Windows (natively through PowerShell with a Windows sandbox, or through WSL2), and Linux.
OpenAI Codex CLI’s value case comes down to bundling: at $20/month, ChatGPT Plus includes full Codex CLI access alongside general ChatGPT use, undercutting the cost of running a comparable model through raw API billing for most individual developers — the trade-off is a shared, token-metered usage window rather than a dedicated, predictable Codex-only quota.
