Quickstart¶
This guide takes you from zero to your first model response. It should take about five minutes.
1. Get an API key¶
Sign in to your Blaick account, then create an API key from the dashboard — or with the API itself once you have a session token (see Authentication).
An API key looks like this:
Save it now
The full key is shown only once, at creation time. Store it somewhere safe (a secret manager, not your source code). If you lose it, revoke it and create a new one.
Set it as an environment variable so the examples below work as-is:
2. List the models you can use¶
Every model has an id (a UUID) that you pass to the chat endpoint. Fetch the catalog:
Pick a model id from the response. See Models for how to choose.
3. Send your first message¶
import os
import requests
BASE = "https://api.blaick.ai/api/v1"
headers = {"Authorization": f"Bearer {os.environ['BLAICK_API_KEY']}"}
resp = requests.post(
f"{BASE}/chat/completions",
headers=headers,
json={
"model_id": "PASTE_A_MODEL_ID",
"messages": [
{"role": "user", "content": "Say hello in one sentence."}
],
},
)
resp.raise_for_status()
data = resp.json()
print(data["content"])
print("Cost:", data["usage"]["cost_tokens"], "tokens")
const BASE = "https://api.blaick.ai/api/v1";
const resp = await fetch(`${BASE}/chat/completions`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BLAICK_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model_id: "PASTE_A_MODEL_ID",
messages: [{ role: "user", content: "Say hello in one sentence." }],
}),
});
const data = await resp.json();
console.log(data.content);
console.log("Cost:", data.usage.cost_tokens, "tokens");
A successful response looks like:
{
"id": "c0ffee00-0000-4000-8000-000000000000",
"conversation_id": "11111111-2222-4333-8444-555555555555",
"model_id": "claude-sonnet-4-20250514",
"content": "Hello — it's great to meet you!",
"usage": {
"input_tokens": 12,
"output_tokens": 9,
"total_tokens": 21,
"cost_tokens": 42
},
"created_at": "2026-08-04T10:00:00Z"
}
That's it — you've made your first request, and usage.cost_tokens tells you exactly what it cost.
4. Turn on streaming¶
For a chat-like experience, stream the response token by token by adding "stream": true. The response becomes a Server-Sent Events stream:
curl -N https://api.blaick.ai/api/v1/chat/completions \
-H "Authorization: Bearer $BLAICK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_id": "PASTE_A_MODEL_ID",
"messages": [{"role": "user", "content": "Write a haiku about the sea."}],
"stream": true
}'
You'll receive a series of data: events:
data: {"type": "delta", "content": "Salt"}
data: {"type": "delta", "content": " wind"}
data: {"type": "usage", "input_tokens": 14, "output_tokens": 17, "total_tokens": 31, "cost_tokens": 62}
data: {"type": "done", "auto_routed": false, "routing_reason": null, "routing_task_type": null}
See Streaming Responses for how to parse these properly.
Where to go next¶
- Authentication — JWT vs. API keys, and managing keys programmatically.
- Chat Completions — every request parameter explained.
- Errors & Rate Limits — what to handle and how to back off.