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.

OpenAI-Compatible API Quickstart

Create an API key, set the base URL to https://api.rutaapi.com/v1, and make your first request.

Quickstart guide
💻

Use RutaAPI with Codex CLI

Configure ~/.codex/config.toml and auth.json to route Codex requests through RutaAPI.

Codex CLI setup
💬

Use RutaAPI with Claude Code

Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN to use RutaAPI-compatible routing.

Claude Code setup
⚠️

Troubleshooting API errors

Understand 401, 403, 404, 429 and upstream errors and how to resolve them.

Error reference

Start in 5 minutes

  1. Create a RutaAPI account.
  2. Add prepaid credits.
  3. Check your balance update in the dashboard.
  4. Create an API key in the dashboard.
  5. Check available models with /v1/models.
  6. Use one returned model ID as YOUR_ENABLED_MODEL_ID.
  7. Send your first chat/completions request.

Quickstart

Step 1: Create an account

Sign up for a free RutaAPI account at app.rutaapi.com. No credit card is required to sign up.

Step 2: Add prepaid credits

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.

Step 3: Check your balance

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.

Step 4: Create an API key

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.

Step 5: Check available models

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.

Verify your API key

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.

Send your first chat request

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.

Python example

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)

OpenAI SDK with custom base URL

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)

Troubleshooting

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.

Why does /v1/models show "Invalid token" in my browser?

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.

Balance not updated after payment

Stripe payments usually process within a few seconds. If your balance still shows $0.00 after 5 minutes:

  1. Refresh the dashboard page.
  2. Log out and log back in to trigger a balance sync.
  3. Check the payment confirmation email from Stripe for a transaction ID.
  4. If the issue persists after 10 minutes, contact support with your payment reference.

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.

Create API key → Register →
Ready to test RutaAPI? Use one OpenAI-compatible base URL, prepaid credits, and API keys from the dashboard.