SwarmLM docs
Reference for SwarmLM's HTTP JSON endpoints (Pages Functions). Check /api/status first to see
whether this deployment is in stub, local, or paid mode before assuming live billing or provider access.
- Don’t submit secrets, credentials, or sensitive personal information in
task. - API responses are marked
noindexand are not intended for indexing. - Browser requests from other origins are blocked; use same-origin or server-to-server calls.
- Pilot deployments may expose sandbox checkout links while billing and provider rollout are still being finalized.
Need the pricing and rollout overview? See pilot access.
Base URL
https://swarmlm.net
Quickstart
See whether demo/full runs are stub/local/paid on this deployment.
curl -s https://swarmlm.net/api/status
Public endpoint (no auth). Use it to inspect the workflow shape before you buy or configure anything.
curl -X POST https://swarmlm.net/api/swarm-demo \
-H 'Content-Type: application/json' \
-d '{"task":"Design a 7-day onboarding flow for a SaaS product."}'
Use an entitlement token for /api/swarm-run or configure a local model for your deployment.
curl -X POST https://swarmlm.net/api/swarm-run \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"task":"Draft an API spec with error cases."}'
Deployment modes
Returns simulated output. Use this mode to inspect workflow shape, not to judge model quality.
Calls a self-hosted model endpoint when the deployment is configured for local-first runs.
Requires an entitlement token for /api/swarm-run and may use provider routing configured for that deployment.
Local-first quickstart
If you want real runs without sending tasks to a third-party provider, configure a local model endpoint for the deployment. SwarmLM supports local-first runs when the deployment is configured with the variables below.
SWARMLM_DEMO_MODE=local SWARMLM_LOCAL_LLM_URL=https://your-ollama-host SWARMLM_LOCAL_LLM_MODEL=llama3.1:8b-instruct-q4_K_M SWARMLM_LOCAL_LLM_CF_ACCESS_CLIENT_ID=... SWARMLM_LOCAL_LLM_CF_ACCESS_CLIENT_SECRET=...
- Best practice is to expose the local model over
httpsand protect it with authentication. - For demo and full runs, check
/api/statusafter deployment to verify the active mode. - If you need server-side model routing by plan, use the plan-specific local model variables documented in the project README.
Common deployment questions
Does Swarm AI work only online?
Can I test SwarmLM before pilot checkout?
/api/status first, then run /api/swarm-demo. You can inspect the
workflow shape before you buy or configure anything.
What is the difference between stub, local, and paid mode?
/api/swarm-run and may use configured provider routing.
Client examples
const res = await fetch('https://swarmlm.net/api/swarm-demo', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ task: 'Write a launch checklist.' }),
});
const data = await res.json();
console.log(data.mode, data.final);
import json
from urllib import request
payload = json.dumps({"task": "Write a launch checklist."}).encode()
req = request.Request(
"https://swarmlm.net/api/swarm-demo",
data=payload,
headers={"Content-Type": "application/json"},
method="POST",
)
with request.urlopen(req) as res:
data = json.loads(res.read().decode())
print(data["mode"], data["final"])
Authentication
/api/swarm-demo,/api/status, and/api/waitlistdo not require auth./api/swarm-runrequiresAuthorization: Bearer <entitlement_token>.- Admin endpoints require an admin key (disabled unless configured).
Endpoints
GET /api/status
Returns safe booleans/modes only (no secrets, no internal URLs).
curl -s https://swarmlm.net/api/status
POST /api/swarm-demo
Content-Type: application/json
{ "task": "..." }
Max length: 2000 characters.
Default: 3 requests/minute per IP. On 429 responses, respect the Retry-After header.
curl -X POST https://swarmlm.net/api/swarm-demo \
-H 'Content-Type: application/json' \
-d '{"task":"Write a launch checklist for a new product page."}'
Response fields include plan, draft, review, and final, plus
metadata like mode, provider, and model.
POST /api/swarm-run
Content-Type: application/json • Authorization: Bearer <entitlement_token>
{ "task": "...", "provider": "openai|anthropic|xai" }
Max length: 4000 characters. provider is optional and only used in paid mode.
basic: 2/min, 50/day
pro: 6/min, 250/day
enterprise: 20/min, 2000/day
curl -X POST https://swarmlm.net/api/swarm-run \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"task":"Draft an API spec with endpoints + error cases."}'
Returns the same staged fields as the demo endpoint, plus an entitlement object (plan +
expiration).
POST /api/waitlist
Content-Type: application/json
{ "name": "...", "email": "...", "use_case": "..." }
Default: 5 requests/hour per IP.
curl -X POST https://swarmlm.net/api/waitlist \
-H 'Content-Type: application/json' \
-d '{"name":"Ada Lovelace","email":"ada@example.com","use_case":"Turn product requirements into launch plans."}'
POST /api/checkout
Content-Type: application/json
Creates a payment link (card or crypto). This endpoint is only available when checkout is enabled and KV is configured.
On beta deployments, card checkout may open Square sandbox rather than live billing. Confirm the current
deployment mode via GET /api/status before treating checkout as production-ready.
The current public plans mint 30-day entitlements: basic ($19), pro ($79), and
enterprise ($249). Default /api/swarm-run limits are basic
2/min + 50/day, pro 6/min + 250/day, and enterprise
20/min + 2000/day.
{ "email": "...", "plan": "basic|pro|enterprise", "payment_method": "card|crypto" }
{ "success": true, "order_id": "...", "payment_url": "https://..." }
curl -X POST https://swarmlm.net/api/checkout \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com","plan":"pro","payment_method":"card"}'
After payment, the provider redirects back with order and claim query parameters. Use
those values with /api/claim to retrieve your entitlement token.
POST /api/claim
Content-Type: application/json
{ "order_id": "...", "claim_code": "..." }
{ "success": true, "status": "paid", "token": "...", "expires_at": "...", "plan": "..." }
curl -X POST https://swarmlm.net/api/claim \
-H 'Content-Type: application/json' \
-d '{"order_id":"swarm_...","claim_code":"..."}'
Errors and status codes
400: invalid input (missing/too-long task, invalid email, etc.)401/403: missing or invalid auth token415: missingContent-Type: application/json429: rate limit exceeded (checkRetry-After)503: feature not enabled on this deployment (KV, providers, checkout, etc.)