CostLLM .ai
API Documentation
OpenAI-compatible API gateway. One line change in your code.
Quickstart
Replace base_url and api_key. Everything else stays the same.
cURL
Copy
curl https://api.costllm.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
]
}'
Python (OpenAI SDK)
Copy
from openai import OpenAI
client = OpenAI(
base_url="https://api.costllm.ai/v1",
api_key="YOUR_API_KEY"
)
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Node.js
Copy
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.costllm.ai/v1',
apiKey: 'YOUR_API_KEY'
});
const response = await client.chat.completions.create({
model: 'deepseek-v4-flash',
messages: [{ role: 'user', content: 'Hello!' }]
});
console.log(response.choices[0].message.content);
Authentication
Include your API key in the Authorization header:
Authorization: Bearer sk-costllm-xxxxxxxxxxxxxxxx
Generate API keys from your Dashboard after signing up.
Available Models
Model ID Input / 1M tokens Output / 1M tokens Context Best for
deepseek-v4-flash $0.14 $0.28 128K Chat, drafts, quick tasks
deepseek-v4-pro $0.44 $0.87 128K Code, analysis, reasoning
Rate Limits
Plan Requests / Minute API Keys
Free 5 1
Starter 30 5
Pro 100 20
Team 300 50
Business Unlimited Unlimited
Rate limit info is returned in response headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
Response Headers
Header Description
X-RateLimit-Limit Max requests per minute for your plan
X-RateLimit-Remaining Requests remaining in current window
X-RateLimit-Reset Unix timestamp when the window resets
X-Cache HIT if served from cache, MISS otherwise
Error Codes
Status Meaning
200 Success
401 Invalid or missing API key
429 Rate limit exceeded. Wait and retry
500 Server error. Check /health
Privacy
Data handling: CostLLM routes requests to third-party AI model providers. We log token counts and metadata, not prompt content. Please do not submit sensitive personal, legal, medical, financial, or confidential business data through the API. Some model providers may process data outside your country depending on the selected route.