~/.codex/config.toml. You don’t need a ChatGPT account or an OpenAI sign-in.
Updated: Nov 25, 2026
For a short explanation of why Codex is easier to run in Russia through RuAPI than through a ChatGPT account, and how to pay without a foreign card, see www.ruapi.ai/codex-v-rossii; the setup steps are below.
gpt-5.4, gpt-5.5) but also with other vendors’ models: Claude, DeepSeek, Gemini, Kimi, GLM, Qwen, MiniMax and Grok. Codex sends Responses API requests, and RuAPI converts them into the format each model understands. We tested every family with Codex-format requests (a tool call, the follow-up step with the tool result, streaming and non-streaming) — for example claude-sonnet-5-5, deepseek-flash, gemini-3.8-flash, kimi-k3.1-pro, glm-5.3, qwen3.8-max, MiniMax-M3.1-Flash, grok-4.7. The /model menu lists all of these models your key can use, GPT models first.Quickest: one command
Open the connect window
Copy the command
Paste it into a terminal
Wait for Codex to open
config.toml, adds the RuAPI settings to it without touching the rest, checks the connection and opens Codex. Next time, start it with codex (on Windows, if PowerShell scripts are blocked — the default — codex.cmd; the script shows the right command at the end).
Console → API Keys: the “Connect Claude Code, Cline & more” button
[!] saying what to do. If your config.toml has an unusual layout, the script leaves it alone and shows what to add by hand (see below).
Manual setup
Prerequisites
RuAPI account + API key
Node.js with npm
Install Codex CLI
npm install -g @openai/codex@latest or brew upgrade codex.
The config.toml file
Open~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml; if you set the CODEX_HOME variable, the config.toml in that folder). If the file doesn’t exist, create it and paste all of this, replacing sk-your-key with your key:
- the first two lines (
modelandmodel_provider) must be at the very top of the file, before the first[ … ]header; if those lines are already there, replace them; - add the
[model_providers.ruapi]block at the end of the file; if the file already has that block, replace it entirely — Codex won’t start with two blocks of the same name.
codex again.
model_catalog_url line gives you a /model menu whose list refreshes by itself. Codex 0.156–0.160 already knows this line but doesn’t load the list by itself, so the menu stays empty. Update Codex or remove the line. Very old versions simply ignore it.First call
Switch models
Inside a session, type/model to open a menu with the models your key can use: GPT first, then Claude, DeepSeek, Gemini, Kimi, GLM, Qwen, MiniMax and Grok. Codex loads the list from RuAPI at startup, and it updates by itself when we add new models. On the trial balance the models are marked ”✓ Available on the trial” or ”🔒 Unlocks after you top up”.
You can also change model = "..." at the top of config.toml by hand. Any model from the /model menu or the pricing page works.
Budget option. Our cheapest GPT model is gpt-6-luna: it costs many times less than gpt-5.4. At the top of config.toml (before the first section in square brackets), change the model = "..." line to model = "gpt-6-luna". For a really hard task, switch to gpt-5.4 with /model, and switch back to gpt-6-luna afterwards: the model picked in /model may stay for the next launches too.
Troubleshooting
Errors shown by Codex itself have their own pages: Token exchange failed when signing in with ChatGPT, stream disconnected before completion and Selected model is at capacity.Codex still shows the old version after updating
Codex still shows the old version after updating
- macOS / Linux
- Windows (PowerShell)
Model not found (503) or 404
Model not found (503) or 404
- Typo in the ID. Pick the model in the
/modelmenu or copy the exact name from the pricing page. base_urlmust end with/v1.
Error: wire_api = 'chat' is no longer supported
Error: wire_api = 'chat' is no longer supported
config.toml, replace wire_api = "chat" with wire_api = "responses".I set up Codex with the old version of this page (env_key)
I set up Codex with the old version of this page (env_key)
env_key = "RUAPI_API_KEY" and an environment variable keeps working, but its /model menu doesn’t refresh by itself. To make the list refresh by itself, replace the whole [model_providers.ruapi] block with the one above.What doesn't work with every model
What doesn't work with every model
- Codex’s built-in web search works only with GPT models. With other models that tool isn’t passed to the model; your regular tools (commands, file edits, MCP) work with all of them.
- DeepSeek in Codex accepts text only — it can’t see images in the request.
- Continuing a previous response via
previous_response_idisn’t supported for any model — Codex doesn’t use it anyway (see errors).
Tool calling / function calling errors
Tool calling / function calling errors
Keep both the official account and RuAPI
Keep both the official account and RuAPI
model_provider at the top of config.toml.