Documentation
ServeLLM is a region-local LLM inference platform. It exposes an OpenAI-compatible REST API so you can drop it into any existing codebase with a one-line change — just swap the base URL and use your ServeLLM API key. Models run on infrastructure close to your users, billed per token in your local currency (PKR).
OpenAI-compatible
Same request / response shape as the OpenAI Chat Completions API.
Region-local
Choose a region to route requests to the nearest inference node.
Pay in PKR
Pre-purchase credits in Pakistani Rupees via JazzCash.
Authentication#
All API requests must include your API key in the Authorization header using the Bearer scheme. API keys are created in the dashboard.
Authorization: Bearer sk-servellm-<your-key>Keys are prefixed sk-servellm- and hashed server-side — ServeLLM never stores the raw key. You will only see the full key once at creation time, so copy it immediately.
Quick Start#
The base URL for the API is your region's inference endpoint. You can find the base URL for each region in the Regions section. Replace BASE_URL with the appropriate endpoint for your region.
cURL
curl https://<BASE_URL>/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-servellm-<your-key>" \
-d '{
"model": "qwen3:0.6b",
"messages": [
{ "role": "user", "content": "Hello! What can you do?" }
]
}'Python
from openai import OpenAI
client = OpenAI(
api_key="sk-servellm-<your-key>",
base_url="https://<BASE_URL>/v1",
)
response = client.chat.completions.create(
model="qwen3:0.6b",
messages=[
{"role": "user", "content": "Hello! What can you do?"}
],
)
print(response.choices[0].message.content)JavaScript / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-servellm-<your-key>",
baseURL: "https://<BASE_URL>/v1",
});
const response = await client.chat.completions.create({
model: "qwen3:0.6b",
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(response.choices[0].message.content);Chat Completions#
The primary endpoint is POST /v1/chat/completions. It is fully compatible with the OpenAI Chat Completions API.
POST https://<BASE_URL>/v1/chat/completionsRequest body
modelstringrequiredThe model identifier to use, e.g. qwen3:0.6b or llama3.2:3b. See the Models section for available IDs.
messagesarrayrequiredArray of message objects. Each message has a role (system, user, or assistant) and a content string.
streambooleanIf true, the response is streamed back as server-sent events (SSE). Defaults to false.
temperaturenumberSampling temperature between 0 and 2. Higher values make output more random. Defaults to 1.
max_tokensintegerMaximum number of tokens to generate. Model-specific limits apply.
top_pnumberNucleus sampling parameter. Defaults to 1.
Example response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1749400000,
"model": "qwen3:0.6b",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I am Qwen, a large language model. I can help with ..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 52,
"total_tokens": 66
}
}Streaming#
Set "stream": true to receive tokens as they are generated via server-sent events. The stream ends with a [DONE] marker.
from openai import OpenAI
client = OpenAI(
api_key="sk-servellm-<your-key>",
base_url="https://<BASE_URL>/v1",
)
stream = client.chat.completions.create(
model="qwen3:0.6b",
messages=[{"role": "user", "content": "Count to 10."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content or ""
print(delta, end="", flush=True)Models#
Available models are managed by the ServeLLM team and vary by region. You can list available models via the dashboard or by querying the management API once authenticated. All prices are in PKR per 1 million tokens.
| Model ID | Name | Input / Output |
|---|---|---|
qwen3:0.6b | Qwen 3 0.6B | PKR 10 / PKR 30 |
qwen3:4b | Qwen 3 4B | PKR 40 / PKR 120 |
llama3.2:3b | Llama 3.2 3B | PKR 30 / PKR 90 |
llama3.1:8b | Llama 3.1 8B | PKR 80 / PKR 240 |
Regions#
ServeLLM runs inference nodes in multiple regions. Each region has its own base URL. When you create an API key in the dashboard you can assign it to a specific region, or set your preferred region in account settings.
| Region key | Location | Status |
|---|---|---|
pk | Pakistan | Active |
The selected region determines which inference node handles your request. You can pass a region preference when creating API keys. More regions will be added — check the dashboard for the latest list.
Credits & Billing#
ServeLLM uses a pre-paid credits model. Your organization holds a PKR credits balance that is debited after each successful request based on actual token usage.
Top up via JazzCash
Add credits from the Billing page using JazzCash redirect or mWallet. Payments are reflected instantly on success.
Per-token billing
Cost = (prompt tokens / 1M × input rate) + (completion tokens / 1M × output rate). Rates are in PKR and set per model.
Low balance alert
The dashboard shows a warning when your balance drops below PKR 50 so you can top up before requests are blocked.
Zero-balance blocking
When credits reach PKR 0, new requests return a 402 error. Top up to resume. Superadmin accounts are never blocked.
Error Codes#
Errors follow a standard JSON structure. Non-2xx responses include a message field describing the problem.
{
"success": false,
"message": "Invalid API key"
}| Status | Meaning |
|---|---|
400 | Bad request — malformed JSON or missing required fields. |
401 | Unauthorized — missing or invalid API key. |
402 | Payment required — your organization has no credits remaining. |
403 | Forbidden — your key does not have access to this resource. |
404 | Not found — the requested model or resource does not exist. |
429 | Too many requests — rate limit exceeded. Retry after a short delay. |
500 | Internal server error — something went wrong on our end. |
503 | Service unavailable — the inference node is temporarily unreachable. |
Ready to start building?
Create a free account, grab an API key, and make your first request in minutes.
Get your API key