← Docs

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.

Environment
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.

MethodEndpointUsage
GET/v1/modelsModel 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
Models
curl https://i-larouter.lapage.vn/v1/models \
  -H "Authorization: Bearer $LAROUTER_API_KEY"
Image models
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.

MethodEndpointUsage
POST/v1/chat/completionsmodel + messages
POST/v1/responsesmodel + input
POST/v1/responses/compactCompact conversation input through the Responses pipeline
POST/v1/messagesmodel + max_tokens + messages
POST/v1/messages/count_tokensCharacter-based token estimate, not an exact tokenizer
Chat Completions
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"}]}'
Responses
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"}'
Messages
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"}]}'
Python SDK
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.

MethodEndpointUsage
POST/v1/images/generationsmodel + prompt
POST/v1/images/editsJSON prompt and provider-specific image fields
Generate an image
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"}'
Image edit (Codex JSON)
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.

MethodEndpointUsage
POST/v1/embeddingsmodel + input
Embeddings
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.

MethodEndpointUsage
POST/v1/audio/speechmodel + input
POST/v1/audio/transcriptionsmultipart: model and file
GET/v1/audio/voicesVoice list: id, name, language, gender, sample clip
Speech (mp3 output)
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.mp3
Transcription
curl 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.

MethodEndpointUsage
POST/v1/videos/generationsCreate a video job
POST/v1/videos/editsEdit a video with a provider-specific payload
POST/v1/videos/extensionsExtend a video with a provider-specific payload
GET/v1/videos/{id}Poll a job status
Create a video job
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"}'
Poll on the same account
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.

MethodEndpointUsage
POST/v1/searchprovider (or model) + query
POST/v1/web/fetchprovider (or model) + url
POST/v1/alpha/searchCodex-specific search protocol
Web search
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}'
Fetch a page
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.

MethodEndpointUsage
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/quotaKey status, weekly limit, used and remaining credits, reset time and current plan
Usage for the last 30 days
curl "https://larouter-api.lapage.vn/api/key/usage?period=30d" \
  -H "Authorization: Bearer $LAROUTER_API_KEY"
Quota and reset time
curl https://larouter-api.lapage.vn/api/key/quota \
  -H "x-api-key: $LAROUTER_API_KEY"
Quota response
{
  "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.