Ship in five minutes.
OpenAI-compatible endpoint. Swap the base URL, keep your SDK, get smart routing across every provider.
Quickstart
curl https://api.llmcloud.ai/v1/chat/completions \
-H "Authorization: Bearer $LLMCLOUD_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto:quality",
"messages": [{"role":"user","content":"Draft a launch tweet."}]
}'Smart routing
Pass a routing directive as the model name. We score every eligible upstream on capability, live latency, price, and quality benchmarks — then pick the winner.
Streaming & tools
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.llmcloud.ai/v1",
apiKey: process.env.LLMCLOUD_KEY,
});
const stream = await client.chat.completions.create({
model: "auto:quality",
stream: true,
tools: [{ type: "function", function: { name: "getWeather", parameters: {} } }],
messages: [{ role: "user", content: "Weather in Tokyo?" }],
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");Authentication
Every request carries a bearer key on the Authorization header. Keys are scoped objects, not bare strings: each one carries an environment label, an optional monthly spend ceiling, an allow-list of models or routing policies, and an optional provider allow-list. A key that exceeds its ceiling returns 402 budget_exceeded rather than silently continuing to spend.
# Environment-scoped keys export LLMCLOUD_KEY="lc_live_..." # production, budget capped export LLMCLOUD_KEY="lc_test_..." # staging, routed to cheap models only curl https://api.llmcloud.ai/v1/models \ -H "Authorization: Bearer $LLMCLOUD_KEY"
Bringing your own provider contracts? See BYOK — your upstream keys are used for billing while routing, caching, and analytics still apply.
Response headers
Every completion returns the full accounting of what happened, so you never have to guess which upstream served a request or what it cost.
| Header | Example | Meaning |
|---|---|---|
| x-llmcloud-route | fireworks/llama-4-maverick | Provider and model that actually served the request. |
| x-llmcloud-cost | 0.00184 | Cost of this request in USD at provider list price. Platform fee is always zero. |
| x-llmcloud-latency | 312 | Time to first token in milliseconds, measured at our edge. |
| x-llmcloud-cache | hit | miss | bypass | Semantic cache outcome. A hit is billed at zero provider cost. |
| x-llmcloud-attempts | 2 | How many upstreams were tried before one succeeded. |
| x-llmcloud-region | eu-frankfurt | Jurisdiction the inference ran in, for residency-pinned traffic. |
Errors and retries
Errors use OpenAI-compatible shapes so existing client error handling keeps working. The gateway already retried across upstreams before returning anything in the 5xx range — an error that reaches you means every eligible candidate failed.
| Status | Code | What to do |
|---|---|---|
| 400 | invalid_request | Schema or modality mismatch — the payload contained an input the selected model cannot accept. Switch to auto:multimodal or fix the field named in the error. |
| 401 | invalid_api_key | Key revoked, malformed, or from the wrong environment. Rotate in key management. |
| 402 | budget_exceeded | The key hit its configured monthly ceiling. Raise the cap or wait for the reset date in the error body. |
| 404 | model_not_found | Model ID retired or unavailable in your allow-list. Query /v1/models for the live list. |
| 429 | rate_limited | Every eligible upstream was saturated. Respect the Retry-After header; widen your provider allow-list to add headroom. |
| 502 | all_upstreams_failed | All candidates failed after retries. The error body includes the full attempt log with each provider's status. |
| 504 | stream_stalled | Inter-token gap exceeded the configured stall timeout on every attempt. Raise stall_timeout_ms or pin a faster provider. |
Usage API
Every request returns x-llmcloud-route and x-llmcloud-cost. See the usage dashboard for spend, latency, and per-model traces.
curl "https://api.llmcloud.ai/v1/usage?from=2026-08-01&to=2026-08-31&group_by=model" \
-H "Authorization: Bearer $LLMCLOUD_KEY"
{ "rows": [
{ "model": "llama-4-maverick", "provider": "fireworks",
"requests": 41230, "input_tokens": 88.2e6, "output_tokens": 12.4e6,
"cost_usd": 214.87, "platform_fee_usd": 0.00, "cache_hit_rate": 0.31 }
] }Where to go next
Docs FAQ
Is the API really OpenAI-compatible?
Yes. The chat completions, embeddings, and models endpoints match the OpenAI request and response shapes, including streaming deltas and tool-call objects. Point an existing OpenAI SDK at https://api.llmcloud.ai/v1, change the key, and existing code runs unmodified.
What does llmcloud charge on top of provider pricing?
Nothing. Token spend passes through at provider list price and x-llmcloud-cost reports exactly that. The Team plan is a flat 10 USD per user per month for org analytics and advanced routing; hosted inference is priced per token on our own published rates.
Do I need to change my model IDs?
Only if you want routing. Concrete IDs such as anthropic/claude-sonnet work directly. Replacing the ID with an auto: policy hands the choice to the router while keeping the same request body.
How are rate limits calculated?
Limits are pooled across every upstream serving a model rather than fixed per key, so widening your provider allow-list raises effective throughput. When the whole pool is saturated the gateway returns 429 with Retry-After instead of queueing indefinitely.
Are prompts and completions retained?
Not on the Developer plan — request and response bodies are dropped after the response is streamed, and only metadata needed for billing and routing is kept. Retention windows, region pinning, and zero-retention provider filters are documented under trust and residency.