For an OpenAI-compatible provider, use https://api.rutaapi.com/v1 as the Base URL, a RutaAPI API key created from the dashboard, and a model enabled in the app pricing page. Verify everything works with GET /v1/models before running Codex CLI tasks.
Codex CLI setup table
| Field | What to use with Codex CLI |
|---|---|
| Base URL | https://api.rutaapi.com/v1 |
| API Key | Your RutaAPI API key |
| Model | A model enabled in the RutaAPI app pricing/dashboard |
| Test endpoint | /v1/models |
What Codex CLI needs
When you configure Codex CLI with a custom OpenAI-compatible API provider, Codex CLI needs three things:
- Base URL — The root address of the API gateway. The correct value is
https://api.rutaapi.com/v1. Always include/v1. - API key — A secret token that identifies your RutaAPI account. Create one from the dashboard.
- Model — The identifier of the model that handles your requests. Must be enabled in your RutaAPI account.
Depending on your Codex CLI version, the exact config field or environment variable name may vary. Verify the current Codex CLI documentation for your installed version before configuring a custom provider.
Codex CLI version caveat Codex CLI UI labels and config behaviour can change by version. Depending on your Codex CLI version, the exact config field name or environment variable may differ. Users should verify the current Codex CLI config format in their installed version before setting up a custom provider.
RutaAPI values for Codex CLI
Base URL: https://api.rutaapi.com/v1
API key: Create one from the RutaAPI dashboard at app.rutaapi.com. Keys are shown only once at creation — copy and store them securely.
Model: Choose a model enabled in the RutaAPI app pricing page. Run GET /v1/models to see which models are available in your account.
Environment variable example
Depending on your Codex CLI version and configuration method, you may use environment variables or a config file. The example below shows the pattern:
Note: Variable names may differ by Codex CLI version. Check your installed version's documentation for the correct field names.
export OPENAI_API_KEY="YOUR_RUTAAPI_KEY"
export OPENAI_BASE_URL="https://api.rutaapi.com/v1"
If your Codex CLI version uses a different variable name, map the same values to the custom OpenAI-compatible Base URL and API key fields.
Test your key before using Codex CLI
Before running any Codex CLI tasks, verify that your API key and Base URL work together:
curl https://api.rutaapi.com/v1/models \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY"
If the response returns a model list, your Base URL and API key are working. Use one of the returned model IDs in your Codex CLI configuration.
First request example
Once your key is verified, send a chat completions request to confirm end-to-end connectivity:
curl https://api.rutaapi.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_ENABLED_MODEL_ID",
"messages": [
{"role": "user", "content": "Say hello from RutaAPI"}
]
}'
Replace YOUR_ENABLED_MODEL_ID with one of the model IDs from the /v1/models response. Do not hardcode a model name you have not verified.
How to pick a model
Model IDs are returned by the GET /v1/models endpoint. Copy one of the model id values from the response and use it in your Codex CLI config.
Model availability is per-account. If a model ID is not in your /v1/models response, it is not active in your account — add credits or check the app pricing page for enabled models.
Common Codex CLI setup mistakes
| Problem | Likely cause | Fix |
|---|---|---|
| 401 / invalid API key | Wrong key, missing Bearer, expired or disabled key | Create a new key in RutaAPI and test /v1/models |
| Wrong Base URL | Used dashboard URL or homepage URL instead of API endpoint | Use https://api.rutaapi.com/v1 |
| 404 / endpoint not found | Missing /v1 in the Base URL | Always include /v1: https://api.rutaapi.com/v1 |
| Model not found | Model ID is not enabled or typed incorrectly | Check app pricing page for enabled model IDs |
| 429 rate limit | Too many concurrent requests or limited route | Slow down requests or choose another enabled route |
| 503 upstream unavailable | Upstream route, gateway, or provider temporarily unavailable | Retry, switch model route, or check dashboard for status |
| Environment variable not loaded | Shell session not restarted after export | Restart the terminal or re-export the variables |
| Shell session not restarted | Config changes not picked up by Codex CLI | Restart Codex CLI or reload the config |
Cost and usage tracking
RutaAPI uses prepaid credits. Check the app pricing page for model rates and enabled routes. After test calls, check the usage logs and remaining balance in the dashboard.
FAQ
What Base URL should I use with Codex CLI?
For an OpenAI-compatible provider, use https://api.rutaapi.com/v1 as the Base URL. Always include /v1.
Which API key should I use?
Use a RutaAPI API key created from the dashboard at app.rutaapi.com. Keys are shown only once at creation.
What model should I use?
Use a model enabled in the RutaAPI app pricing page. Run GET /v1/models to see available model IDs. Do not guess — copy the exact ID from the response.
How do I test the key before using Codex CLI?
Call GET /v1/models with your Authorization Bearer header. A 200 response with a model list means the key and Base URL are working.
Why does Codex CLI say model not found?
The model ID may be unavailable, disabled, or typed incorrectly. Check your enabled models in the app pricing page and verify with /v1/models.
Why does Codex CLI return 401?
HTTP 401 means the API key is missing, incorrect, or sent to the wrong Base URL. Verify the key and Base URL both come from RutaAPI. Run /v1/models to confirm the key is valid.
Why does Codex CLI return 503?
HTTP 503 means the upstream route is temporarily unavailable. Retry, switch model route, or check the RutaAPI dashboard for status.
Is RutaAPI an official Codex CLI provider?
No. RutaAPI is an OpenAI-compatible API gateway that can be configured through custom or compatible provider settings. It is not an official Codex CLI, OpenAI, Anthropic, Google or Microsoft service.
Configure Codex CLI with a custom OpenAI-compatible Base URL using RutaAPI's endpoint at https://api.rutaapi.com/v1, a RutaAPI API key from the dashboard, and a model enabled in the app pricing page. Test the key with GET /v1/models before running Codex CLI tasks. RutaAPI is an OpenAI-compatible API gateway — it is not an official Codex CLI, OpenAI, Anthropic, Google or Microsoft service.