Error bodies
{
"type": "error",
"error": {
"type": "not_found_error",
"message": "unknown model 'turbo': use fast, normal or smart"
}
}{
"error": {
"message": "unknown model 'turbo': use fast, normal or smart",
"type": "not_found_error",
"code": "not_found_error"
}
}Status codes
| Status | Type | Example message | Cause | Retry |
|---|---|---|---|---|
| 400 | invalid_request_error | request body must be a JSON object | The body is not a JSON object | No |
| 400 | not_found_error | unknown model 'turbo': use fast, normal or smart | The model is not a tier or an alias | No |
| 401 | authentication_error | invalid or missing API key | No key, an unknown key or a revoked key | No |
| 403 | permission_error | client is suspended | The account is suspended | No |
| 403 | permission_error | blocked by the content filter 'Private keys' | On an Enterprise deployment, a content filter you added blocked the input. It was never forwarded | No |
| 429 | overloaded_error | all upstream slots are busy; retry shortly | The request waited 2 minutes in the router's queue | Yes, with backoff |
| 502, 503, 504 | api_error | upstream failed: and the last error | Every model the router tried failed | Yes, once or twice |
| Other | as returned | the model's own error | The model rejected the request itself, for example an invalid tool schema | No |
When the last attempt returned an error body of its own, you receive that body with its status.
Errors in streams
Failover happens before the first byte, so most failures surface as an ordinary error response. On an Enterprise deployment with a blocking content filter, a reply the filter blocks is cut and an error event is sent in your format. A connection to the model that breaks mid-stream ends the stream early, with an error event in the Anthropic format.
event: error
data: {"type": "error", "error": {"type": "permission_error", "message": "the reply was blocked by the content filter 'Customer data in replies'"}}data: {"error": {"message": "the reply was blocked by the content filter 'Customer data in replies'", "type": "permission_error"}}
data: [DONE]event: error
data: {"type": "error", "code": "permission_error", "message": "the reply was blocked by the content filter 'Customer data in replies'"}A regex filter holds back the last 512 characters of a streamed reply, so a match is cut before it reaches you.
Speed and the queue
Plans have no usage limits: no token caps, no message caps and no requests-per-minute cap. A plan sets one thing, the speed at which your account's answers stream back.
| Plan | Speed | Tiers |
|---|---|---|
| Solo | 20 tokens a second | All four |
| Team | 60 tokens a second | All four |
| Pro | 80 tokens a second | All four |
Requests sent at the same time share your plan's speed, and every one keeps streaming. When the models are at capacity, requests wait in the router's queue instead of failing; one still waiting after 2 minutes gets a 429 overloaded_error that you can retry.
Retrying
- Retry 429 and 5xx with exponential backoff and jitter, starting at about one second. RouterLane does not send
Retry-After. - Do not retry 400, 401 or 403: the same request will fail the same way.
- A 5xx means the router already tried up to three models. One or two retries are enough.
- The OpenAI and Anthropic SDKs retry 429 and 5xx twice by default. Raise
max_retriesfor long agent runs.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.routerlane.com/v1",
api_key=os.environ["ROUTERLANE_API_KEY"],
max_retries=5,
timeout=900,
)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.routerlane.com/v1",
apiKey: process.env.ROUTERLANE_API_KEY,
maxRetries: 5,
timeout: 900_000,
});Getting help
Every answered request carries x-router-request-id. Send it to support@routerlane.com and we can see the decision, the attempts and the timing for that request. For an error, send the time, the status and the message.