Documentation
lbrouter is an OpenAI-, Anthropic- and Responses-compatible gateway. Point any existing client at it, use one of your API keys, and call a shared model by its name.
Contents
1. Create an API key
Sign in, open API keys, and create one. Copy it — it is shown only once; the server keeps only a hash. Attach the models (combos) you want the key to reach, or leave the list empty to allow every published model. You can also set request and token caps per key.
2. Find your endpoint
Your base URL is shown on the Overview tab. It looks like this, and every example below is written against it:
https://your-domain/v1
3. OpenAI Chat Completions
Any OpenAI-compatible client works by changing the base URL and key:
curl BASE/chat/completions \
-H "Authorization: Bearer br_your_key" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Hello"}]}'
4. Anthropic Messages
The Anthropic wire format is served on its own path, so the Anthropic SDKs and Claude-style clients work unchanged:
curl BASE/messages \
-H "x-api-key: br_your_key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'
5. Responses API
The newer OpenAI Responses shape is served on BASE/responses, for clients that use it:
curl BASE/responses \
-H "Authorization: Bearer br_your_key" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","input":"Hello"}'
6. Client SDKs
Because the request shapes are unchanged, the official SDKs work as they are — only the base URL and key differ:
from openai import OpenAI
client = OpenAI(base_url="BASE", api_key="br_your_key")
resp = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
The Anthropic SDK is the same idea, with its own base URL and the x-api-key header handled for you.
7. Model names
name— a shared model combo published by the maintainer. The Models tab lists them, with per-token prices.GET BASE/models— lists everything your key is allowed to call, in the OpenAI list format.- A combo may route across several providers with failover, so the same
namecan be answered by different upstream models over time.
8. Streaming
Set "stream": true on a request to receive server-sent events as the model produces them. Token usage is reported in the final event for OpenAI-shaped responses (and via the message_delta/message_stop events for Anthropic-shaped ones), the same as the upstream providers.
9. Errors
Errors use the OpenAI error envelope, so a client that already handles {"error": {"message": …}} needs no change:
401— missing or invalid key. Check the key and that it is enabled.402— the balance is zero and the model is paid. Top up, or use a free model.403— the key is not allowed to reach that model.429— rate-limited or the balance is exhausted mid-request. Retry with backoff.5xx— an upstream provider failed after any configured failover was exhausted. Retry later.
10. Billing
Paid models draw down your prepaid credit, metered per token. Watch your balance and spend on Wallet and Usage, and set a low-balance email alert under Settings. When your balance reaches zero, paid models pause until you top up; free models keep working. Top-ups are non-refundable — see the Terms.
Need help?
Email admin@lbrouter.com. Replies are best-effort.