Codex is OpenAI’s coding agent. It reads your repository, edits files and runs commands, and the same agent is available in four places: the Codex CLI in your terminal, the Codex IDE extension, the ChatGPT desktop app, and Codex cloud, which keeps working on tasks in its own workspace while your computer is asleep (openai/codex README, Codex CLI, Codex cloud).
You use it by signing in with a ChatGPT plan (Free and Go get GPT-6 Luna in the desktop app; the CLI, IDE extension and cloud start at Plus, $20/month) or with an OpenAI API key billed at API rates (Pricing). The current CLI release is 0.169.0, published to npm on November 13, 2026 (npm: @openai/codex). To install the CLI on macOS or Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Applies to: Codex CLI 0.169.0 and OpenAI’s Codex docs as of November 15, 2026. Last checked: November 15, 2026.
On this page
What Codex is today
OpenAI’s documentation describes Codex as a set of clients for one agent, with usage included in ChatGPT plans; ChatGPT Work inside ChatGPT now uses the same pricing, credits and usage limits as Codex (Pricing). The openai/codex README points to each way to run it: the CLI, the IDE extension, the desktop app (codex app), and the cloud agent at chatgpt.com/codex.
| Surface | Where it runs | What the docs say it is for |
|---|---|---|
| Codex CLI | Your terminal, against your local repository | Inspect code, make changes, run commands, and call codex exec from scripts and CI (Codex CLI) |
| Codex IDE extension | VS Code, Cursor, Windsurf, VS Code Insiders; Xcode and JetBrains IDEs have their own integrations | Work with open files and selections and review diffs in your editor (Codex IDE extension) |
| ChatGPT desktop app | macOS, Windows, Linux | Projects, files and long-running work; in the app you choose ChatGPT or Codex for a chat (ChatGPT desktop app) |
| Codex cloud | OpenAI-managed environments | Each task has its own workspace and keeps working while your computer is asleep; review the changes, then commit or open a pull request (Codex cloud) |
The CLI is open source under the Apache-2.0 license in the openai/codex repository. Release builds are listed on the releases page, and the npm registry shows 0.169.0 as the latest tag (November 13, 2026, 08:43 UTC) and 0.171.0-alpha.5 as the alpha tag (npm: @openai/codex). For a side-by-side look at the surfaces, see Codex CLI vs Codex app vs IDE extension.
What Codex costs on each plan
Codex usage comes from your ChatGPT plan or from an API key. Prices and plan contents below are copied from OpenAI’s Pricing page on November 15, 2026.
| Plan | Price | What the pricing page lists for Codex |
|---|---|---|
| Free | $0/month | GPT-6 Luna at Standard speed in the desktop app, subject to rollout |
| Go | $8/month | GPT-6 Luna at Standard speed in the desktop app, subject to rollout |
| Plus | $20/month | Codex on the web, in the CLI, in the IDE extension and on iOS; automatic code review and Slack; GPT-6.1 Sol and GPT-6 Luna; extra usage with ChatGPT credits |
| Pro | From $100/month (plans at $100, $200 or $500) | Everything in Plus; Ultrafast mode on Pro $500 |
| Business | $20 per user/month billed annually (2+ users), $25 billed monthly | Codex in desktop and mobile apps, larger cloud machines, SAML SSO, credits |
| Enterprise & Edu | Contact sales | Everything in Business plus SCIM, EKM, RBAC, audit logs via the Compliance API, data residency |
| API key | API rates | Codex in the CLI, SDK or IDE extension; no cloud-based features such as GitHub code review or Slack |
The same page gives estimates of local messages per five-hour period for Plus and Standard Business. OpenAI says these are not fixed limits, cloud tasks may use more, weekly limits may also apply, and Pro plans currently have no five-hour limit:
| Model | Plus, local messages per 5 hours (estimate) |
|---|---|
| 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 |
Fast mode uses included usage 2.5 times faster than Standard speed for the same model, and Ultrafast on GPT-6 Astra or GPT-6.1 Sol uses it 8 times faster (Pricing). Read as numbers: if a Plus session gets the low end of the GPT-6.1 Sol range, about 15 messages, the same work in Fast mode would cover about 6 (15 ÷ 2.5). Check your actual remaining limits at the usage dashboard or with /status in a CLI session. How the five-hour and weekly windows and credits work is covered in Codex usage, and each plan has a listing: Codex Free, Codex Go, Codex Plus, Codex Pro, Codex Business and Codex with an API key.
How to install the Codex CLI
The Codex CLI getting-started page lists four install methods.
macOS and Linux, standalone installer (the same command updates it):
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Windows, standalone installer (run from a new PowerShell window; the same command updates it):
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
npm (install and update):
npm install -g @openai/codex
Homebrew:
brew install --cask codex
Update with Homebrew:
brew upgrade --cask codex
The standalone installer puts the codex command in ~/.local/bin on macOS/Linux and in %LOCALAPPDATA%\Programs\OpenAI\Codex\bin on Windows; CODEX_INSTALL_DIR changes that location (Environment variables). For scripted installs the docs show:
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh
The standalone installers download from https://releases.openai.com/codex by default and fall back to GitHub Releases if a download there is unavailable. To force GitHub Releases, the README gives:
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh
The README also links prebuilt binaries on the latest GitHub Release, for example codex-aarch64-apple-darwin.tar.gz for Apple Silicon and codex-x86_64-unknown-linux-musl.tar.gz for x86_64 Linux. On Windows, the choice between the native sandbox and WSL2 is covered in Codex CLI on Windows.
How to sign in: ChatGPT account or API key
Codex has two sign-in methods for OpenAI models: Sign in with ChatGPT for subscription access and sign in with an API key for usage-based access. The desktop app, CLI and IDE extension accept both; Codex cloud requires ChatGPT sign-in (Authentication).
-
Open a project directory and run
codex. The first time, choose Sign in with ChatGPT or another sign-in method (Codex CLI). -
Or run the login command directly. With no flags it opens the browser sign-in:
codex login -
To use an API key instead, pipe it through stdin:
printenv OPENAI_API_KEY | codex login --with-api-key -
On a remote or headless machine, use device code login (beta), which you first enable in your ChatGPT security settings or workspace permissions:
codex login --device-auth -
Check which method is active, or sign out:
codex login status codex logout
Which sign-in to choose
| Sign-in method | Billing | Limits on features |
|---|---|---|
| ChatGPT account | Usage included in your ChatGPT plan, extendable with credits on eligible plans | Full set of surfaces for your plan, including Codex cloud |
| API key | Standard API rates through your OpenAI Platform account | CLI, SDK and IDE extension only; no cloud-based features such as GitHub code review or Slack |
Sources: Authentication, Pricing. The pricing page recommends the API key route for automation in shared environments like CI.
Credentials are cached in a plaintext file at ~/.codex/auth.json or in the OS credential store. OpenAI’s docs say to treat auth.json “like a password: it contains access tokens” (Authentication). The cli_auth_credentials_store key in config.toml sets where credentials go (file, keyring, auto or ephemeral):
# file | keyring | auto | ephemeral
cli_auth_credentials_store = "keyring"
Which models Codex uses
The Models page now recommends four models for Codex and ChatGPT Work:
| Model | What OpenAI recommends it for | Where the docs list it |
|---|---|---|
GPT-6 Astra (gpt-6-astra) | The hardest end-to-end work across code, apps and research | Desktop app, web, CLI, IDE extension, API |
GPT-6.1 Sol (gpt-6.1-sol) | Near-Astra performance at a lower cost, for repeated, long-running work; 500,000-token default context window | Desktop app, web, CLI, IDE extension, API |
GPT-6.1 Terra (gpt-6.1-terra) | Fast, efficient writing, visual understanding and computer use; needs Codex CLI 0.159.0 or later | Desktop app, web, CLI, API (not listed for the IDE extension) |
GPT-6 Luna (gpt-6-luna) | Focused, high-volume tasks such as extraction and structured summaries | Desktop app, web, CLI, IDE extension, API |
Availability still depends on plan, sign-in method, client and rollout. Switch models inside a CLI session with /model, or at launch:
codex --model gpt-6.1-sol
To try Terra in the CLI, the docs give:
codex -m gpt-6.1-terra
Set a default in config.toml, which the desktop app, CLI and IDE extension share:
model = "gpt-6.1-sol"
In the CLI, /model followed by More reasoning… shows a model’s Max option (more time on a single task) and Ultra option (splits the work across subagents). GPT-6 Luna goes up to Max but not Ultra (Models).
Retirements for Codex with ChatGPT sign-in, from the Models page:
| Model | Status | Replacement the docs give |
|---|---|---|
| GPT-5.5 | Retired October 14, 2026, 19:00 UTC | gpt-6.1-sol on Plus, Pro, Business, Enterprise and Edu; gpt-6-luna in the desktop app on Free and Go |
| GPT-5.3-Codex-Spark | Retired September 14, 2026 | An available model |
gpt-5.4, gpt-5.4-mini | Retired August 31, 2026 | gpt-6-sol, gpt-6-luna |
gpt-5.2, gpt-5.3-codex | Deprecated | An available model |
If a script, custom agent or config.toml still names gpt-5.5, OpenAI says to replace it. The OpenAI API and Codex used with your own API key are not affected by these ChatGPT-side retirements, and GPT-5.5 remains available there.
AGENTS.md: project instructions
Codex reads AGENTS.md files before doing any work (Custom instructions with AGENTS.md). Discovery order:
- Global: in your Codex home (
~/.codexunlessCODEX_HOMEis set), Codex readsAGENTS.override.mdif present, otherwiseAGENTS.md. - Project: from the project root (usually the Git root) down to the current directory, Codex checks each directory for
AGENTS.override.md, thenAGENTS.md, then any names inproject_doc_fallback_filenames, and takes at most one file per directory. - Merge: files are concatenated from the root down, so files closer to your working directory appear later and override earlier guidance.
Codex skips empty files and stops adding files once the combined size reaches project_doc_max_bytes, 32 KiB by default. Example from the docs:
# AGENTS.md
## Repository expectations
- Run `npm run lint` before opening a pull request.
- Document public utilities in `docs/` when you change behavior.
To accept a different filename and raise the size limit:
# ~/.codex/config.toml
project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"]
project_doc_max_bytes = 65536
How this compares with Claude Code’s CLAUDE.md is in CLAUDE.md vs AGENTS.md. OpenAI publishes ready-made skills for Codex too; see the OpenAI skills for Codex listing.
Sandbox and approval modes
Two controls decide what Codex can do on your machine (Agent approvals & security, Sandbox):
- Sandbox mode sets the technical boundary: where Codex can write and whether commands can reach the network.
- Approval policy sets when Codex stops and asks you.
sandbox_mode | What the docs say it allows |
|---|---|
read-only | Inspect files; no edits or commands without approval |
workspace-write | Read files, edit inside the workspace, run routine local commands; network off by default. The docs call it “the default low-friction mode for local work” |
danger-full-access | No sandbox restrictions on filesystem or network |
| Approval setting | Behavior |
|---|---|
approval_policy = "on-request" | Works inside the sandbox and asks when it needs to go beyond it |
approval_policy = "never" | Does not stop for approval prompts |
approval_policy = { granular = { ... } } | Keeps chosen prompt categories (sandbox, rules, MCP, request_permissions, skill scripts) interactive and rejects the others automatically |
approvals_reviewer = "auto_review" | With on-request or granular, sends eligible approval requests to a reviewer agent before Codex runs the action; the docs note it uses extra model calls |
The untrusted approval policy is no longer supported; the docs say to switch to approval_policy = "on-request" or run codex --sandbox read-only --ask-for-approval on-request (Agent approvals & security).
On launch, Codex recommends Auto for version-controlled folders and read-only for folders that are not, and it may start in read-only until you trust the working directory. The Auto preset is:
codex --sandbox workspace-write --ask-for-approval on-request
In that preset Codex asks before editing files outside the workspace or running commands that need network access. Inside a session, /permissions opens the permissions picker and /status shows which directories are in the workspace. Sandboxing is OS-native: Seatbelt on macOS, the native Windows sandbox in PowerShell, and bubblewrap on Linux and WSL2, which the docs ask you to install first:
sudo apt install bubblewrap
Warning
OpenAI describes full access as
sandbox_mode = "danger-full-access"together withapproval_policy = "never"; thedanger-full-accessmode “removes the filesystem and network boundaries and should be used only when you want the agent to act with full access” (Sandbox). The documented lower-risk alternatives are theworkspace-write+on-requestpreset,writable_rootsto add specific directories, Auto-review, and rules to allow, prompt or forbid specific command prefixes outside the sandbox. The flags that skip approvals are covered in Codex: dangerously skip permissions and safer modes.
To give commands network access while keeping the sandbox, enable it in config.toml:
[sandbox_workspace_write]
network_access = true





