API reference

API reference

The public Laras Router API, generated from our OpenAPI contract. OpenAI-compatible, authenticated with an API key.

On this page

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

Text
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:

Headers
Authorization: Bearer lr_live_…
x-api-key: lr_live_…

See Authentication for key management.

Endpoints

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 response
{
  "error": {
    "message": "Insufficient balance. Top up to continue.",
    "type": "insufficient_quota",
    "code": "insufficient_credit",
    "param": null
  }
}
  • errorobjectrequired

    The error object.

    • messagestringrequired

      Human-readable message. English by default; Bahasa Indonesia with Accept-Language: id. Do not branch on it.

    • typestringrequired

      Error category, e.g. invalid_request_error or insufficient_quota.

    • codestringrequired

      Stable machine-readable code. Branch on this.

    • paramstring | null

      The request parameter the error refers to, or null.

Besides the errors listed on each endpoint, any /v1 path can return these gateway errors:

StatusCodeTypeMeaning
404not_foundinvalid_request_errorUnknown endpoint. Check the path; the base URL ends in /v1.
405method_not_allowedinvalid_request_errorThe HTTP method is not allowed for this endpoint.
413request_too_largeinvalid_request_errorThe request body is larger than the request size limit. Shorten the prompt or history.
429ip_rate_limitedrate_limit_exceededToo many requests from one IP address. Wait for Retry-After.
500internal_errorapi_errorUnexpected server error. Retry with backoff.
503service_unavailableapi_errorThe service is temporarily unavailable. Retry with backoff.

See Errors & retries for what to do about each code.

Response headers

HeaderDescription
X-Laras-Request-IDBilling identity of the request. Present on responses to requests that reached billing; quote it when you contact support about a charge.
Retry-AfterOn 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.