API reference
Use one LivRouter key with the request format your application expects. Choose the protocol first, then select a model that supports it. A model being listed does not guarantee support for every endpoint.
Base URL and authentication
export OPENAI_API_KEY="your-livrouter-api-key"export LIVROUTER_MODEL="your-model-id"export OPENAI_BASE_URL="https://api.livrouter.com/v1"OpenAI-compatible requests use Authorization: Bearer $OPENAI_API_KEY. Anthropic Messages requests use x-api-key with your LivRouter key and anthropic-version. Send Content-Type: application/json unless an endpoint explicitly requires multipart data.
https://api.livrouter.com/v1. Anthropic SDK clients use https://api.livrouter.com because the SDK adds /v1/messages. Raw HTTP requests always include the full endpoint path.Endpoint directory
| Method | Path | Guide |
|---|---|---|
| GET | /v1/models | Models available to your key |
| POST | /v1/chat/completions | Chat Completions |
| POST | /v1/messages | Anthropic Messages |
| POST | /v1/responses | Responses |
| POST | /v1/images/generations | Image generations — confirm availability |
| POST | /v1/images/edits | Image edits — confirm availability |
Vision, PDF, speech, embeddings, moderation, and tools retain their dedicated guides under Core API and More reference. Their availability depends on the selected model and deployment.
Common request fields
| Field | Requirement | Behavior |
|---|---|---|
model | Required | Use the exact model ID available to your key. |
messages / input | Required | Chat and Messages use messages; Responses uses input. |
stream | Optional boolean | Enable server-sent events. Parse events using the selected protocol. |
max_tokens / max_output_tokens | Protocol and model dependent | Messages requires max_tokens. Responses uses max_output_tokens. Chat token limits vary by model. |
temperature | Model dependent | Only send generation controls supported by the selected model. |
Validate a request
- Follow Quickstart to verify the key and select a model.
- Send a short prompt before adding tools, files, or long conversations.
- Confirm the expected response structure and inspect usage logs.
If a request fails, read the response body as well as the HTTP status. Use the troubleshooting guide before adding retries.