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
POST /v2/chat/completions

Send messages to any Swarm model. Drop-in replacement for OpenAI's chat completions endpoint.

Auth: Required (API key)
ParameterTypeDescription
modelstringModel ID — atlas-9b, resolve-27b
messagesarrayArray of message objects with role and content
max_tokensintegerMaximum tokens to generate (default: 2048)
temperaturefloatSampling 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);
GET /v2/models

List available models. Returns which models are currently online.

Auth: Not required

Available Models

Model IDDomainStatus
atlas-9bCRE / Capital Marketschecking...
resolve-27bCredit & Legalcoming to API
capital-27bGrants & Fundingtraining

Datasets API

GET /v2/data/preview?domain={domain}&limit={n}

Preview sample pairs from any domain. Returns actual training data inline.

Auth: Required
ParameterTypeDescription
domainstringcre, medical, legal, grants, aviation, finance, marketing, junior, curator, failure
limitintegerNumber of samples (1-10, default 5)
GET /api/data/sample?domain={domain}

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 }
GET /api/data/catalog

List all available domains with pair counts and quality scores.

Auth: Not required
GET /v2/account

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 }] }
GET /v2/health

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

CodeMeaningWhat to do
400Bad RequestCheck request body and parameters
401UnauthorizedInvalid or missing API key
403ForbiddenNo active subscription or trial expired
429Rate LimitedSlow down — check X-RateLimit headers
502Model UnavailableModel is temporarily offline — retry in a moment
// Error response format { "error": "No active subscription or trial. Visit swarmandbee.ai/pricing" }

Rate Limits

TierRequests/minRequests/day
Trial10100
Subscribed605,000
Enterprise300Unlimited

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.

LanguageSDKConfig
Pythonopenaibase_url="https://api.swarmandbee.ai/v2"
JavaScriptopenaibaseURL: "https://api.swarmandbee.ai/v2"
cURLDirect HTTP calls
AnyAny OpenAI SDKChange 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.

Contact Support Discord LinkedIn GitHub X (DM)