Reference

API Documentation

BLUN exposes an OpenAI-compatible shape. If your code already speaks chat/completions, it already speaks BLUN.

Authentication

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.

Base URL

https://api.blun.ai

Chat completions

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
  }'

Streaming

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"}]}'

Agents

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."}'

Models

GET /v1/models returns models available to your tier.

Keys

Usage

GET /v1/usage returns counts for the current calendar month, grouped by day and endpoint.

Rate limits

Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. 429 means back off until reset.

Errors

{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key."
  }
}

Changelog