Codex
Codex is OpenAI’s terminal coding agent. It supports custom model providers, so you can point it at ru-llm’s OpenAI-compatible surface.
Configure
Add a provider block to ~/.codex/config.toml pointing base_url at the gateway’s /v1 path:
model = "gpt-5.5"model_provider = "ru-llm"
[model_providers.ru-llm]name = "ru-llm"base_url = "https://api.ru-llm.relay2.xyz/v1"wire_api = "chat"env_key = "RU_LLM_API_KEY"Then export your key under the name you set in env_key:
export RU_LLM_API_KEY="sk-ru-YOUR_KEY"
codexSelect a model
Set model in config.toml (or pass --model on the CLI) to any chat model ID from the
catalog — for example gpt-5.5, gpt-5.4, claude-opus-4-8, or
gemini-3.1-pro-preview. Thanks to cross-dialect routing, Codex can drive Claude and Gemini models
through the same OpenAI-style provider:
model = "claude-opus-4-8"Verify
Check the OpenAI surface responds before launching Codex:
curl https://api.ru-llm.relay2.xyz/v1/chat/completions \ -H "Authorization: Bearer sk-ru-YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "messages": [{"role": "user", "content": "Reply with the single word: ok"}] }'A 200 with a choices[0].message.content of ok confirms the provider is reachable.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
404 / “unknown endpoint” | wire_api defaulted to responses | Set wire_api = "chat" in the provider block. |
401 Unauthorized | Key env var not set | Export the variable named in env_key (e.g. RU_LLM_API_KEY). |
402 Payment Required | Zero balance | Top up in the console → Billing. |
400 unknown model | Model ID not in catalog | Set model to a listed ID (GET /v1/models). |