Set up Codex CLI with an OpenAI-compatible API Base URL. Use RutaAPI's endpoint, API key, and enabled model ID to get started.
Quick answer: To use RutaAPI with Codex CLI, create a RutaAPI key, set the provider Base URL to https://api.rutaapi.com/v1, choose an enabled model ID, and verify available models with /v1/models.
Need the full setup guide?
Read the complete Codex CLI custom API Base URL guide for a step-by-step walkthrough with troubleshooting.
Start with RutaAPI
Create an API key — includes $1 trial credit, then test /v1/models before sending a larger Codex CLI request.
Create API key View model pricing/v1/models.YOUR_ENABLED_MODEL_ID.npm install -g @openai/codex or via the Codex app)Open your Codex configuration file. This is typically located at ~/.codex/config.toml.
model_provider = "rutaapi"
model = "YOUR_ENABLED_MODEL_ID"
model_reasoning_effort = "high"
[model_providers.rutaapi]
name = "RutaAPI"
base_url = "https://api.rutaapi.com/v1"
wire_api = "responses"
requires_openai_auth = true
Note: If your selected model or Codex version expects Chat Completions instead of Responses, check the current Codex documentation and your RutaAPI model compatibility. Model availability depends on your account settings and upstream model compatibility.
Create or update ~/.codex/auth.json with your RutaAPI API key. This file stores your authentication credentials.
{
"OPENAI_API_KEY": "YOUR_RUTAAPI_KEY"
}
Security: Do not paste your real API key into public screenshots, GitHub issues, logs or chat messages. Rotate the key immediately if it is exposed.
Before starting Codex, verify that your API key works and check which models are available.
curl https://api.rutaapi.com/v1/models \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY"
Look for the model name you specified in config.toml in the returned list. If the model is not listed, it may not be enabled on your account.
Once both files are configured, start Codex CLI:
codex
Codex will use your rutaapi provider configuration and route requests through your RutaAPI API key.
401 Unauthorized
Invalid API key. Verify the key in auth.json matches your RutaAPI key.
403 Forbidden
No credits or no model permission. Check your account balance.
404 Not Found
Model not available. Verify the model name in /v1/models response.
Responses API not supported
Check wire_api setting. Try "chat_completions" if Responses is not supported by your model.
Config file not found
Ensure config.toml and auth.json are in the correct path (typically ~/.codex/).
Key exposed in screenshot
Rotate your key immediately in the RutaAPI dashboard and update auth.json.
Important: Do not write OpenAI official authorization for RutaAPI. Model availability depends on your account settings and upstream routes — not all models are always available.