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:

bash
codex --version

If 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:

bash
export ZUKKO_API_KEY="fetch_your_key"

To make the variable persistent, add the line to ~/.zshrc or ~/.bashrc. In PowerShell on Windows:

bash
$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:

bash
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_provider points to the [model_providers.zukko] section; the section name is arbitrary but the two must match.
  • base_url with /v1: Codex acts as an OpenAI client and does not add this suffix itself.
  • env_key names 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 supports POST /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:

bash
cd ~/projects/my-app
codex

If 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

SymptomCauseWhat to do
401The key did not reach Codex: the variable is not exported in this terminal window or the name in env_key does not matchRun echo $ZUKKO_API_KEY, check the name
404base_url has no /v1 or the address has a typoThe address must be exactly https://api.zukko.pro/v1
404, model_not_foundUnknown model nameCheck against GET /v1/models
402Not enough balanceTop up in the dashboard
403, model_not_allowed_for_keyThe model is not allowed for this keyAdd the model to the key's allowed_models
429The key's daily or monthly limit is exhausted, or the model provider's own limitRaise the key limit or retry later
503The 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:

bash
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.

Get API keyDocumentation

api.zukko.pro · fetch_*

Codex in Russia: install and config.toml setup · Zukko