OpenAI-compatible, drop-in replacement
If you've used the OpenAI API before, you already know how to use LLMHigh. Just change the base URL — your code stays the same.
4-language snippet
Replace your OpenAI base_url with ours, then call any chat model. That's it.
curl https://api.llmhigh.com/v1/chat/completions \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen2.5-7B-Instruct",
"messages": [{"role": "user", "content": "Hello!"}]
}'Authentication, chat completions, streaming
The three endpoints you'll use 95% of the time. Same shape as OpenAI — switch by changing base_url.
Authentication
All requests authenticate with a Bearer token. Generate one in your API Keys console.
Authorization: Bearer ***…xxxxChat completions
POST /v1/chat/completions — matches OpenAI's schema exactly.
from openai import OpenAI
client = OpenAI(
base_url="https://api.llmhigh.com/v1",
api_key="***",
)
resp = client.chat.completions.create(
model="Qwen/Qwen2.5-7B-Instruct",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)Streaming
Set stream: true to receive Server-Sent Events.
stream = client.chat.completions.create(
model="Qwen/Qwen2.5-7B-Instruct",
stream=True,
messages=[{"role": "user", "content": "Write a haiku"}],
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)Embeddings, model catalogue, usage
For teams that need retrieval, observability, or programmatic model discovery.
Embeddings
POST /v1/embeddings — OpenAI-compatible.
resp = client.embeddings.create(
model="BAAI/bge-m3",
input="LLMHigh is a unified AI API gateway",
)
print(len(resp.data[0].embedding))List models
GET /v1/models returns the live catalogue.
{
"object": "list",
"data": [
{
"id": "Qwen/Qwen2.5-7B-Instruct",
"pricing": { "input": 0.0004, "output": 0.0004 },
"context_window": 32768
}
]
}Usage endpoint
GET /v1/usage?from=YYYY-MM-DD&to=YYYY-MM-DD returns token usage grouped by day, model, and key.
{
"total": { "requests": 12480, "input_tokens": 12900412, "cost_usd": 31.42 },
"by_day": [{ "date": "2026-07-21", "requests": 612, "cost_usd": 1.83 }]
}Rate limits, error codes, webhooks
Production-readiness: predictable throttling, typed errors, event-driven automation.
Rate limits
Limits are enforced per API key using a token-bucket algorithm.
Error codes
All errors follow the OpenAI JSON shape. Failed requests never bill your account.
| Code | Name | Meaning |
|---|---|---|
| 400 | Bad Request | Malformed JSON or invalid parameter values. |
| 401 | Unauthorized | API key missing, invalid, or revoked. |
| 402 | Payment Required | Account balance insufficient for the request. |
| 404 | Not Found | Model not found, disabled, or route misconfigured. |
| 429 | Too Many Requests | Rate limit exceeded. |
| 502 | Upstream Error | Provider returned a non-retryable error. |
| 503 | Service Unavailable | All upstream channels failed. |
Webhooks
Subscribe to billing and quota events. All deliveries are signed with HMAC-SHA256 and retried up to 5 times.
| Event | Trigger |
|---|---|
balance.low | Balance falls below threshold. |
balance.depleted | Balance hits zero. |
quota.exceeded | Per-key RPM/TPM cap exceeded. |
key.created | New API key issued. |
key.revoked | API key revoked. |