The restriction does not live in the Codex CLI. It sits one layer up: OpenAI sells ChatGPT plans and API billing only in the countries on its published lists, so sign-up and payment break for people elsewhere. The CLI itself talks to whatever provider its config names. For anyone who wants the Codex agent rather than a ChatGPT plan, the working route is an API key from a gateway that pays OpenAI for the tokens and sells access with its own payment options (cards, SBP, crypto). Below: where the restriction comes from, and how to avoid the sign-up and payment steps that fail without hiding your location.
What “not on OpenAI's supported list” means
OpenAI keeps two supported-country lists, one for ChatGPT and one for the API. Both work as allow-lists: access is for the listed countries and territories. We read the API list on 10 November 2026. Russia, Belarus, China, Hong Kong, Iran, Syria, Cuba and North Korea are not on it. India, Brazil, Nigeria, Turkey, the UAE, Vietnam, Egypt and Kazakhstan are, and Ukraine is listed with exceptions. The ChatGPT list is a separate Help Center page, so check it for your own country. Both pages warn that accessing or offering access from outside the listed places can lead to a blocked or suspended account.
If your country is on the list, you probably do not need a workaround for access. A gateway can still help when you want other payment options or one key for several vendors.
If it is not, users describe three things:
- Sign-up for a new ChatGPT account ends with an “unsupported country” error.
- A card or billing address from the restricted country is rejected when you pay for a plan or API billing.
- An older account gets restricted once the system sees a connection from an unlisted country.
OpenAI does not frame this as a ban aimed at a named country. It simply leaves the country out of the list of places where the service officially works.
Does a VPN help?
Partly, and not reliably. A VPN changes the IP that OpenAI sees, and with it people sometimes get through sign-up or back into an existing account. It does not fix payment. A card from a restricted country, or a billing address there, still fails the billing check, and payment providers look at the issuing country of the card separately from your IP.
There is a second side. Large services watch for datacenter ranges and abrupt location jumps, and such sessions sometimes get extra review. We do not advise getting around regional limits by faking your country. If an account is flagged, the review can drag on for weeks, and nobody can promise it will not be blocked. A route where your country plays no role in reaching the model is the more practical choice.
Using an API key instead of a ChatGPT login
OpenAI's Codex documentation describes two ways to sign in. One is a ChatGPT plan. The other is an API key, where Codex usage is billed at API rates, by tokens, and the CLI, the SDK and the IDE extension all work. The same page says Codex cloud requires a ChatGPT sign-in, that some features tied to a ChatGPT workspace or to cloud services are limited or unavailable with a key, and that some plugins are missing because their connection flows need OAuth capabilities that are not supported. We read that as losing cloud features such as GitHub code review and the Slack integration. The agent in your terminal works as before. We read that page on 10 November 2026.
That opens a route that does not depend on the country of a ChatGPT account at all. You can take the key not from OpenAI but from a gateway that has already arranged payment and sells access to end users. Claudexia works this way: you create a key on claudexia.tech, pay with a card, SBP or crypto, and point Codex CLI at that key instead of one from platform.openai.com.
Claudexia is a separate service. It does not change OpenAI's terms or country lists, and we cannot say how OpenAI's rules apply to your situation.
Install Codex CLI
On macOS and Linux, OpenAI's installer is one line:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
With Node.js 16 or newer, the npm package works on macOS, Linux and Windows on x64 and arm64 processors. On any other system or architecture the launcher stops with an “Unsupported platform” error:
npm install -g @openai/codex
Copy install commands from OpenAI's documentation, never from an ad or from a command someone pasted into a chat.
Point Codex CLI at Claudexia
Codex keeps its settings in ~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml). To switch the provider to Claudexia, add:
model = "gpt-6-sol"
model_reasoning_effort = "medium"
model_provider = "claudexia"
[model_providers.claudexia]
name = "Claudexia"
base_url = "https://api.claudexia.tech/v1"
wire_api = "responses"
env_key = "CODEX_KEY"
Then put the key in the environment variable that env_key names:
export CODEX_KEY="sk_cdx_YOUR_KEY"
On Windows PowerShell, use $env:CODEX_KEY = "sk_cdx_YOUR_KEY" for the current session.
Two details trip people up. The base_url includes /v1, and wire_api = "responses" turns on the Responses API format. If you get a 404 or an odd reply, check both lines first. model_reasoning_effort sets how deeply the model reasons; "medium" is the cheaper setting, and removing the line saves money too.
After that, codex in a project folder behaves as it does with an OpenAI key, except that billing runs through Claudexia and your country is not checked at sign-up. The full walkthrough is in the Codex docs.
The catalog changes, so treat model names as a snapshot. At the time of writing Claudexia carries GPT-5.6, GPT-6 and GPT-6.1 models, including gpt-6-sol and gpt-6.1-sol. Check the exact ID on the models page and test it on your own repository before a production run. How the mid-tier models earn their price is covered in GPT-5.6 Sol and Terra.
If you want a ChatGPT subscription instead
Some searches for Codex are really about a ChatGPT Pro or Plus plan, not about the CLI. Paying for a plan from a restricted region fails for the same payment reasons described above. Plan details also move: OpenAI paused new sign-ups and upgrades to its $200 Pro plan from 10 September 2026 and, according to its release notes, brought new Pro 200 subscriptions back on 29 September 2026 at $200 a month. Plans keep changing, so check OpenAI's pricing page before planning around them. For plain terminal coding, the API-key route is usually shorter.
Codex or Claude Code
If you do not need OpenAI specifically and only want a terminal agent that works from your region, look at Claude Code too. It connects the same way, an API key and an address, but to Claude models. The setup under Claudexia is in Claude Code without an Anthropic account and in the Claude Code setup guide. For a wider comparison of coding agents, see Claude Code or Cursor in 2026.
FAQ
Does Codex work from restricted regions?
It depends on the country lists. OpenAI's API and ChatGPT lists leave out some countries, so direct sign-up and payment break there. The Codex CLI itself can run on a separate API key obtained from a gateway such as Claudexia instead of from OpenAI.
Do I need a VPN for Codex?
A VPN sometimes gets you through sign-up, but it does not fix card payment and it risks the session being flagged. An API key from a third-party provider takes your location out of the sign-up and payment steps, because you deal with the provider, not with OpenAI.
How is Codex different from ChatGPT when access is restricted?
ChatGPT is a chat product sold as a subscription. Codex is a coding agent that runs either on a plan or on a separate API key billed per token. The second option works whether or not a ChatGPT plan is available in your country.
Can I get a Claudexia key without a VPN and without a card tied to OpenAI?
Yes. Registration needs no OpenAI account and does not check the country of your card. Payment goes through YooKassa, Platega, SBP or crypto, and the key has no direct link to platform.openai.com.
Could OpenAI block my account if I used a VPN before?
We cannot promise either way, and a flat “they will not ban you” is not an answer worth trusting. To remove the risk entirely, move to API-key access that does not depend on a ChatGPT account.
What do I lose without a ChatGPT plan?
Codex cloud and features tied to a ChatGPT workspace, such as GitHub code review and the Slack integration, plus some plugins that need OAuth. Work in the terminal stays the same: reading and editing files, running tests and builds.