← Docs

Call API endpoints

Chat, Responses, Messages, images, embeddings, audio, video, and web search. Availability depends on your connected accounts and provider capabilities.

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.

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":"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","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,"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": "user", "content": "Hello"}],
)
print(result.choices[0].message.content)

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. Choose from /v1/models/image and confirm the model’s input format. 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":"YOUR_IMAGE_MODEL_ID","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":"YOUR_CODEX_IMAGE_MODEL_ID","prompt":"Make the background lighter","image":"https://YOUR_IMAGE_HOST/reference.png"}'

Output format, size, count, and editing support depend on the provider. A Codex Plus account does not imply access to every image operation. The editing example uses Codex’s image field with a reference URL accessible to the provider.

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

TTS and STT require matching providers. Choose a supported model/voice; file limits, languages, and formats depend on the provider.

MethodEndpointUsage
POST/v1/audio/speechmodel + input
POST/v1/audio/transcriptionsmultipart: model and file
GET/v1/audio/voices?provider={provider}Voices for elevenlabs, deepgram, inworld, edge-tts, local-device
Speech (binary output)
curl https://i-larouter.lapage.vn/v1/audio/speech \
  -H "Authorization: Bearer $LAROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_TTS_MODEL_OR_VOICE_ID","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=YOUR_STT_MODEL_ID" \
  -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.

LaRouter API endpoints | Chat, images, audio and video