What is Codex CLI, and which ChatGPT plans include it?
Codex CLI is a coding agent from OpenAI that runs on your own computer. Its README describes it as one that "runs locally on your computer," and it reads, changes and runs code in the folder you start it in. It is not the same product as Codex Web at chatgpt.com/codex, which is OpenAI's cloud agent. As of November 2026 the repository is licensed Apache-2.0, written in Rust and has 135,325 stars on GitHub.

We read those dates from OpenAI's GitHub release pages on 15 November 2026. Going from 0.150.0 to 0.169.0 is 19 minor versions in 79 days, so the CLI you installed last month has probably moved. Every install method below has an update command too.
The plan answer comes from two OpenAI pages. The README says to sign in "to use Codex as part of your Plus, Pro, Business, Edu, or Enterprise plan." OpenAI's Codex pricing page lists the CLI on the Plus card, calls Pro "Everything in Plus" and more, and lists it for an API key. The Free and Go cards list only GPT-6 Luna in the desktop app, "subject to rollout." So a Free or Go account has no CLI route except an API key. Codex pricing has the dollar side, and is Codex free covers the free taste.
How do you install Codex CLI?
You install it with one command, and OpenAI lists four. These come straight from OpenAI's Codex CLI page and the README, read on 15 November 2026. Windows users should start from a new PowerShell window.
| Route | Install command | Update command | |
|---|---|---|---|
| macOS and Linux script | `curl -fsSL https://chatgpt.com/codex/install.sh \ | sh` | the same command again |
| Windows script | `powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 \ | iex"` | the same command again |
| npm | npm install -g @openai/codex | npm install -g @openai/codex | |
| Homebrew | brew install --cask codex | brew upgrade --cask codex |
The standalone installers fetch from releases.openai.com and fall back to GitHub Releases. The README says setting CODEX_INSTALLER_USE_RELEASES_OPENAI_COM to false forces GitHub instead. You can also download a binary from the latest GitHub release and rename it to codex. The CLI has its own updater too: codex update applies an update when your installed release supports it. A debug build tells you to install a release build instead.
Then open a project folder and run codex. OpenAI's page suggests a first prompt of "Tell me about this project," and gives one piece of advice worth following: "Create Git checkpoints before and after a task so you can revert changes."
How do you sign in to Codex CLI?
You sign in with your ChatGPT account the first time you run codex, by choosing Sign in with ChatGPT. You can also run codex login yourself. With no flags it opens a browser for ChatGPT's OAuth flow, and the browser hands your credentials back to the CLI. OpenAI's authentication page says this is the default path when no valid session exists.
An API key is the second route. OpenAI's docs give one way to do it in the CLI: printenv OPENAI_API_KEY | codex login --with-api-key. Usage then bills at standard API rates instead of drawing on your plan. OpenAI recommends this route for CI jobs, and its pricing page says an API key brings no cloud features such as GitHub code review or Slack.
On a remote or headless machine, the browser flow won't work. OpenAI prefers device code sign-in, which is in beta: pick Sign in with Device Code in the login screen, or run codex login --device-auth. It needs device code login switched on in your ChatGPT security settings, or by a workspace admin. If that is blocked, you can sign in on a machine with a browser and copy the cached ~/.codex/auth.json to the headless one. OpenAI says to treat that file like a password. Two more commands help in scripts: codex login status exits with 0 when credentials exist, and codex logout removes saved credentials.
How do you install Codex CLI on Windows?
You install it by pasting the PowerShell line from the table above into a new PowerShell window. OpenAI's Windows page says you can use Codex natively on Windows through the desktop app, the CLI or the IDE extension, with a Windows sandbox instead of WSL or a virtual machine. So WSL is optional, not required, as of November 2026.
The sandbox is where Windows differs. OpenAI lists three implementations: mxc, the recommended one on compatible devices, then elevated and unelevated as legacy fallbacks. MXC needs Windows 11 24H2 (build 26100.9278) or 25H2 (build 26200.9278). The desktop app prefers it on its own. For the standalone CLI you turn it on in config.toml:
```toml
[features]
prefer_mxc = true
```
To test it without changing your saved setting, OpenAI gives a one-command check for CLI 0.162.0 and later: codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK. You should see MXC_OK and exit code 0. If MXC isn't available, Codex falls back to the older selection flow.
What do Codex CLI approval modes do?
Codex CLI combines two settings, a sandbox mode that limits what commands can touch and an approval policy that decides when it must ask you first. The default is the Auto preset, and OpenAI states that "By default, the agent runs with network access turned off." These are the combinations OpenAI documents, read on 15 November 2026:
| Intent | Flags | What happens |
|---|---|---|
| Auto (default) | none, or --sandbox workspace-write --ask-for-approval on-request | Reads files, edits and runs commands in the working folder; asks before editing outside it or using the network |
| Read-only chat or planning | --sandbox read-only --ask-for-approval on-request | Reads files and runs commands inside the read-only sandbox; can ask for more |
| Read-only for CI | --sandbox read-only --ask-for-approval never | Never asks; stays inside the read-only sandbox |
| Auto-review | --sandbox workspace-write --ask-for-approval on-request -c approvals_reviewer=auto_review | Same boundary as Auto, but eligible requests go to an automatic reviewer instead of you |
| Full access | --dangerously-bypass-approvals-and-sandbox or --yolo | No sandbox and no approvals; OpenAI marks it not recommended |
You can change mode mid-session. Type /permissions and pick Auto or Read Only. For skipping prompts, --ask-for-approval never (or -a never) works with every sandbox mode, so you still choose how much freedom Codex gets. In config.toml the sandbox values are read-only, workspace-write and danger-full-access, and the approval values are on-request, never and a granular setting.
Two old options are gone. OpenAI says "Codex and ChatGPT Work no longer support approval_policy = "untrusted"," and on-failure is deprecated. The retired setting is an easy way to find yourself locked out, which the errors section below covers. For work that needs more folders, OpenAI's CLI reference says to prefer --add-dir over forcing --sandbox danger-full-access.
Which Codex CLI commands and flags do you need?
Most days you need about eight commands. The list below is from OpenAI's CLI reference and README, read on 15 November 2026, and every flag in it appears on those pages.
| Command | What it does |
|---|---|
codex | Opens the interactive terminal UI in the current folder |
codex exec "task" (short form codex e) | Runs one task without a human, for scripts and CI; add --json for newline-delimited events |
codex resume | Continues the most recent chat; --last stays in the current folder unless you add --all |
codex --search | Switches web search from the cached index to live browsing |
codex --image | Attaches a screenshot or diagram to your first prompt |
codex cloud | Browses cloud chats, submits work to an environment and applies results locally |
codex mcp | Adds and inspects MCP servers; what is MCP explains the idea |
codex app | Launches the desktop app instead, per the README |
/status | Shows the active model, approval policy, writable roots and remaining usage |
/review | Asks Codex to review your working tree without changing it |
Settings live in ~/.codex/config.toml, and any -c key=value you pass on the command line wins for that run. Web search defaults to cached results, which OpenAI says reduces exposure to prompt injection from live pages. If you use --yolo or another full-access setting, search defaults to live results instead. OpenAI says to treat web results as untrusted either way.
Anthropic's equivalent tool has its own list, covered in how to use Claude Code, and Claude Code vs Codex sets the two side by side.
Why does Codex CLI show an error, and how do you fix it?
Most Codex CLI problems come from five causes: a retired config value, a browser that can't open, a plan without the CLI, a sandbox with the network off, and a usage window that ran out. Each row below has its fix in OpenAI's own docs.
| What you see | Why, per OpenAI | Fix |
|---|---|---|
| Codex won't start after an update | A config, profile or startup script still sets the retired approval_policy = "untrusted" | Remove it; for read-only use set sandbox_mode = "read-only" and approval_policy = "on-request" |
| Sign-in never completes over SSH or in a container | The browser flow needs a browser on the same machine | Run codex login --device-auth, after enabling device code login in ChatGPT settings |
| Free or Go account can't use the CLI | Those plans list only the desktop app | Move to Plus, or sign in with an API key |
| A command that needs the internet is blocked or asks first | The workspace-write sandbox keeps the network off | Approve it once, or set network_access = true under [sandbox_workspace_write] |
| MXC sandbox fails on Windows | The device lacks the required native capability, or policy blocks it | Check your Windows build, or use the elevated fallback |
| You hit the 5-hour limit mid-task on Plus or Business | The estimated local messages for that window are spent, and weekly limits may also apply; OpenAI says Pro currently has no five-hour limit | /status shows what is left; Plus and Pro can buy credits |
| A GPT-6 Astra task ends and won't resume | In the CLI, "Full findings and resume aren't available. The task ends." after a safety pause | Start a new task; OpenAI lists resume only for clients with the findings and resume flow, not the CLI |
OpenAI notes that if you reach a limit during a turn, "the agent will be able to continue working on that turn, subject to fair use limits." Codex usage limit walks through the window and the weekly cap, and Codex selected model is at capacity covers that separate error.
While a window refills you can still ask a second model about your code. Whizi runs Claude, GPT and Gemini in one chat, and Pro's first week is $1.99. The free plan gives 10 messages a day on Whizi AI, Auto and Claude Haiku 5.5, no card. Whizi doesn't run Codex CLI or touch your files, so it answers questions rather than editing a repo.
Should you use Codex CLI, the Codex app or Codex Web?
Use the CLI if you work in a terminal, the app if you want a windowed view, and Codex Web if you want OpenAI to run the task in its cloud. The README sorts them in three lines: the IDE extension for VS Code, Cursor and Windsurf, codex app or the Codex App page for the desktop experience, and Codex Web at chatgpt.com/codex for the cloud agent.
The CLI has two advantages the others lack in OpenAI's own description. It works against your local repository with the tools already installed on your machine, and codex exec slots into scripts and pipelines. It can still hand work to the cloud: OpenAI lists codex cloud for that. Its weak spot is that Free and Go plans skip it, and that API-key sign-in drops the cloud features.
- Install with one command from OpenAI's page, then run
codexinside a project folder and choose Sign in with ChatGPT - Make a Git commit before each task so you can revert, as OpenAI advises
- Leave the Auto preset on until you trust the task, and avoid
--yolooutside a throwaway VM - Use
codex login --device-authon SSH, container or remote machines - Run
/statusto see the model, approval policy and remaining usage before a long task - Delete any
approval_policy = "untrusted"line from old configs
Frequently asked questions
Is Codex CLI free?
The CLI software is free and open source under Apache-2.0, but running it needs a ChatGPT plan from Plus up or an OpenAI API key billed per token, as of November 2026. ChatGPT Free and Go list only the Codex desktop app. Codex pricing has every plan price.
How do you update Codex CLI?
Run the command for the way you installed it. For the macOS, Linux and Windows scripts, run the install command again. For npm, run npm install -g @openai/codex again. For Homebrew, run brew upgrade --cask codex. The codex update command also works when your release supports self-update.
Does Codex CLI work on Windows?
Yes. OpenAI supports Codex CLI natively on Windows through PowerShell, with a Windows sandbox, and WSL isn't required. The recommended MXC sandbox needs Windows 11 24H2 build 26100.9278 or 25H2 build 26200.9278. Older setups use the elevated or unelevated fallbacks.
What is the difference between Codex CLI and Codex Web?
Codex CLI runs on your computer, in your terminal and your local folder. Codex Web is OpenAI's cloud agent at chatgpt.com/codex. You can start cloud tasks from the CLI with codex cloud and apply the results to your local repository afterward.