Quickstart
Send your first request in about five minutes. If you already use the OpenAI SDK, you only change two lines.
On this page
Top up your balance
Open Billing in the console, pick an amount between $1 and $100, and scan the QRIS code with any Indonesian bank or e-wallet app. Before you pay, the invoice shows the exchange rate, the 1% admin fee, and the total in Rupiah. Your USD balance updates as soon as the payment clears. See Topping up with QRIS for the details.
Create an API key
In API keys, choose Create API key. Keys start with lr_live_ and are shown once. Store it as an environment variable:
export LARAS_API_KEY="lr_live_your_key_here"
Install the OpenAI SDK
Laras Router speaks the OpenAI API, so the official SDK works as is.
pip install openai
npm install openai
Send your first request
Set the base URL to https://api.larasrouter.com/v1 and call any model by its ID.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.larasrouter.com/v1",
api_key=os.environ["LARAS_API_KEY"],
)
resp = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Halo!"}],
)
print(resp.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.larasrouter.com/v1",
apiKey: process.env.LARAS_API_KEY,
});
const resp = await client.chat.completions.create({
model: "deepseek-v4.1-flash",
messages: [{ role: "user", content: "Halo!" }],
});
console.log(resp.choices[0].message.content);
curl https://api.larasrouter.com/v1/chat/completions \
-H "Authorization: Bearer $LARAS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Halo!"}]}'
Response
The usage object is what you are billed for. Cache hits and misses are priced separately.
"usage": {
"prompt_tokens": 12400,
"prompt_cache_hit_tokens": 8000,
"prompt_cache_miss_tokens": 4400,
"completion_tokens": 1800,
"total_tokens": 14200
}
On deepseek-v4.1-flash this request costs $0.004720: 8,000 cache-hit tokens at $0.010, 4,400 cache-miss tokens at $0.400, and 1,800 output tokens at $1.600 per 1M. The DeepSeek models report the split as prompt_cache_hit_tokens and prompt_cache_miss_tokens; glm-5.3-flash reports cache hits as prompt_tokens_details.cached_tokens.
Every response also carries an X-Laras-Request-ID header. Keep it if you need to ask us about a charge.
Request body
The body follows the OpenAI chat completions format. The fields you will use most:
| Field | Type | Description |
|---|---|---|
model required | string | deepseek-v4.1-flash, deepseek-v4-pro, glm-5.3-flash, or glm-5.3. |
messages required | array | The conversation so far, as role and content pairs. |
stream | boolean | Return tokens as server-sent events while they generate. |
max_tokens | integer | Upper bound on output tokens, useful for capping cost. |
Every field is described in the Chat completions reference.
Limits
300
requests per minute, per key
16
concurrent requests, per key
$1–$100
per QRIS top-up
Next steps
Updated Nov 2026