Authentication
All API requests require your API key. Find it on the API Keys page.
Pass your key in either header:
# Bearer token (recommended)
Authorization: Bearer sb_live_your_key_here
# Or X-API-Key header
X-API-Key: sb_live_your_key_here
Base URL for all endpoints:
https://api.swarmandbee.ai
Send messages to any Swarm model. Drop-in replacement for OpenAI's chat completions endpoint.
Auth: Required (API key)
| Parameter | Type | Description |
| model | string | Model ID — atlas-9b, resolve-27b |
| messages | array | Array of message objects with role and content |
| max_tokens | integer | Maximum tokens to generate (default: 2048) |
| temperature | float | Sampling temperature 0-2 (default: 0.7) |
Python (OpenAI SDK)
copy# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.swarmandbee.ai/v2",
api_key="sb_live_your_key",
)
response = client.chat.completions.create(
model="atlas-9b",
messages=[
{"role": "user", "content": "Underwrite this deal: 120K SF cold storage in Dallas, $28M, 6.8% cap"}
]
)
print(response.choices[0].message.content)
cURL
copycurl -X POST https://api.swarmandbee.ai/v2/chat/completions \
-H "Authorization: Bearer sb_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "atlas-9b",
"messages": [{"role":"user","content":"What is DSCR in commercial real estate?"}]
}'
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "atlas-9b",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "DSCR stands for Debt Service Coverage Ratio..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 186,
"total_tokens": 228
}
}
JavaScript (fetch)
copyconst response = await fetch("https://api.swarmandbee.ai/v2/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer sb_live_your_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "atlas-9b",
messages: [{ role: "user", content: "Analyze this deal..." }],
}),
});
const data = await response.json();
console.log(data.choices[0].message.content);
List available models. Returns which models are currently online.
Auth: Not required
Available Models
| Model ID | Domain | Status |
| atlas-9b | CRE / Capital Markets | checking... |
| resolve-27b | Credit & Legal | coming to API |
| capital-27b | Grants & Funding | training |
Datasets API
Preview sample pairs from any domain. Returns actual training data inline.
Auth: Required
| Parameter | Type | Description |
| domain | string | cre, medical, legal, grants, aviation, finance, marketing, junior, curator, failure |
| limit | integer | Number of samples (1-10, default 5) |
Get a presigned download URL for a domain's full dataset. Free samples available.
Auth: Not required for free tier
{
"ok": true,
"domain": "cre",
"download_url": "https://swarm-honey.nyc3.digitaloceanspaces.com/cre/...",
"expires_in": 3600
}
List all available domains with pair counts and quality scores.
Auth: Not required
Get your profile, active subscriptions, and 30-day usage statistics.
Auth: Required
{
"ok": true,
"user": { "email": "you@company.com", "tier": "free" },
"subscriptions": [{ "product": "atlas", "status": "trial", "trial_end": "2026-03-30" }],
"usage": [{ "endpoint": "/v2/chat/completions", "calls": 142 }]
}
System status. Check database connectivity and which models are online.
Auth: Not required
{
"status": "ok",
"service": "swarm-ccir-api",
"db_connected": true,
"models_online": ["atlas-9b"],
"products": ["atlas", "resolve", "datasets"]
}
Error Codes
| Code | Meaning | What to do |
| 400 | Bad Request | Check request body and parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | No active subscription or trial expired |
| 429 | Rate Limited | Slow down — check X-RateLimit headers |
| 502 | Model Unavailable | Model is temporarily offline — retry in a moment |
// Error response format
{
"error": "No active subscription or trial. Visit swarmandbee.ai/pricing"
}
Rate Limits
| Tier | Requests/min | Requests/day |
| Trial | 10 | 100 |
| Subscribed | 60 | 5,000 |
| Enterprise | 300 | Unlimited |
Rate limit headers are included in every response:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1711360000
SDK Compatibility
Swarm & Bee uses the OpenAI-compatible API format. Any SDK that works with OpenAI works with us — just change the base URL.
| Language | SDK | Config |
| Python | openai | base_url="https://api.swarmandbee.ai/v2" |
| JavaScript | openai | baseURL: "https://api.swarmandbee.ai/v2" |
| cURL | — | Direct HTTP calls |
| Any | Any OpenAI SDK | Change base URL + use your sb_live_ key |
Node.js
copy// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.swarmandbee.ai/v2",
apiKey: "sb_live_your_key",
});
const response = await client.chat.completions.create({
model: "atlas-9b",
messages: [{ role: "user", content: "Analyze this deal..." }],
});
Need help?
API questions, integration support, custom enterprise plans.