Quickstart

The API is OpenAI-compatible. Use any OpenAI SDK with this base URL and your key.

Base URL

https://api.cheaperllm.com/v1

Authenticate with Authorization: Bearer YOUR_API_KEY. Get a key on the account page. Pick a MODEL_ID from the models list.

Example requests

curl

curl https://api.cheaperllm.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"MODEL_ID","messages":[{"role":"user","content":"Hello"}]}'

Python (OpenAI SDK)

from openai import OpenAI
client = OpenAI(base_url="https://api.cheaperllm.com/v1", api_key="YOUR_API_KEY")
r = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)

Node (OpenAI SDK)

import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.cheaperllm.com/v1", apiKey: "YOUR_API_KEY" });
const r = await client.chat.completions.create({
  model: "MODEL_ID",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);

Add "stream": true for server-sent-event streaming.

Other endpoints

EndpointWhat it does
GET /v1/modelsList available models with context length and pricing.
GET /v1/creditsYour prepaid balance.
GET /v1/usageYour usage summary.
POST /v1/chat/completionsChat completions, streaming supported.

Errors you may see

StatusMeaning
400 content_policy_violationThe prompt was blocked by moderation before any charge.
401Missing or unrecognised API key.
402Out of credit. Top up on the pricing page.
429Rate limit or daily spend cap reached for this key.
5xxUpstream provider problem. We try other routes first, so retry after a moment.