Run your first completion
This page sends one chat completion through the gateway, walks through what came back, and points at the things you’ll come back to.
Send the request
Set your key in an environment variable so it doesn’t end up in shell history:
export LOWROUTER_API_KEY="lr-sk-..."Then call the gateway:
curl https://lowrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $LOWROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lowrouter/auto",
"messages": [
{"role": "user", "content": "In one sentence, what is a vector database?"}
]
}'lowrouter/auto is the default route. You can pick a specific model
instead — for example openai/gpt-4o-mini or
anthropic/claude-haiku-4-5 — and you can override the route per
request with the route field. See routing.
What comes back
The response is OpenAI-shaped. The fields you’ll use most are:
{
"id": "chatcmpl-01J9...",
"object": "chat.completion",
"created": 1714150000,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A vector database stores …"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 26,
"total_tokens": 44
},
"lowrouter": {
"generation_id": "gen_01J9...",
"provider": "openai",
"region": "eu-west",
"eco": {
"energy_wh": 0.0021,
"carbon_g": 0.00057,
"carbon_per_1k_tokens_g": 0.013,
"accuracy": "accurate"
}
}
}The OpenAI-compatible parts (id, choices, usage, …) are
documented in chat completions.
The LowRouter-specific block:
generation_id— opaque ID for this request. Pass it toGET /generation/{id}to fetch the full record later, or open it on the dashboard with that ID.provider— which upstream actually served the request.region— the region the upstream served from.eco— energy and carbon estimate for this request, with a confidence label. Read methodology before quoting these numbers anywhere.
Stream the response
For interactive UIs, set "stream": true and read Server-Sent Events:
curl https://lowrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $LOWROUTER_API_KEY" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "lowrouter/auto",
"stream": true,
"messages": [{"role": "user", "content": "Count to 5 slowly"}]
}'The stream format and how to consume it from common SDKs is on the streaming page.
Things that might surprise you
- The
modelin the response is the resolved model, not the pseudo-model you sent. If you sentlowrouter/auto, the response tells you what was actually picked. usagereflects upstream tokens, which may include caching discounts (for providers that support them). The credits charged on your dashboard match thisusage.- The
ecoblock is missing on requests we couldn’t classify, e.g. a model whose parameter count is unknown. The dashboard shows the same record without an eco number rather than a fabricated one.