Codex in Russia: installation and use without a ChatGPT subscription
Codex CLI can be pointed at a gateway through a single config file. Installation, config.toml and a breakdown of the typical access and authorization errors.
5 min · · IDE · errors
Codex in Russia runs into access and payment rather than the tool itself: signing in with a ChatGPT account and paying for a subscription locally does not work for everyone. The way out is simple: Codex CLI can work with any OpenAI-compatible provider, so it can be pointed at a gateway. Access from Russia goes through the gateway, with payment via SBP, a MasterCard card or crypto. Below are the installation, the config and the most common errors.
What you need
- A terminal (macOS, Linux or Windows) and an installed Codex CLI.
- A
fetch_...key from the dashboard and a positive balance. - The file
~/.codex/config.toml.
A ChatGPT subscription is not needed for this scheme: you pay for tokens from the balance and choose the model yourself. What this approach is and what it costs is counted in a separate post; here is just the connection.
Step 1. Install Codex CLI
Install it following the README of the official repository github.com/openai/codex: the installation methods there get updated and we do not want to pin an outdated command here. After installing, check that the command is available:
codex --versionIf the terminal says "command not found", the problem is PATH, not the gateway: restart the terminal or add the install directory to PATH.
Step 2. Put the key in an environment variable
Put the key into an environment variable. The name is arbitrary, below it is ZUKKO_API_KEY:
export ZUKKO_API_KEY="fetch_your_key"To make the variable persistent, add the line to ~/.zshrc or ~/.bashrc. In PowerShell on Windows:
$env:ZUKKO_API_KEY = "fetch_your_key"This lasts until the window is closed; for a permanent value use the user environment variables in Windows settings. Do not commit the key to a repository and do not paste it into config.toml.
Step 3. config.toml
Create or open ~/.codex/config.toml:
model = "gpt-6.1-sol"
model_provider = "zukko"
[model_providers.zukko]
name = "Zukko"
base_url = "https://api.zukko.pro/v1"
env_key = "ZUKKO_API_KEY"
wire_api = "responses"What matters here:
model_providerpoints to the[model_providers.zukko]section; the section name is arbitrary but the two must match.base_urlwith/v1: Codex acts as an OpenAI client and does not add this suffix itself.env_keynames the environment variable from which Codex takes the key. The value itself is not written into the config.wire_api = "responses"switches on the Responses API; the gateway supportsPOST /v1/responses.
One subtlety from the Codex documentation: provider settings (model_provider, model_providers) are ignored when they sit in a project-level .codex/config.toml. Keep them in the user-level ~/.codex/config.toml.
The Codex integration docs show a second working option: the key is stored in ~/.codex/auth.json and the provider section has requires_openai_auth = true; ready-made installers for macOS and Windows are there too. Codex's own configuration key names can change over time, so if anything differs, check its configuration reference.
Step 4. First run
In the project directory run:
cd ~/projects/my-app
codexIf the interface asks you to sign in with ChatGPT, check that model_provider = "zukko" sits at the top level of the file (before the first bracketed section) and that you are editing exactly ~/.codex/config.toml. For a one-off task without interaction Codex has a codex exec mode; see codex --help for the options.
Which model to set: the example uses gpt-6.1-sol (strength index 52, 1M context, image input). To save on routine work you can take gpt-6-sol, and for the hardest tasks claude-opus-5-5. But note that Codex speaks the OpenAI format, and for Claude it counts all input at the input price without a cache discount. According to the Zukko docs, GLM models do not work in Codex.
Typical errors
| Symptom | Cause | What to do |
|---|---|---|
| 401 | The key did not reach Codex: the variable is not exported in this terminal window or the name in env_key does not match | Run echo $ZUKKO_API_KEY, check the name |
| 404 | base_url has no /v1 or the address has a typo | The address must be exactly https://api.zukko.pro/v1 |
404, model_not_found | Unknown model name | Check against GET /v1/models |
| 402 | Not enough balance | Top up in the dashboard |
403, model_not_allowed_for_key | The model is not allowed for this key | Add the model to the key's allowed_models |
| 429 | The key's daily or monthly limit is exhausted, or the model provider's own limit | Raise the key limit or retry later |
| 503 | The provider is unavailable or the model is disabled (model_disabled) | Choose another model from GET /v1/models |
You can get the model list like this:
curl https://api.zukko.pro/v1/models -H "Authorization: Bearer fetch_your_key"If the key is alive but Codex still does not work, test the request bypassing it with a plain curl to /v1/chat/completions. This separates key and balance problems from Codex configuration problems.
Paying from Russia
The balance is in dollars, top-up from $1:
- SBP: in rubles at the market rate, the payment page adds 8.5% on top;
- cryptocurrency (USDT and others);
- MasterCard cards: a fee of about 13%, amounts $2-$594.
SBP is covered step by step in the post on paying via SBP. How Codex treats the AGENTS.md file is in the post on AGENTS.md, and a general comparison of approaches is in the post Codex without a ChatGPT subscription.
FAQ
Can I use Codex in Russia without a ChatGPT subscription?
Yes, if you point Codex CLI at an OpenAI-compatible gateway through config.toml. The subscription is not used in this scheme, spending comes from the balance per token.
Do I need extra network settings?
The gateway is available at the ordinary address https://api.zukko.pro. If a request does not go through, look at the error code in the table above: most often it is the key, the address or the balance.
Where do I put the key: config.toml or a variable?
In an environment variable, and in the config give only its name through env_key. That way the key does not end up in a repository or in config backups.
Which model should I choose?
Start with gpt-6.1-sol, check the spending on the "Usage" page of the dashboard and, if needed, change the model with one line in the config. Check quality on your own tasks.
zukko
Pay 25×
less
for Claude Code & ChatGPT
One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.
Related articles
- JetBrains AI Assistant not working: causes and workaroundsAI Assistant will not activate, stays silent or is off for some files. We go through the causes in the JetBrains docs and connect your own models via a gateway.
- Invalid API key in opencode: why the key is rejected and how to checkThe Invalid API key error in opencode almost always comes down to four causes. We test the key outside opencode and find where the chain breaks.
- Codex error 403: causes and how to keep workingA 403 in Codex comes in three kinds: a region refusal, an account problem and gateway key restrictions. How to tell them apart by the error text and what to fix.
- Cursor not working: common problems and how to fix themCursor froze, shows Reconnecting or does not answer. We go from simple causes to complex ones and cover problems with your own key and a gateway separately.