BLUN exposes an OpenAI-compatible shape. If your code already speaks chat/completions, it already speaks BLUN.
Every request needs a Bearer token in the Authorization header.
Authorization: Bearer blun_sk_...
Create keys at /dashboard. Keys are shown exactly once — store immediately.
https://api.blun.ai
POST /v1/chat/completions — OpenAI-compatible.
curl https://api.blun.ai/v1/chat/completions \ -H "Authorization: Bearer blun_sk_..." \ -H "Content-Type: application/json" \ -d '{ "model": "king-1.0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain BLUN in one sentence."} ], "max_tokens": 256, "temperature": 0.7 }'
Set "stream": true. Response is Server-Sent Events, each data: line a chunk delta.
curl -N https://api.blun.ai/v1/chat/completions \ -H "Authorization: Bearer blun_sk_..." \ -H "Content-Type: application/json" \ -d '{"model":"king-1.0","stream":true,"messages":[{"role":"user","content":"hi"}]}'
POST /v1/agents/run — agent turn with tool-use.
curl https://api.blun.ai/v1/agents/run \ -H "Authorization: Bearer blun_sk_..." \ -H "Content-Type: application/json" \ -d '{"model":"king-1.0","input":"Summarize the latest news on EU AI Act."}'
GET /v1/models returns models available to your tier.
GET /v1/keys — list your keys (masked)POST /v1/keys — create a key, returned once in fullDELETE /v1/keys/:id — revoke a keyGET /v1/usage returns counts for the current calendar month, grouped by day and endpoint.
Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. 429 means back off until reset.
{
"error": {
"type": "authentication_error",
"message": "Invalid API key."
}
}