Got an error instead of a model response? Find your code below — most of these are a two-step fix. The exact error text and request ID are always in Console → Logs.
Cheat sheet
| Code | Meaning | Quick fix |
|---|
| 401 | Key rejected (Invalid API key) | Use your RuAPI token sk-..., strip stray spaces |
| 402 | Out of balance (Insufficient balance) | Top up in USDT |
| 404 | Model not found (model not found) | Check the model id and base_url (Anthropic — no /v1) |
| 429 | Too many requests (rate limit) | Slow down, retry with exponential backoff |
| 5xx | Provider/gateway hiccup | Retry; if it persists, contact us |
401 Unauthorized — Invalid API key
Cause. The server didn’t accept your key. Usually one of three things:
- You’re using the wrong key: it must be a RuAPI token (
sk-...), not an official OpenAI key (sk-...) or Anthropic key (sk-ant-...). An OpenAI and a RuAPI key look alike, but only the one from your RuAPI Console works here.
- A stray space or newline snuck into the key during copy-paste — a very common one.
- The key is disabled or deleted.
Fix.
- Open Console → Tokens and confirm the key is active. Copy it again if in doubt.
- Paste the key with no leading/trailing spaces and no line break.
- Make sure the header is
Authorization: Bearer sk-... (OpenAI protocol) or x-api-key: sk-... (Anthropic protocol).
402 — Insufficient balance
Cause. Your account ran out of funds. Requests won’t run until the balance is positive again.
Fix.
- Top up in USDT — minimum 10 USDT, usually credited within 1–5 minutes.
- Note: agentic tools (Claude Code, Cline, autonomous agents) and long context burn tokens fast — dozens of requests a minute is normal.
- To avoid draining your whole balance on one project, set a per-token spend limit in Console → Tokens — that key stops at the cap while your others keep working.
404 — model not found
Two very different causes produce the same 404. Check both.
Cause 1 — typo in the model id. The model field must exactly match an id from the pricing page on the main site (hyphens and case included). Aliases or “close enough” names won’t work.
Cause 2 — wrong base_url. This is the most common hidden cause of a 404, and it depends on the protocol:
| Protocol | Correct base_url |
|---|
| OpenAI-compatible | https://www.ruapi.ai/v1 ← must include /v1 |
| Anthropic | https://www.ruapi.ai ← no /v1 |
For the Anthropic protocol, do not add /v1 to the end of the URL. The SDK appends /v1/messages itself, so an extra /v1 becomes /v1/v1/messages → 404. The reverse is also true: for the OpenAI protocol /v1 is required.
Fix. Verify the model id against the pricing page, then check your base_url using the table above. Full URL breakdown in the API reference.
429 — Too Many Requests / rate limit
Cause. Too many requests in a short window — either your code is firing them in a burst, or the upstream provider is throttling temporarily.
Fix.
- Slow down and retry with exponential backoff: 1s, 2s, 4s, 8s…
- Spread the load over time; don’t send hundreds of requests at once.
- For batch jobs, add a small pause between requests or cap the number of parallel workers.
5xx — 500 / 502 / 503 / upstream error
Cause. A temporary failure on the upstream provider or gateway. It’s not your key or your code.
Fix.
- Retry after a few seconds — it usually goes through on the second or third attempt.
- Wrap your calls in retry-with-backoff so these blips don’t crash your script.
- If the error sticks around and shows up across different models, email [email protected] with the request ID from Console → Logs.
Streaming cutoffs and timeouts
Long answers (large context, reasoning models, code generation) can take tens of seconds. If the connection drops mid-stream or the client times out — raise the timeout in your SDK (60–120s or more for heavy requests), make sure no proxy between you and RuAPI is killing long SSE connections, and don’t disable streaming for long responses — streaming is exactly what keeps the request from timing out.
Still stuck?
Open Console → Logs and find your request — it shows the exact error code, model, and response body. With that in hand, email [email protected] and we’ll sort it out fast.
If you’re just getting set up, the Quickstart walks through the key and base_url step by step — most first-request errors come from one of those.