Docs · Reference

Errors and retries

Errors come back in the format you called, with a status code, a type and a plain message. Most are final; 429s and 5xx are worth a retry.

Error bodies

/v1/messages
{
  "type": "error",
  "error": {
    "type": "not_found_error",
    "message": "unknown model 'turbo': use fast, normal or smart"
  }
}

Status codes

StatusTypeExample messageCauseRetry
400invalid_request_errorrequest body must be a JSON objectThe body is not a JSON objectNo
400not_found_errorunknown model 'turbo': use fast, normal or smartThe model is not a tier or an aliasNo
401authentication_errorinvalid or missing API keyNo key, an unknown key or a revoked keyNo
403permission_errorclient is suspendedThe account is suspendedNo
403permission_errorblocked by the content filter 'Private keys'On an Enterprise deployment, a content filter you added blocked the input. It was never forwardedNo
429overloaded_errorall upstream slots are busy; retry shortlyThe request waited 2 minutes in the router's queueYes, with backoff
502, 503, 504api_errorupstream failed: and the last errorEvery model the router tried failedYes, once or twice
Otheras returnedthe model's own errorThe model rejected the request itself, for example an invalid tool schemaNo

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 stream
event: error
data: {"type": "error", "error": {"type": "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.

PlanSpeedTiers
Solo20 tokens a secondAll four
Team60 tokens a secondAll four
Pro80 tokens a secondAll 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_retries for long agent runs.
retries.py
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,
)

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.