Call API endpoints
Chat, Responses, Messages, images, embeddings, audio, video, and web search. Availability depends on the model and your plan.
These are routes supported by the router, not a promise that every endpoint is enabled for your account. Examples are commands for you to run; this page does not send API requests. Replace every YOUR_* placeholder and keep your key out of frontend code.
Call the LaRouter API from code
The videos are in Vietnamese.
Use in n8n
The videos are in Vietnamese.
export LAROUTER_API_KEY="YOUR_API_KEY"Models and capabilities
Discover IDs, then select a model supported by your accounts and task type. A catalog entry does not guarantee availability for your key.
| Method | Endpoint | Usage |
|---|---|---|
| GET | /v1/models | Model catalog |
| GET | /v1/models/{kind} | Filter by image, tts, stt, embedding, image-to-text, or web |
| GET | /v1/models/info?id={modelId} | Single-model metadata; optional kind filter |
curl https://i-larouter.lapage.vn/v1/models \
-H "Authorization: Bearer $LAROUTER_API_KEY"curl https://i-larouter.lapage.vn/v1/models/image \
-H "Authorization: Bearer $LAROUTER_API_KEY"Chat, Responses and Messages
Choose the protocol your application uses. LaRouter provides Chat Completions; there is no legacy /v1/completions route. Streaming, tool calling, and context compaction depend on the provider/model.
| Method | Endpoint | Usage |
|---|---|---|
| POST | /v1/chat/completions | model + messages |
| POST | /v1/responses | model + input |
| POST | /v1/responses/compact | Compact conversation input through the Responses pipeline |
| POST | /v1/messages | model + max_tokens + messages |
| POST | /v1/messages/count_tokens | Character-based token estimate, not an exact tokenizer |
curl https://i-larouter.lapage.vn/v1/chat/completions \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL_ID","messages":[{"role":"system","content":"You are the support assistant for my shop."},{"role":"user","content":"Hello"}]}'curl https://i-larouter.lapage.vn/v1/responses \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL_ID","instructions":"You are the support assistant for my shop.","input":"Hello"}'curl https://i-larouter.lapage.vn/v1/messages \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL_ID","max_tokens":256,"system":"You are the support assistant for my shop.","messages":[{"role":"user","content":"Hello"}]}'import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["LAROUTER_API_KEY"],
base_url="https://i-larouter.lapage.vn/v1",
)
result = client.chat.completions.create(
model="YOUR_MODEL_ID",
messages=[
{"role": "system", "content": "You are the support assistant for my shop."},
{"role": "user", "content": "Hello"},
],
)
print(result.choices[0].message.content)Set your own system prompt for your app (the "system" role in Chat Completions, the system field in Messages, instructions in Responses), as in the examples. Without one, the model may introduce itself with its default identity instead of the role you want. For Python, install the openai package first. All examples read your API key from an environment variable on a server or trusted local machine.
Image generation and editing
Requires an image-capable provider/account. Send the full image model ID with its cx/ prefix, for example cx/gpt-image-2.5, cx/gpt-image-2.5-flare or cx/gpt-image-2.5-sunburst (about 609 credits per image). GET /v1/models/image lists the IDs. This router’s /images/edits route accepts JSON; it is not a universal multipart upload endpoint.
| Method | Endpoint | Usage |
|---|---|---|
| POST | /v1/images/generations | model + prompt |
| POST | /v1/images/edits | JSON prompt and provider-specific image fields |
curl https://i-larouter.lapage.vn/v1/images/generations \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"cx/gpt-image-2.5","prompt":"A quiet garden at sunrise"}'curl https://i-larouter.lapage.vn/v1/images/edits \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"cx/gpt-image-2.5","prompt":"Make the background lighter","image":"https://YOUR_IMAGE_HOST/reference.png"}'Output format, size, count, and editing support depend on the model. The editing example uses Codex’s image field with a publicly accessible reference URL.
Embeddings
Convert text to vectors with a supported embedding model. A chat model is not a substitute for an embedding model.
| Method | Endpoint | Usage |
|---|---|---|
| POST | /v1/embeddings | model + input |
curl https://i-larouter.lapage.vn/v1/embeddings \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_EMBEDDING_MODEL_ID","input":"A short text to index"}'Audio
Text-to-speech uses larouter-tts or larouter-tts-hd; speech-to-text uses larouter-stt. Listen to every voice in the voice library at /voices.
| Method | Endpoint | Usage |
|---|---|---|
| POST | /v1/audio/speech | model + input |
| POST | /v1/audio/transcriptions | multipart: model and file |
| GET | /v1/audio/voices | Voice list: id, name, language, gender, sample clip |
curl https://i-larouter.lapage.vn/v1/audio/speech \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"larouter-tts","voice":"Mai","input":"Hello from LaRouter"}' \
--output speech.mp3curl https://i-larouter.lapage.vn/v1/audio/transcriptions \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-F "model=larouter-stt" \
-F "[email protected]"This router returns audio by default from speech; use ?response_format=json for its supported JSON response. A voice may be encoded in the model ID itself.
Asynchronous video
Video routes forward jobs to a supported video provider; the source includes xAI Grok Imagine integration. Your account needs video access; model combos are unsupported.
| Method | Endpoint | Usage |
|---|---|---|
| POST | /v1/videos/generations | Create a video job |
| POST | /v1/videos/edits | Edit a video with a provider-specific payload |
| POST | /v1/videos/extensions | Extend a video with a provider-specific payload |
| GET | /v1/videos/{id} | Poll a job status |
curl --include https://i-larouter.lapage.vn/v1/videos/generations \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_VIDEO_MODEL_ID","prompt":"A slow pan across a quiet garden"}'curl https://i-larouter.lapage.vn/v1/videos/YOUR_JOB_ID \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "x-connection-id: CONNECTION_ID_FROM_CREATE_RESPONSE"Save the job ID and x-9router-connection-id response header from creation. Echo that header’s value as x-connection-id when polling to use the same account. Duration, source media fields, and response states are provider-specific.
Web search and fetch
Requires a search or fetch provider. Use a configured provider ID rather than assuming a chat model supports these endpoints.
| Method | Endpoint | Usage |
|---|---|---|
| POST | /v1/search | provider (or model) + query |
| POST | /v1/web/fetch | provider (or model) + url |
| POST | /v1/alpha/search | Codex-specific search protocol |
curl https://i-larouter.lapage.vn/v1/search \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"provider":"YOUR_SEARCH_PROVIDER_ID","query":"Latest documentation","max_results":5}'curl https://i-larouter.lapage.vn/v1/web/fetch \
-H "Authorization: Bearer $LAROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"provider":"YOUR_FETCH_PROVIDER_ID","url":"https://example.com"}'/alpha/search is for Codex-protocol clients; it is not a drop-in replacement for the /search query payload.
Your key's usage and quota
Read your own usage, weekly limit, reset time and status with the same API key, without signing in to the portal. Call it from your server or scripts, never from browser code, because the key would be exposed.
| Method | Endpoint | Usage |
|---|---|---|
| GET | /api/key/usage?period={period} | Usage totals and breakdown by account, model and endpoint. Period: today, 24h, 7d (default), 30d, 60d or all |
| GET | /api/key/quota | Key status, weekly limit, used and remaining credits, reset time and current plan |
curl "https://larouter-api.lapage.vn/api/key/usage?period=30d" \
-H "Authorization: Bearer $LAROUTER_API_KEY"curl https://larouter-api.lapage.vn/api/key/quota \
-H "x-api-key: $LAROUTER_API_KEY"{
"status": "success",
"data": {
"status": "active",
"limitCredits": 225000,
"usedCredits": 6170,
"remainingCredits": 218830,
"resetAt": "2026-11-04T04:00:33.487Z",
"resetAtVietnam": "2026-11-04T11:00:33.487+07:00",
"plan": { "code": "C900", "billing": "month", "renewsAt": "2026-11-27T04:11:09.645Z" }
}
}Send the key as Authorization: Bearer or x-api-key. A missing or unknown key returns 401, an unsupported period returns 400, and more than 60 requests per minute returns 429 with a Retry-After header. You only ever see your own key's data. These endpoints are on the LaRouter portal API, not on the model API host.