Skip to main content
Codex CLI is OpenAI’s official command-line coding assistant, its answer to Claude Code. It talks to the model through the OpenAI Responses API, so routing it through RuAPI only takes a provider entry in ~/.codex/config.toml.
Codex works with GPT models: gpt-5.4, gpt-5.5, the gpt-5.6 series, gpt-6-astra. Codex only sends Responses API requests, and on RuAPI that API is available for GPT models. For Claude use Claude Code; for DeepSeek, Claude Code on DeepSeek.

Prerequisites

1

RuAPI account + API key

Console → API Keys → Create API key. See API keys & security.
2

Node.js with npm

Install from nodejs.org if needed.

Install Codex CLI

Confirm:

Configure RuAPI

Edit ~/.codex/config.toml (or %USERPROFILE%\.codex\config.toml on Windows). Create it if missing:
Then set the key as an environment variable (or save it in ~/.zshrc / ~/.bashrc):
base_url must end in /v1 — unlike the Anthropic setup. And wire_api must be "responses": the "chat" option was removed from Codex in February 2026, and Codex won’t start with it.

First call

In the interactive prompt:
A normal reply + an entry in RuAPI Console → Usage Logs = success.

Switch models

Inside a session:
Or change model = "..." at the top of config.toml. Any GPT model from the pricing page works.

Troubleshooting

  • RUAPI_API_KEY must be a RuAPI key (sk-...), not an official OpenAI sk-proj-... key.
  • The variable must be set in the terminal where you run codex (after adding the export to ~/.zshrc, open a new terminal).
  • In Console → API Keys, check that the key is enabled and the model is in the key’s Allowed models (if that list is set).
  • A typo in the model ID. GPT model names on RuAPI match the official ones — copy exact names from the pricing page.
  • base_url must end in /v1.
Your config is from an older Codex. In config.toml, change wire_api = "chat" to wire_api = "responses".
That’s expected: Codex only works through the Responses API, which on RuAPI is available for GPT models. For Claude and DeepSeek, use Claude Code — every model works there.
RuAPI forwards tool calls unchanged. If Codex complains, try the same prompt directly against OpenAI to rule out a prompt-side issue.
The easiest way to switch is CC Switch. By hand, change model_provider at the top of config.toml.

Advanced: alongside Claude Code

Many people run Codex (for tasks where GPT models shine) and Claude Code (for long context and code analysis) side by side. They don’t conflict: set each up per the Claude Code page and this one — the same RuAPI key works for both.