How to Install and Use Codex CLI (October 2026): Setup, Sign-In, Commands and Plan Limits
ChatGPTQuick answer: Codex CLI is OpenAI’s coding agent for the terminal. Install it with curl -fsSL https://chatgpt.com/codex/install.sh | sh (macOS/Linux), the PowerShell installer on Windows, npm install -g @openai/codex, or brew install --cask codex. Then run codex in a project and Sign in with ChatGPT. The CLI is included in ChatGPT Plus, Pro, Business and Enterprise, or you can pay per token with an OpenAI API key. Plan details are on OpenAI’s Codex pricing page (accessed October 25, 2026).
How do you install Codex CLI?
Per OpenAI’s Codex CLI docs, pick one method:
| System | Install | Update |
|---|---|---|
| macOS / Linux | curl -fsSL https://chatgpt.com/codex/install.sh | sh |
Run the same command again |
| Windows (new PowerShell window) | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" |
Run the same command again |
| npm | npm install -g @openai/codex |
Run the same command again |
| Homebrew | brew install --cask codex |
brew upgrade --cask codex |
How do you sign in?
Open a project directory and run codex. The first time, choose Sign in with ChatGPT and finish the browser flow. You can also run codex login directly. To use an API key instead, OpenAI’s auth docs recommend passing it through stdin:
printenv OPENAI_API_KEY | codex login --with-api-key
Run codex login status to see which method is active. Need a key first? See how to get an OpenAI API key.
What can you do with Codex CLI?
Start with a plain-language task such as “Tell me about this project”, then build up:
codex resume: reopen a recent chat from the current repository.codex --image: attach a screenshot, diagram or design reference to the first prompt.codex --search: switch a run to live web search for current docs or releases.codex exec: run Codex non-interactively in scripts and CI.codex cloud: send work to Codex cloud and apply the result locally.codex mcp: add local or remote MCP servers./permissions: choose when Codex can edit files or run commands without asking, and inspect the sandbox.- Code review: run a review against uncommitted changes, a commit or a base branch without touching your working tree.
- Subagents, skills and plugins: split large investigations and package repeatable workflows.
OpenAI’s best-practice tip: create Git checkpoints before and after each task so you can revert.
Which plans include Codex CLI?
| Plan | Codex access (per OpenAI’s pricing page) |
|---|---|
| Free and Go | GPT-6 Luna at Standard speed in the Codex desktop app only, subject to rollout |
| Plus | Codex on the web, CLI, IDE extension and iOS; cloud integrations like code review and Slack; GPT-6.1 Sol and GPT-6 Luna; extend with ChatGPT credits |
| Pro (three tiers) | Everything in Plus with more usage; Ultrafast mode on the top tier; currently no five-hour limit |
| Business | Codex plus a dedicated workspace with admin controls, SAML SSO and MFA |
| Enterprise / Edu | Priority processing, SCIM, EKM, RBAC, audit logs and data residency controls |
| API key | CLI, SDK and IDE extension only; no cloud features; billed at API pricing |
Prices for each tier are on chatgpt.com/pricing. Usage on ChatGPT plans is shared with ChatGPT Work. For the full plan comparison, see ChatGPT plans compared.
How do Codex usage limits work?
OpenAI publishes a range of local messages per five-hour window for Plus and Standard Business, which varies widely by model. Lighter models allow far more messages than the heaviest reasoning models. Weekly limits may also apply, cloud tasks can use more allowance than local messages, and Fast or Ultrafast modes draw usage faster. Pro currently has no five-hour limit. Check your usage dashboard for live numbers.
One recent change: GPT-5.5 was retired from Codex with ChatGPT sign-in on October 14, 2026. API-key sessions were not affected.
Comparing coding agents? Read Codex vs Claude Code.
FAQ
Is Codex CLI free?
The CLI itself is free to install, but you need a ChatGPT plan or an OpenAI API key to use it. OpenAI's pricing page lists Codex in the CLI on Plus, Pro, Business and Enterprise. Free and Go currently get GPT-6 Luna in the Codex desktop app only, subject to rollout.
Can I use Codex CLI with an API key instead of ChatGPT?
Yes. Pipe your key into codex login --with-api-key. With an API key you pay at API rates, get the CLI, SDK and IDE extension, and lose cloud features such as GitHub code review and Slack.
What are Codex usage limits?
On Plus and Standard Business, OpenAI gives a range of local messages per five-hour window that depends on the model, and weekly limits may also apply. Pro currently has no five-hour limit. Check the usage dashboard for your live limits.
What is the difference between Codex CLI and Codex cloud?
The CLI works on your local repository with tools installed on your machine. Codex cloud runs tasks in a remote environment, needs ChatGPT sign-in, and can be started from the CLI with codex cloud.
How do I run Codex in CI?
Use codex exec, the non-interactive mode, in scripts and pipelines. An API key login is the usual choice for automation.
Sources
- OpenAI: Codex CLI (accessed 2026-10-25)
- OpenAI: Codex pricing (accessed 2026-10-25)
- OpenAI: Codex authentication (accessed 2026-10-25)