OpenAI Codex Guide: CLI, IDE Extension and Codex Cloud
Last checked: 2026-11-09 · Sources: Codex CLI docs↗, Codex pricing and limits↗, IDE extension↗, Codex Cloud↗, GitHub openai/codex↗
#Quick answer: what is Codex, how do I install it and what does it cost?
Codex is OpenAI's coding agent. It reads your repository, edits files, runs commands and hands you a diff to review. One account works in four places: the Codex CLI in your terminal, the IDE extension in VS Code-based editors, Codex Cloud inside ChatGPT, and the ChatGPT desktop app. The CLI is written in Rust and open source under Apache-2.0.
As of 2026-11-09:
- Install:
npm install -g @openai/codexorbrew install --cask codex; the current version is 0.167.0. There is also an official install script. - Full CLI, IDE and cloud use starts with ChatGPT Plus: $20/month, with GPT-6.1 Sol and GPT-6 Luna.
- Free ($0) and Go ($8/month): GPT-6 Luna at standard speed in the desktop app only, subject to rollout.
- Pro: $100, $200 or $500 per month; OpenAI says Pro currently has no five-hour limit.
- Business: $20 per user per month billed annually (2+ users), $25 billed monthly; Enterprise and Edu by quote.
- API key: billed at API prices, for example
gpt-6.1-solat $2 input / $10 output per million tokens.
#Which ways can I use Codex?
| Surface | Where it runs | Best for |
|---|---|---|
| Codex CLI | Your machine, on the local repo | Daily edits and debugging; codex exec in scripts and CI |
| IDE extension | VS Code, Cursor, Windsurf, VS Code Insiders; Xcode and JetBrains use their own integrations | Delegating tasks without leaving the editor |
| Codex Cloud | OpenAI cloud environments connected to your GitHub repos | Tasks that keep running while your computer sleeps; commit or open a PR after review |
| ChatGPT desktop app | Your machine, with a native sandbox | People who prefer not to use a terminal; PowerShell support on Windows |
codex cloud in the terminal lists cloud tasks, submits new ones and applies results to your local repo.
#How do I install the Codex CLI?
bash# macOS / Linux install script (run it again to update) curl -fsSL https://chatgpt.com/codex/install.sh | sh # npm npm install -g @openai/codex # Homebrew brew install --cask codex
Windows PowerShell:
powershellpowershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
Run codex in a project folder. On first run choose Sign in with ChatGPT or another sign-in method such as an API key. Commit before and after each task so you can revert.
#How much can I use on Plus?
OpenAI gives these ranges of local messages per five hours for Plus and standard Business seats:
| Model | Local messages per 5 hours |
|---|---|
| GPT-6 Astra | 5–45 |
| GPT-6.1 Sol | 15–160 |
| GPT-6.1 Terra | 35–285 |
| GPT-6 Sol | 15–150 |
| GPT-6 Luna | 350–3,000 |
The ranges are wide because one message can read a few files or hundreds. Cloud tasks use more of the allowance than local messages, and weekly limits may also apply; OpenAI publishes no numbers for those. GPT-5.5 was retired from Codex with ChatGPT sign-in on 2026-10-14 (API-key sessions are not affected).
#How does AGENTS.md work?
AGENTS.md holds the project instructions Codex reads at the start of every run: build and test commands, conventions and no-go areas.
Lookup order from the official docs:
- Global:
~/.codex/AGENTS.override.md, else~/.codex/AGENTS.md(or theCODEX_HOMEdirectory) - Project: from the project root (usually the Git root) down to your current directory; in each directory Codex checks
AGENTS.override.md, thenAGENTS.md, then names inproject_doc_fallback_filenames, taking at most one file per directory - Files are joined root first, so files closer to your current directory win
- The combined size stops at
project_doc_max_bytes, 32 KiB by default
toml# ~/.codex/config.toml project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"] project_doc_max_bytes = 65536
Check what loaded:
bashcodex --ask-for-approval never "Summarize the current instructions."
#How do sandbox and approvals work?
| Preset | Command | Effect |
|---|---|---|
| Auto (default in Git repos) | codex --sandbox workspace-write --ask-for-approval on-request | Reads, edits and runs commands in the workspace; asks before touching files outside it or using the network |
| Read-only | codex --sandbox read-only --ask-for-approval on-request | Discussion and planning without edits; the default outside version control |
| Full access | --yolo | No sandbox; avoid on your main machine |
workspace-writehas no network by default, sonpm installfails until you enable network access in config..git,.codexand.agentsinside the workspace stay read-only.approval_policy = "untrusted"is no longer supported.- Use
/permissionsto switch during a session and/modelto change model and reasoning effort.
#Useful commands
| Command | What it does |
|---|---|
codex | Interactive session in the current folder |
codex exec "..." | Non-interactive run for scripts and CI |
codex resume | Reopen an earlier session |
codex --search | Allow live web search for this run |
codex cloud | List or submit cloud tasks and apply results locally |
codex mcp | Add and inspect MCP servers |
/review | Review current changes without editing files |
Comment @codex review on a GitHub pull request to have Codex review it in the cloud.
#Codex vs Claude Code vs Cursor
| OpenAI Codex | Claude Code | Cursor | |
|---|---|---|---|
| Surfaces | CLI, IDE extension, Codex Cloud, ChatGPT desktop app | CLI, VS Code and JetBrains extensions, desktop app, web | VS Code-based editor, CLI (agent), Cloud Agents |
| Project instructions | AGENTS.md (32 KiB default cap) | CLAUDE.md; also reads a repo's AGENTS.md | .cursor/rules/*.mdc or AGENTS.md |
| Models | OpenAI GPT-6 / 6.1 models | Anthropic Claude models | Composer 2.5, Claude, GPT, Gemini, Grok |
| Lowest full individual price | ChatGPT Plus $20/month | Claude Pro $20/month ($17 billed annually) | Free $0; Plus $8 (Grok only); Premium $30 for third-party models |
| Pay as you go | OpenAI API key | Console API key | Usage beyond the plan billed per token |
Prices as of 2026-11-09; see Claude pricing↗ and Cursor pricing↗.
- You already pay for ChatGPT Plus: start with Codex. Cloud tasks and GitHub PR reviews are where it saves the most effort.
- Your team lives in the terminal: run the same real task in Codex and Claude Code before you decide.
- You prefer editing in an editor: Cursor feels smoother, and the Codex extension also installs in Cursor.
All three read AGENTS.md, so one file of team rules works everywhere.
#FAQ
Is this the 2021 Codex model? No. The 2021 Codex was a code-completion model and was retired long ago. Today's Codex is OpenAI's coding agent product running current GPT models.
Can company code go into Codex Cloud? Cloud tasks connect to GitHub and install dependencies in a cloud environment. For sensitive code, have an admin confirm the ChatGPT workspace data and network policies first, or stay with the local CLI and IDE extension.
Can a Free account use the Codex CLI? As of 2026-11-09 the pricing page lists GPT-6 Luna in the desktop app for Free and Go, subject to rollout. Full CLI, IDE and web use starts with Plus, or pay per token with an API key.