Set up RutaAPI with OpenAI-compatible clients, Codex CLI, Claude Code and developer tools.
RutaAPI provides an OpenAI-compatible API endpoint at https://api.rutaapi.com/v1. Create an API key, configure your client base URL, and test available models before using RutaAPI in production.
Quick answer: RutaAPI provides an OpenAI-compatible API endpoint at https://api.rutaapi.com/v1. Create an API key, configure your client base URL, and make your first request.
Create an API key, set the base URL to https://api.rutaapi.com/v1, and make your first request.
Configure ~/.codex/config.toml and auth.json to route Codex requests through RutaAPI.
Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN to use RutaAPI-compatible routing.
Understand 401, 403, 404, 429 and upstream errors and how to resolve them.
Error reference/v1/models.YOUR_ENABLED_MODEL_ID.Sign up for a free RutaAPI account at app.rutaapi.com. No credit card is required to sign up.
After logging in, go to the billing section and purchase a credit pack. Credits are added to your account immediately after payment. See /pricing for available packs.
Most Stripe top-ups appear within about 1 minute. If your balance is not updated after 5 minutes, check the payment status or contact support.
After purchasing credits, view your current balance in the dashboard. If your balance shows as $0.00 or is missing after a confirmed payment, refresh the page — it may take up to 1 minute to sync. Navigate to the Channel or Balance section in the app to see your remaining credits.
Balance and usage are tracked in USD internally. All displayed amounts (credits, top-up, usage logs) are converted at the configured exchange rate.
Use the dashboard logs / usage area to review requests, token usage, and remaining balance.
In the dashboard, go to Token / API Keys and click Create Key. Give it a descriptive name (e.g., dev-key). Copy the key — it will only be shown once.
Base URL: All API requests go to https://api.rutaapi.com/v1
Security: Never share screenshots that reveal your full API key. Rotate the key immediately if it is exposed. Do not commit API keys to version control or share them in logs, chat messages or GitHub issues.
curl https://api.rutaapi.com/v1/models \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY"
Use one of the model IDs returned by /v1/models as YOUR_ENABLED_MODEL_ID in the steps below.
curl https://api.rutaapi.com/v1/models \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY"
If the response returns a model list, your API key and Base URL are working.
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": "Hello from RutaAPI"}
]
}'
Use a model ID enabled in your RutaAPI app pricing/dashboard.
import openai
openai.api_key = "YOUR_RUTAAPI_KEY"
openai.base_url = "https://api.rutaapi.com/v1/"
chat = openai.chat.completions.create(
model="YOUR_ENABLED_MODEL_ID",
messages=[{"role": "user", "content": "Hello!"}]
)
print(chat.choices[0].message.content)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_RUTAAPI_KEY",
base_url="https://api.rutaapi.com/v1/"
)
response = client.chat.completions.create(
model="YOUR_ENABLED_MODEL_ID",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
401 Unauthorized
Invalid or missing API key. Check that your Authorization header uses Bearer YOUR_RUTAAPI_KEY.
403 Forbidden
No credits, no permission, or the selected model is not enabled for your account.
404 Not Found
Model name not available or the endpoint does not exist. Verify the model name with /v1/models.
429 Rate Limited
Too many requests. Default limit is 180 requests per minute per IP. Wait and retry.
5xx Upstream Error
Upstream provider error or temporary gateway issue. Review the Cloudflare 503 troubleshooting guide and retry.
This is normal. The API requires a valid Bearer token in the Authorization header. Opening the URL directly in a browser sends no authorization header, so the API returns an authentication error. Use a tool like curl, Postman, or an SDK to make authenticated requests.
Stripe payments usually process within a few seconds. If your balance still shows $0.00 after 5 minutes:
Tip: After adding credits, verify your balance in the Channel or Balance section of the dashboard. The balance shown on the homepage may lag by a few seconds.