API reference
API reference
The public Laras Router API, generated from our OpenAPI contract. OpenAI-compatible, authenticated with an API key.
The public API follows the OpenAI Chat Completions format, so the official OpenAI SDKs and most OpenAI-compatible clients work unchanged. It also serves the Anthropic Messages format at POST /v1/messages, for Claude Code and the Anthropic SDKs.
Base URL
https://api.larasrouter.com/v1
All requests use HTTPS. Request and response bodies are JSON (application/json); streamed responses use Server-Sent Events (text/event-stream). Large prompts are supported up to the request size limit; a larger body is rejected with 413 request_too_large.
Authentication
Send your API key in either header:
Authorization: Bearer lr_live_…
x-api-key: lr_live_…
See Authentication for key management.
Endpoints
/v1/modelsList modelsGET/v1/models/{id}Retrieve a modelPOST/v1/chat/completionsCreate chat completionPOST/v1/messagesCreate messageGenerated from the OpenAPI contract, version 0.1.0.
Errors
Every error uses the OpenAI error envelope, except those from POST /v1/messages, which use the Anthropic envelope (see Messages). Branch on error.code, never on the message text: the message is in English by default and in Bahasa Indonesia when the request carries Accept-Language: id.
{
"error": {
"message": "Insufficient balance. Top up to continue.",
"type": "insufficient_quota",
"code": "insufficient_credit",
"param": null
}
}
errorobjectrequiredThe error object.
messagestringrequiredHuman-readable message. English by default; Bahasa Indonesia with
Accept-Language: id. Do not branch on it.typestringrequiredError category, e.g.
invalid_request_errororinsufficient_quota.codestringrequiredStable machine-readable code. Branch on this.
paramstring | nullThe request parameter the error refers to, or
null.
Besides the errors listed on each endpoint, any /v1 path can return these gateway errors:
| Status | Code | Type | Meaning |
|---|---|---|---|
| 404 | not_found | invalid_request_error | Unknown endpoint. Check the path; the base URL ends in /v1. |
| 405 | method_not_allowed | invalid_request_error | The HTTP method is not allowed for this endpoint. |
| 413 | request_too_large | invalid_request_error | The request body is larger than the request size limit. Shorten the prompt or history. |
| 429 | ip_rate_limited | rate_limit_exceeded | Too many requests from one IP address. Wait for Retry-After. |
| 500 | internal_error | api_error | Unexpected server error. Retry with backoff. |
| 503 | service_unavailable | api_error | The service is temporarily unavailable. Retry with backoff. |
See Errors & retries for what to do about each code.
Response headers
| Header | Description |
|---|---|
X-Laras-Request-ID | Billing identity of the request. Present on responses to requests that reached billing; quote it when you contact support about a charge. |
Retry-After | On 429 responses: seconds to wait before retrying. |
Not available yet
The API serves POST /v1/chat/completions, POST /v1/messages, and GET /v1/models. Other OpenAI endpoints — such as embeddings, images, audio, and the Responses API — are not available. The Responses API (used by Codex CLI) is in development.