Docs / API reference
Base URL: https://redrouter.ai/api/public/v1. All endpoints require a Bearer key and accept cross-origin requests.
Creates a chat completion. OpenAI-compatible request and response shapes.
modelstring, requiredModel id from the catalog, e.g. llama-3.3-70b.messagesarray, requiredConversation messages with role (system, user, assistant, tool) and content.max_tokensintegerMaximum completion tokens, 1–32768.temperaturenumberSampling temperature, 0–2.top_pnumberNucleus sampling, 0–1.streambooleanStream the response as server-sent events.stopstring | arrayUp to 4 stop sequences.{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "llama-3.3-70b",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 12, "completion_tokens": 40, "total_tokens": 52 }
}Lists the models in the catalog with their modality, parameters, and context length.
{
"object": "list",
"data": [
{
"id": "llama-3.3-70b",
"object": "model",
"name": "Llama 3.3 70B Instruct",
"family": "Llama",
"modality": "text",
"parameters": "70B",
"context_length": 128000,
"status": "live"
}
]
}All errors return a consistent JSON body:
{
"error": {
"message": "Human-readable description.",
"type": "invalid_request_error | authentication_error | not_found_error | model_unavailable | upstream_error | rate_limited | spend_cap_reached | server_error",
"code": 400
}
}Every account has a plan with a requests-per-minute limit, a daily token limit and a monthly spend cap. Each response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
Retry-After seconds.