~/.codex/config.toml. You don’t need a ChatGPT account or an OpenAI sign-in.
Updated: Nov 5, 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.
Codex works not only with GPT models (for example
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
1
Open the connect window
Sign up at www.ruapi.ai (you don’t have to top up for a first test), open Console → API Keys, click Connect Claude Code, Cline & more and pick Codex.
2
Copy the command
Click Copy command. Your key and the RuAPI address are filled in automatically. The command works once and expires after 30 minutes; if it runs out, click New command. If the window shows ready-made settings instead, first choose Method → One command (recommended) at the top of the window.
3
Paste it into a terminal
macOS: ⌘ + Space → “Terminal”. Linux: Ctrl + Alt + T. Windows: Win + X → “Terminal” or “Windows PowerShell” (not “Command Prompt”). Paste the command and press Enter — the script does the rest by itself.
4
Wait for Codex to open
Usually 1–5 minutes. If Codex isn’t installed yet, the script installs it via npm (plus Node.js if it is missing, into a separate folder, no admin rights), backs up
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
1
RuAPI account + API key
Console → API Keys → Create API key. See API keys & security.
2
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.
The
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
Codex still shows the old version after updating
Codex still shows the old version after updating
If Codex was installed by the command from the Console, it lives in a separate folder, and the update button inside Codex installs the new version elsewhere. Update like this:
- 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
Your config is outdated. In
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)
The old setup with
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
For GPT models RuAPI forwards tool calls unchanged; for other models it converts them into the format the model understands. If Codex complains, send support the error text and the request time from Console → Usage Logs.
Keep both the official account and RuAPI
Keep both the official account and RuAPI
The easiest way to switch is CC Switch. By hand, change
model_provider at the top of config.toml.