Errors
API errors return JSON with a consistent error object.
json
{
"error": {
"message": "Invalid request body",
"type": "invalid_request_error",
"code": "Bad Request"
}
}Some errors also include an error_id for support and log correlation.
Use the Error Resolver when you need to classify a raw status/body pair. Admins can use Error Templates in the rout.my admin panel to map recurring upstream provider messages into safe user-facing messages.
Status codes
| Status | Meaning | Common fix |
|---|---|---|
400 | Invalid request body, missing field, unsupported parameter, or policy-blocked prompt. | Validate JSON and required fields. |
401 | Missing or invalid API key. | Check the Authorization header or compatible auth field. |
403 | The key is valid, but the model is not available to the account. | Use an available model ID or update plan/access. |
404 | Wrong path or unknown model. | Check endpoint URL and copy the model ID from /v1/models. |
405 | Method not allowed. | Use the documented HTTP method. |
429 | Rate limit or quota exhausted. | Wait, reduce request size, or check quota. |
499 | Client disconnected before the server finished. | Keep the connection open; use longer client timeouts for long video requests. |
500 | Internal server error. | Retry later or contact support with request details. |
502 | Upstream provider failed or no provider succeeded. | Retry or use another available model. |
503 | Temporary service or quota backend issue. | Retry with backoff. |
Retry behavior
Retry transient statuses with exponential backoff:
| Retry? | Status |
|---|---|
| Yes | 429, 500, 502, 503 |
| No | 400, 401, 403, 404, 405 |
Use jitter so many clients do not retry at the same moment.
python
import random
import time
def sleep_before_retry(attempt):
delay = min(30, (2 ** attempt) + random.random())
time.sleep(delay)Long-running requests
Video generation can run for several minutes. Configure clients and reverse proxies with long enough timeouts. With curl, use:
bash
curl --max-time 900 ...