Docs
Gettingstarted
If your code already speaks to an OpenAI-compatible API, this is a two-line change: the base URL and the key.
Quick start
Three steps to a live request.
-
Create a key
In the member portal, under API keys. The key is shown once — we store only a hash of it, so we cannot show it to you again or recover it for you.
-
Point your client at us
Set the base URL to our endpoint and use your key as the API key. Model names come from
GET /v1/models. -
Streaming
Server-sent events work exactly as you expect — tokens arrive as they are produced, not batched at the end.
Example
A minimal request
Same shape as the OpenAI Chat Completions API — model, messages, and the usual sampling parameters. stream: true switches the response to server-sent events on the same endpoint.
# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.<your-domain>/v1",
api_key="LLMR_API_KEY",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Sawasdee!"}],
) No SDK required
Call the endpoint directly
Send a standard HTTPS request to /v1/chat/completions — works from any language that can make an HTTP call, no dependency required.
# pip install requests
import requests
response = requests.post(
"https://api.<your-domain>/v1/chat/completions",
headers={
"Authorization": "Bearer $LLMR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Sawasdee!"}],
},
)
print(response.json()) // npm install not required — fetch is built in
const response = await fetch("https://api.<your-domain>/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.LLMR_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Sawasdee!" }],
}),
});
const data = await response.json(); curl https://api.<your-domain>/v1/chat/completions \
-H "Authorization: Bearer $LLMR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Sawasdee!"}]
}' Streaming
Disconnecting doesn't cancel the bill
Set stream: true and read the response as server-sent events, same shape as OpenAI's Chat Completions streaming.
- Format
- Standard server-sent events — the same chunked
data:format and termination OpenAI's streaming responses use, unmodified. - Disconnecting early
- Tokens already generated before you close the connection are still billed. An interrupted request is metered the same as a completed one.
Errors
What a failed request looks like
Every error responds with {"detail": "<message>"} — a flatter shape than OpenAI's nested error object, so error-handling code written for OpenAI may need a small adjustment.
- 401
- The key is missing, unknown, or has been revoked.
- 402
- Your account balance is too low to cover this request. The message states the balance in THB.
- 403
- Either the organization has been suspended, or the key is an operator/master key, which cannot be billed for inference.
- 503
- Our internal key store is unreachable. We fail closed rather than let an unverifiable key through.
Rate limits are not yet enforced on API requests
Per-key request limits are planned for a later phase and are not live today. The only throttling in the system right now protects the member portal's login form against repeated guesses — it has nothing to do with calls to /v1/chat/completions.
Region
A request never leaves your chosen boundary silently.
Each key carries a routing policy, set once and enforced on every call.
- strict
- Keeps requests in the nearest region and queues rather than routing further away.
- regional
- Allows overflow within the Bangkok–Tokyo boundary when the nearest region is busy.
- available
- Opt-in only. Allows routing anywhere a model is served, for the lowest queueing risk.
Ready for a real request.
Create a key, then check per-model rates before you commit spend.