OpenAI Codex: What It Is, How to Install It, and Regional Access Conditions in 2026
MarkdownCodex from OpenAI: the agent application, installation methods, interfaces, models, plans, permissions, and regional access conditions.
Read full article
The word “Codex” in search results means three different things, and people who type it in for the first time usually don’t understand what they’ve found. There was a Codex model—it was shut down in 2023; today, the name belongs to an agent program, and another dozen products with the same name are in the mix.
I’m covering just one Codex: OpenAI’s coding agent. What it does, where it runs, how much it costs, how to install it in five minutes, and what OpenAI says about countries. It’s all based on official documentation, with links for every figure at the end.
Additional materials on setting up tools are in the Ailoot documentation.
Attention
This material is for reference only. I’m not a lawyer and I don’t provide legal advice.
What is OpenAI Codex?
Key takeaway
Codex is an OpenAI coding agent. It reads your project, edits files, and runs commands subject to the active permissions and approval policy; some permitted actions run without a separate prompt. It works in the terminal, editor, ChatGPT app, browser, and cloud. It’s included with all ChatGPT plans, including the free one.
Compare it with a regular chat. In a chat, you copy a piece of code, paste it in, get an answer, then copy it back. An agent works differently: you describe a task in plain language, and it opens the relevant files in your project folder, makes changes, runs checks, and shows you the result.
OpenAI describes it in one line in its repository:
Codex CLI is an OpenAI coding agent that runs locally on your computer.
Locally means the program is downloaded to your machine, where it can see your files and run commands in your folder. Only the request to the model goes to the cloud.
The open-source code is on GitHub under the Apache-2.0 license. As of August 1, 2026, the repository has 103,000 stars, and the latest version, 0.146.0, was released on July 29. Updates come out almost every day, so your version will most likely already be different.
How is Codex in 2026 different from the old Codex that was discontinued?
Key takeaway
They are two different products with the same name. The old Codex was a line of code-davinci and code-cushman models that ran inside GitHub Copilot and were shut down on March 23, 2023. The new Codex appeared in April 2025 and became an agent rather than a model. The only thing they have in common is the name.
People confuse them all the time because both products are official and both are from OpenAI. Their dates set them apart.
The first was a set of models: code-davinci-001, code-davinci-002, code-cushman-001, code-cushman-002. They did one thing—complete code for you—and powered the first GitHub Copilot. In OpenAI’s list of discontinued models, all four appear on one line: announced on March 20, 2023, discontinued on March 23, with gpt-4o as the recommended replacement.
The second is a program installed on your computer. The @openai/codex package appeared in the npm registry on April 16, 2025. The model inside it is replaced with a newer one over time, while the program itself stays the same.
| Feature | Version before 2023 | Current version |
|---|---|---|
| What it is | a set of API models | an agent program on your computer |
| How it was used | code completion in an editor | describe a task, and the agent does it |
| Where it ran | inside GitHub Copilot and in the API | terminal, editor, app, browser, cloud |
| Status | discontinued March 23, 2023 | updated almost daily |
Any instructions about Codex from before April 2025 describe a discontinued product. If you find material that calls Codex a model and suggests calling it through code-davinci-002, close it.
Where does Codex work: terminal, editor, browser, or app?
Key takeaway
Codex works in five places, and it’s the same agent behind different interfaces. The CLI runs in the terminal, the extension integrates with an editor, a separate mode is available in the ChatGPT app for macOS and Windows, ChatGPT in the browser answers quick questions, and Codex cloud runs tasks in isolated OpenAI containers.
You don’t have to choose between them. The sign-in is the same, and so is the account. The only difference is where it’s more convenient for you to work.
| Where it works | Where it runs | What it’s useful for |
|---|---|---|
| CLI | terminal on your machine | editing a project, running commands, working in scripts |
| Editor extension | VS Code, Cursor, Windsurf, Xcode, JetBrains | editing next to the open file, viewing changes in place |
| ChatGPT app | macOS and Windows | long tasks, working with files outside the terminal |
| ChatGPT in the browser | any computer, no installation | a quick coding question when you don’t have a terminal handy |
| Cloud | OpenAI containers, sign in at chatgpt.com/codex | parallel tasks, launching tasks from GitHub, Linear, Slack |
The extension works differently for Xcode and JetBrains than it does for the other editors:
Choose your editor. VS Code and compatible editors use the Codex extension; Xcode and JetBrains have their own integrations.
Cloud works differently from the other four. The task goes to an OpenAI container, where a copy of the repository is checked out from GitHub. The agent works without your computer, and you later review the result and decide whether to bring the changes into your own copy. Setup takes three steps: connect GitHub, create an environment with the required dependencies, and assign a task.
If you sign in with an API key, the terminal, editor, and app work. Cloud is unavailable with a key, as are the features tied to it, such as automatic code review and launching tasks from Slack. You need to sign in with a ChatGPT account for those.
Which model runs inside Codex?
Key takeaway
The GPT-5.6 family has three models: Sol for complex tasks, Terra for everyday work, and Luna for quick, repetitive tasks. Switch models with /model; reasoning effort can be adjusted alongside it. GPT-5.4 and GPT-5.4 mini will leave Codex on August 31, 2026, replaced by Terra and Luna, respectively.
OpenAI sums it up in one line:
Codex offers three GPT-5.6 models: Sol for deeper exploration and detail, Terra as the everyday workhorse, and Luna for straightforward, repetitive work. If you’re unsure, start with Sol.
There’s a second control next to the model: reasoning effort. It has four settings: Low (called Light in the app and editor), Medium, High, and Extra High. OpenAI recommends using the lowest level that gets the result you need and raising it when a task requires planning.
There are two more modes above that. Max gives the model more time on a task. Ultra splits the work into parts and assigns them to subagents in parallel. The documentation says directly that most tasks need neither.
There’s also a separate entry, gpt-5.3-codex-spark—a research version for quick iterations, available only on the Pro plan.
Choosing the model and reasoning effort is already context engineering: you decide how much the agent thinks and what it brings to the task.
How much does Codex cost, and what’s included in the plans?
Key takeaway
Codex is included with all ChatGPT plans, including the free one. Free costs 0 dollars, Go 8, Plus 20, Pro starts at 100, and Business is 20 per seat with annual billing. There is no separate Codex subscription: you pay for ChatGPT, and Codex comes with it. You can also sign in with an API key and pay for tokens as you use them.
I checked prices against the official pricing page on August 1, 2026.
| Plan | Monthly price | What it includes |
|---|---|---|
| Free | $0 | Codex for short tasks |
| Go | $8 | Codex for light tasks |
| Plus | $20 | Codex in the terminal, editor, web, and on iOS, with the GPT-5.6 family |
| Pro | from $100 | 5 times Plus limits; the $200 plan provides 20 times the limits |
| Business | $20 per seat with annual billing | 2 seats minimum, shared workspace, single sign-on |
| Enterprise and Edu | by request | priority processing, audit logs, data retention controls |
| API key | per token | terminal, editor, and SDK, without cloud features |
Business costs $25 per seat with monthly billing instead of $20.
Now, about limits. OpenAI doesn’t give one fixed number:
The number of messages you can send depends on the model you choose, the size and complexity of the tasks, and whether you run them locally or in the cloud.
Instead of one number, OpenAI publishes a range: how many messages you get over five hours when working on your own machine. The figures are the same for Plus and Business:
| Model | Messages per 5 hours |
|---|---|
| GPT-5.6 Sol | 10-100 |
| GPT-5.6 Terra | 25-200 |
| GPT-5.6 Luna | 250-2 000 |
| GPT-5.5 | 15-80 |
| GPT-5.4 | 20-100 |
| GPT-5.4 mini | 60-350 |
On the $100 Pro plan, all figures are multiplied by five; on the $200 Pro plan, by twenty. OpenAI also mentions weekly limits in addition to the five-hour window, but publishes no specific figures for them.
The tenfold range within a single model has a simple explanation. One message can use either one percent or ten percent of your daily allowance, because the amount of work done is what counts, while the number of requests has little effect. I explained how tokens get used in practice in detail using Claude as an example in Claude Pro and Max limits—the mechanics are exactly the same.
When you run out, there are three options: buy extra credits without changing your plan, switch to a lighter model, or start a session with an API key and pay for tokens as you use them.
What regional restrictions apply to Codex?
Key takeaway
The program can be downloaded and run anywhere, but it’s useless without an OpenAI account, and the restriction applies to the account itself. The country check happens at sign-in and returns a 403 code. There’s no official way to bypass it, and I won’t show one.
OpenAI publishes its official list of supported countries and territories publicly. Belarus is not on the list. Kazakhstan, Armenia, Georgia, Turkey, Serbia, and Ukraine are on it.
The wording on that same page:
Access to our services, or providing access to them, outside the countries and territories listed below may result in account suspension or termination.
Installing and running the program is one thing; access to the model is another. The country check kicks in at sign-in: both signing in through ChatGPT and signing in with an API key lead to an OpenAI account.
A country-related rejection looks like this:
{
"error": {
"code": "unsupported_country_region_territory",
"message": "Country, region, or territory not supported",
"type": "request_forbidden"
}
}
The unsupported_country_region_territory code and 403 status indicate a country-related rejection. If you see this, it means you didn’t break anything during installation, and Node has nothing to do with it.
There’s a second barrier that isn’t described in the documentation at all but comes up more often in real life. It’s phone number verification. The report “Phone number verification doesn’t work” has 206 comments; a second report, about an old number that’s no longer accessible and can’t be replaced, has been open since June 2026 and has 71 comments. The same story keeps coming up: ChatGPT works in the browser on the same account, but Codex asks for phone verification, and there’s no way around it. OpenAI doesn’t publish a list of countries whose phone numbers it accepts, so there’s no way to check yours in advance.
I’m not covering workarounds; this article is about how the tool works.
Anthropic also publishes its list of supported countries, and it works the same way. Materials that present one tool as “allowed” and another as “blocked” simply mislead readers—they’re formally in the same position. Both lists change, so check the current versions.
How to install Codex: step by step
Key takeaway
Installation takes five minutes. On macOS and Linux, install it with one command through the official installer; on Windows, use PowerShell. npm and Homebrew are also available. Then run codex in the project folder, sign in through the browser, and you can give it your first task. On Linux and WSL2, install bubblewrap first.
The technical part starts here, for those who already have an active OpenAI account.
Install the program
Choose the method for your system. Use the same method later to update the program to the latest version.
Open the project folder
The agent works in the folder from which you launched it. Go there before running the first command.
Sign in to your account
The first time you run
codex, it will offer to sign you in. A browser will open, and after you sign in, control will return to the terminal.Give it your first task
Describe what you need in plain language. Start with something harmless, like asking it to describe the project.
Installation command for macOS and Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
On Windows, use the same installer through PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
If you already have Node, you can install it through npm:
npm install -g @openai/codex
Homebrew works on macOS. Make sure to use --cask; without it, you’ll install the wrong thing:
brew install --cask codex
Attention
Check the package name before installing through npm. I checked the registry: since October 1, 2011, someone else’s package has been listed under the name codex without a prefix. It’s a static site generator, and the latest version is 0.2.3. It installs without any message and won’t work. The correct name is @openai/codex: the at sign, the company name, and a slash.
On Linux and WSL2, the sandbox is built on bubblewrap, which you need to install ahead of time:
sudo apt install bubblewrap
On Fedora and related systems, use sudo dnf install bubblewrap. Also, WSL version 1 was supported through version 0.114; starting with 0.115, the sandbox moved to bubblewrap and WSL1 no longer worked. On Windows, though, everything also works without WSL, using its own built-in sandbox.
What should you do at first launch?
Key takeaway
Short slash commands work inside a session. Start with /status, which shows the model, approval policy, and working folders. Then try /permissions to see what the agent is allowed to do. /model switches models, /init creates a file describing the project, and /review reviews changes without editing files.
To start, go to the project folder and type codex; a session will open. Then describe the task in plain language, without any special syntax.
Five commands for your first few minutes:
/status- the model, approval policy, and which folders the agent considers its workspace./permissions- the current access mode and how to switch between modes./model- change the model and reasoning effort./init- creates anAGENTS.mdfile describing the project; more on that in the next section./review- a separate review of your changes, without editing files.
Besides plain codex, three useful terminal commands are:
codex resume # return to the previous conversation in this folder
codex exec "fix the tests" # one-off run without a dialogue, for scripts
codex --image screenshot.png # attach an image to the task
On both the terminal and extension documentation pages, OpenAI repeats the same advice: commit before and after a task. The agent edits files on its own, and you’ll want to be able to revert with one command as soon as the first day.
How do you explain your project to Codex with AGENTS.md?
Key takeaway
AGENTS.md is a text file in the project root where you write rules in your own words: how to run tests, which package manager to use, what not to touch. The agent reads it before starting work. There’s a global file in your home folder and project-level files; rules from both work together. The total size is limited to 32 kilobytes.
The order is strict, and the documentation states it in the very first line of the section:
Codex reads AGENTS.md files before beginning any work.
First, Codex reads the global file ~/.codex/AGENTS.md, where you put habits that apply to all your projects. Then it reads files in the project itself: one file per folder, from the repository root down to your current folder. They’re combined from top to bottom, and a closer file overrides a more distant one. That means a rule in services/payments takes precedence over a general rule from the root.
A simple file looks like this:
# AGENTS.md
## How to work with this project
- Run tests with `npm test`; don't run them one file at a time.
- Install packages with pnpm.
- Ask me before adding a new production dependency.
- Do not touch the `legacy/` folder at all.
The limit is 32 kilobytes for the combined files. After that, files simply stop being added, without notice. An oversized AGENTS.md also burns through the limit on every run because the entire file goes into context.
If you know CLAUDE.md, the mechanics will look familiar: it’s the same technique under a different name. The project rules file works as the foundation of a Second Brain: the agent learns about your work before you’ve had a chance to explain anything. I covered how to use both files in one project in AGENTS.md and CLAUDE.md together.
What does Codex do on its own, and what requires approval?
Key takeaway
There are two independent settings. The sandbox determines where the agent can write and whether it can access the network. The approval policy determines when it stops and asks. By default, in a git folder the agent edits files in the working folder on its own, and only goes outside it or accesses the network with approval.
These two settings are often confused, so OpenAI spells out the difference in one line:
Changing who reviews a request does not expand the sandbox.
Switching review to automatic leaves the working-folder boundaries as they were. Automation just removes the clicks; it doesn’t change the agent’s permissions.
The app and editor have three access modes. Ask for approval is always available and is the recommended starting point. Approve for me and Full access must first be enabled in settings.
The terminal has its own logic: the program checks the folder and suggests a suitable set of permissions.
| Situation | What the program suggests | What it means |
|---|---|---|
| Folder under git control | Auto | edits files in the working folder on its own; approval needed to go outside it or access the network |
| Folder without git | read-only | reads and responds, but makes no changes |
| Codex cloud | OpenAI container | dependencies are installed during setup; work then proceeds without network access |
Network access is off by default in local mode. The agent runs commands it came up with itself, and no one would let that reach the internet by default.
Even inside the working folder, the agent can only read certain locations in every mode: .git, .agents, and .codex. Use /status to see which folders the agent currently considers its workspace.
There’s also full access mode—the --dangerously-bypass-approvals-and-sandbox flag. The documentation marks it as higher risk and labels it “not recommended.” The flag’s name says it all; I have nothing to add.
Codex or Claude Code: which should you choose?
Key takeaway
Both tools are built the same way: an agent in the terminal, an editor extension, an app, and cloud. They differ in models, entry price, and details such as the name of the project rules file. Codex’s lowest-cost entry starts at zero; Claude Code’s starts at 17 dollars.
| Feature | Codex | Claude Code |
|---|---|---|
| Provider | OpenAI | Anthropic |
| Models | GPT-5.6: Sol, Terra, Luna | Opus, Sonnet, Haiku |
| Project rules file | AGENTS.md | CLAUDE.md |
| Sign-in | ChatGPT account or API key | Claude subscription or Console billing |
| Lowest-cost entry | Free at $0, Go at $8 | Pro at $17 with annual billing |
| Where it works | terminal, editor, app, web, cloud | terminal, editor, app, web |
| Sandbox | network off by default, writes to working folder | permission modes, configurable |
| Supported countries list | published by OpenAI | published by Anthropic |
The difference between the tools is smaller than you might conclude from online arguments. Both read your project and edit files on their own, and both ask before going beyond the folder.
At the start, it’s easiest to look at what you already pay for. If you have a ChatGPT subscription, Codex is already included; you don’t need to pay separately. I made a detailed comparison with measurements in a separate piece about Codex vs. Claude Code, and if you want to move your working settings from one to the other, there’s a migration guide.
What most often breaks on first launch?
Key takeaway
Five typical issues: the wrong npm package was installed, bubblewrap isn’t installed on Linux, access is denied by country at sign-in, phone number verification is required, or you unexpectedly run out of usage limits.
This list is based on reports in the project repository. There’s no guesswork here; every item comes from someone who ran into it.
- The wrong package was installed.
npm install -g codexwithout a prefix installs a static site generator from 2011. The correct package is@openai/codex. - bubblewrap isn’t installed. Without it on Linux and WSL2, the sandbox doesn’t start. Codex switches to its built-in fallback and complains at startup. Install it with one command.
- Access denied by country. The
unsupported_country_region_territorycode and 403 status appear at sign-in. Installation has nothing to do with it. - Phone verification is required. This doesn’t happen to everyone and isn’t described in the documentation. There’s no official way to replace an inaccessible number; the report about it has been open since June 2026.
- You run out of usage limits sooner than expected. The report “Tokens burn up very quickly” is the most discussed in the entire repository, with 627 comments. Switching to a lighter model and lowering reasoning effort can help.
The interface language doesn’t affect the agent’s work: the task language doesn’t have to match the interface language.
What to do next
Key takeaway
Install the program and open a project, then inspect /status and /permissions before assigning work. Choose and verify read-only access if the first task should only describe files. Auto mode can edit the working folder without asking for each change; do not infer read-only protection merely from a harmless-sounding prompt or the absence of Git. Next, add an AGENTS.md with three rules and compare the responses.
The first hour with an agent always goes toward the same thing: figuring out how far it can go on its own. You can only learn that with your own project; an example in the documentation won’t tell you.
Here’s the order I recommend to start:
- Install the program and sign in to an active OpenAI account.
- Open a real project folder and run
codex. - Check
/statusand/permissions, explicitly choose read-only access for an inspection-only task, and verify the active mode before asking how the project is organized. - Make a commit and give it its first editing task.
- Write a three-line
AGENTS.mdand compare how the agent responds before and after.
Sources
- Codex CLI: installation and first launch - official OpenAI documentation
- Codex editor extension - list of supported editors
- Codex cloud - tasks in isolated environments
- Codex models - GPT-5.6 Sol, Terra, Luna, and dates when older models are discontinued
- Codex plans and limits - plan prices and how many messages are available every five hours
- Sign-in methods - ChatGPT account and API key
- Sandbox and approvals - access modes, bubblewrap on Linux
- Agent permissions and security - protected paths, dangerous flag, default suggestions
- Permission modes - Ask for approval, Approve for me, Full access
- AGENTS.md - how the agent reads project rules
- Supported countries and territories - official OpenAI list
- Discontinued OpenAI models - date the old Codex was discontinued
- openai/codex repository - open-source code, user reports, releases
- @openai/codex package in the npm registry - versions and publication dates
- Codex releases on GitHub - version numbers and release dates
Find additional materials on working with tools in the Ailoot documentation.
More details
Questions about OpenAI Codex: What It Is, How to Install It, and Regional Access Conditions in 2026
Will Codex ask before every file change?
No. In the Auto workflow described here, permitted edits inside the working folder can run without an individual approval. Inspect /status and /permissions before the first task, and explicitly choose read-only access when you only want an explanation.
Why does installation succeed but sign-in fail with a regional error?
Installing the CLI and obtaining model access are separate steps. A 403 error with unsupported_country_region_territory concerns account access rather than Node or the installer; compare the account’s region with OpenAI’s supported-country information.