Codex CLI is OpenAI’s official command-line coding assistant, analogous to Claude Code. It speaks the OpenAI-compatible protocol, soDocumentation Index
Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt
Use this file to discover all available pages before exploring further.
OPENAI_BASE_URL + OPENAI_API_KEY are all you need to route it through RuAPI.
Prerequisites
RuAPI account + API key
Console → Tokens → Create token. See API keys & security.
Node.js ≥ 18
Install Codex CLI
Configure RuAPI
Codex supports two ways to configure the endpoint: env vars or~/.codex/config.toml. The TOML file is the longer-lived path.
Method 1: config.toml (recommended)
Edit ~/.codex/config.toml (or %USERPROFILE%\.codex\config.toml on Windows). Create it if missing:
~/.zshrc / ~/.bashrc):
- macOS / Linux
- Windows (PowerShell)
wire_api = "chat" means classic /v1/chat/completions — the most reliable choice. You can try "responses" for the newer Responses API, but not every model on RuAPI supports it yet.Method 2: env vars only
If you’d rather skip the config file:- macOS / Linux
- Windows (PowerShell)
First call
Switching models
Inside a session:model = "..." at the top of config.toml. See the model gallery for the full list.
Troubleshooting
401 Unauthorized
401 Unauthorized
404 / model not found
404 / model not found
- Typo. Model IDs on RuAPI match OpenAI’s official names:
gpt-5,gpt-5-mini,o4-mini,gpt-4.1, etc. OPENAI_BASE_URLmust end in/v1.
'unsupported wire_api' error
'unsupported wire_api' error
Set
wire_api = "chat" in config.toml. The "responses" protocol is only supported by some newer models.Tool calling / function calling errors
Tool calling / function calling errors
RuAPI passes tool / function calls through unchanged. If Codex still errors, try the same prompt against OpenAI’s official endpoint first to rule out a prompt issue.
Keeping both the official account and RuAPI
Keeping both the official account and RuAPI
Define two providers in
config.toml and use /provider <name> to switch inside a session, or install CC Switch.