Skip to main content

Response Format

All errors follow the same structure:
{
  "code": 401,
  "message": "Unauthorized - Authentication credentials are missing or invalid"
}

HTTP Status Codes

CodeNameDescription
200SuccessRequest processed successfully
400Bad RequestInvalid request parameters or generation still processing
401UnauthorizedAPI key missing or invalid
402Insufficient CreditsAccount balance too low to complete the request
404Not FoundEndpoint or resource does not exist
422Validation ErrorRequest parameters failed validation
429Rate LimitedToo many requests — slow down and retry
455Service UnavailableSystem is under maintenance
500Server ErrorUnexpected internal error
501Generation FailedThe model failed to generate output
505Feature DisabledThe requested feature is currently disabled

Common Errors and Fixes

401 Unauthorized

{ "code": 401, "msg": "You do not have access permissions" }
  • Check that your Authorization header is set to Bearer <YOUR_API_KEY>
  • Verify the key exists and hasn’t been deleted
  • Check that the requesting IP is in the key’s whitelist (if configured)

402 Insufficient Credits

Top up your balance at routerbase.com/billing or configure auto top-up.

422 Validation Error

The request body is missing a required field or contains an invalid value. Check the model’s parameter documentation for required fields.

429 Rate Limited

Implement exponential backoff:
import time, requests

def request_with_retry(url, headers, body, max_retries=5):
    for attempt in range(max_retries):
        res = requests.post(url, headers=headers, json=body)
        if res.status_code != 429:
            return res
        wait = 2 ** attempt
        time.sleep(wait)
    raise Exception("Max retries exceeded")

501 Generation Failed

The model accepted the task but could not produce output (e.g. content policy violation, provider error). Check the error_message field in the task status response for details.