SwarmDoGPU API
A REST/JSON API for renting GPUs across providers behind one masked catalog. Everything the dashboard, CLI, SDK and MCP server do is this API. Base URL:
All request/response bodies are JSON. The backing provider (Vast, RunPod, partner hosts…) is never exposed to customers — offers, endpoints and instances are masked.
Authentication
Most endpoints require an authenticated account. Two credentials work interchangeably on data endpoints:
State-changing requests made with a session cookie are CSRF-checked (Origin must match Host); Bearer-key requests are exempt. Create/manage keys under Dashboard → Keys.
Errors & rate limits
Errors return the matching HTTP status with a JSON body { "error": "message" }. Common: 400 validation, 401 not signed in, 402 insufficient credit, 404 not found, 409 spend-cap/margin, 429 rate-limited, 502 upstream provider error. Auth, provisioning and payment routes are rate-limited per IP/action.
Catalog · 🌐 public
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/offers | 🌐 | Masked GPU catalog. Query: gpuClass, region, maxUsdPerHr, minGpuRamGb, interruptible, sort. Returns offers + facets. |
| GET | /api/models | 🌐 | One-click deployable model catalog. |
| GET | /api/serverless/offers | 🌐 | Serverless GPU endpoint pricing. |
| GET | /api/storage/offers | 🌐 | Persistent-volume tiers & prices. |
| GET | /api/sla/tiers | 🌐 | Reliability tiers + uptime-credit terms. |
| GET | /api/reservations/plans | 🌐 | Committed-use savings plans. |
| GET | /api/trust | 🌐 | Anonymized fleet hardware-attestation trust. |
| GET | /api/health | 🌐 | Liveness probe. |
Accounts & auth · 🌐/🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/auth/config | 🌐 | Which sign-in methods are enabled. |
| POST | /api/auth/register | 🌐 | Create an account. Body { email, password }. |
| POST | /api/auth/login | 🌐 | Sign in. Body { email, password, code? } (2FA code if enabled). |
| GET | /api/auth/google | 🌐 | Start Google SSO (redirect). |
| POST | /api/auth/logout | 🔑 | End the current session. |
| GET | /api/auth/me | 🔑 | The authenticated account. |
| POST | /api/auth/change-password | 🔑 | Rotate password. |
| POST | /api/auth/2fa/setup · /enable · /disable | 🔑 | TOTP two-factor lifecycle. |
| POST | /api/auth/request-password-reset · /reset-password · /verify-email | 🌐 | Email-based recovery & verification. |
Rentals
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/rentals | 🔑 | Rent a GPU. Body { sku, maxSpendCents?, image?, sshPublicKey?, failover? }. |
| GET | /api/rentals | 🔑 | Your rentals. |
| GET | /api/rentals/{id} | 🔑 | Live status + masked endpoints. |
| POST | /api/rentals/{id}/terminate | 🔑 | Stop the instance. |
| GET | /api/rentals/{id}/invoice | 🔑 | Final invoice. |
| POST | /api/rentals/{id}/checkpoints · /migrate | 🔑 | Snapshot a workload / migrate it to a fresh instance. |
| POST | /api/rentals/{id}/rating | 🔑 | Rate a finished rental. |
Telemetry & alerts · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/rentals/{id}/telemetry | 🔑 | Time-series GPU metrics (query window, points). |
| GET | /api/rentals/{id}/telemetry/latest | 🔑 | Latest sample. |
| POST | /api/rentals/{id}/telemetry | 🔑 | Ingest a live sample (in-instance agent). |
| POST | /api/rentals/{id}/telemetry/simulate | 🔑 | Backfill a demo series. |
| GET POST | /api/alerts | 🔑 | List / create threshold alert rules. |
| PATCH DEL | /api/alerts/{id} | 🔑 | Update / delete a rule. |
Idle detection & auto-stop · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/idle | 🔑 | Policy + per-instance idle assessment. |
| PUT | /api/idle/policy | 🔑 | Set threshold / minutes / action (notify·stop·hibernate). |
| POST | /api/idle/sweep | 🔑 | Enforce the policy on idle instances now. |
Billing · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/billing/summary | 🔑 | Balance, burn rate, runway. |
| GET | /api/billing/config | 🌐 | Whether card top-ups are enabled + limits. |
| GET | /api/billing/transactions · /daily | 🔑 | Ledger history & daily charges. |
| GET PUT | /api/billing/budget | 🔑 | Monthly budget + forecast. |
| GET PUT | /api/billing/auto-topup | 🔑 | Automatic top-up. GET returns the rule, the card on file (brand + last four) and blocked when it cannot run. PUT saves { enabled, thresholdCents, amountCents }: when the balance drops below the threshold, the amount is charged to the card on file and credited. Bounded by a 15-minute cooldown, six charges a day, and three consecutive failures (then the rule switches itself off and you are notified). |
| POST | /api/billing/topup | 🔑 | Pass saveCard: true to keep the card for automatic top-ups. Start a Stripe Checkout top-up; returns the hosted URL. |
| POST | /api/billing/webhook | 🌐* | Stripe webhook (signature-verified). Credits the ledger. |
SLA · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET PUT | /api/sla | 🔑 | Status (uptime vs target) / choose a tier. |
| POST | /api/sla/settle | 🔑 | Settle the period — auto-credit on breach. |
| POST | /api/sla/simulate-outage | 🔑 | Record a demo outage. |
Reserved capacity · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST | /api/reservations | 🔑 | List / reserve committed capacity under a savings plan. |
| POST | /api/reservations/{id}/cancel | 🔑 | Cancel a reservation. |
Storage & datasets · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST | /api/storage/volumes | 🔑 | List / create persistent volumes. |
| GET DEL | /api/storage/volumes/{id} | 🔑 | Get / delete a volume. |
| GET POST | /api/datasets | 🔑 | List / create portable datasets. |
| POST | /api/datasets/{id}/attach · /detach | 🔑 | Mount/unmount a dataset on a rental. |
Serverless & models · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST | /api/serverless/endpoints | 🔑 | List / deploy autoscaling GPU endpoints. Deploy body { name, gpuClass: RTX4090|L40S|A100|H100, image, region: us-east|us-west|eu-west, minWorkers (0 = scale-to-zero), maxWorkers }. Optional: env (container vars), diskGb, keepWarm (a worker stays ready 24/7, billed per reserved GPU-second on top of usage), prebakedModelId (fast cold start), startCmd — your image's own start command, which also turns on container log forwarding (see below). |
| GET DEL | /api/serverless/endpoints/{id} | 🔑 | Get / delete (remove). Lifecycle: POST /scale { minWorkers, maxWorkers }, POST /suspend (pause + release hold), POST /resume (restart). GET /status — live diagnostics: masked job/worker counts plus a derived state (serving / starting / stuck / throttled / failing / idle) so you can see why an endpoint isn't responding. |
| POST | /api/models/{id}/deploy · /prewarm | 🔑 | One-click deploy or prewarm a catalog model. |
| GET | /api/managed/models | — | Managed models — fully hosted, nothing to rent or deploy. Returns each model's id, modality, billing unit and usdPerUnit (language models also return usdPerUnitInput, per million tokens). Video models list clipSeconds, the only duration values accepted — anything else is refused with a 400 rather than billed at a guess, and an unstated duration is pinned to the model's default. Models priced by a request field return pricingTiers (e.g. size: 480p / 720p); that field is required. |
| POST | /api/managed/{id}/{path} | 🔑 | Call a managed model. {path} is the model's own sub-path — openai/v1/chat/completions for an OpenAI-compatible language model, run or runsync for the job API. The response is passed through verbatim; the charge for the call is returned in x-swarmdo-charged-cents. |
| GET | /api/managed/{id}/status/{jobId} | 🔑 | Poll a job that outlived its call (run, or a runsync that returned IN_PROGRESS). Only the account that submitted the job can read it. The first completed read settles the bill against what the provider actually generated — x-swarmdo-charged-cents carries the difference (negative when refunded), and a failed job is refunded in full. |
Invoking an endpoint. Send inference to the masked URL returned at deploy — https://gpu.swarmdo.com/run/<id>/<path> — authenticating with your swdo_ API key as a Bearer token. The gateway routes to the backing GPU provider (chosen for lowest cost, kept hidden) and meters usage. RunPod-backed endpoints accept the job path /runsync (body { "input": { … } }) and the OpenAI-compatible base /openai/v1 (e.g. use https://gpu.swarmdo.com/run/<id>/openai/v1 as your OpenAI base URL).
Managed models vs. serverless. Deploy a serverless endpoint when you need your own image, your own weights, or control over autoscaling — you pay per GPU-second the workers are active. Use a managed model when you just want inference: there is no endpoint, no worker, no cold start and no idle cost, and you are billed per unit of work (tokens for language models, seconds for video, per request otherwise). Billing is per successful call only — a failed call costs nothing. One practical note for reasoning models: their thinking counts as output tokens, so a small max_tokens can be consumed entirely by reasoning and return empty content — give them headroom. Both are masked identically: you never see which provider is behind either.
Debugging an endpoint. GET /api/serverless/endpoints/{id}/logs?limit=N returns recent masked lines (newest first) — every invoke the gateway handled, plus anything the container pushed. Remediation without leaving the platform: POST /{id}/purge-queue drops a wedged backlog, POST /{id}/restart bounces the workers. To get the container's own output — the stdout/stderr of your model server, which is where a failed load actually prints — pass startCmd at deploy (e.g. "python -u handler.py"): we run it wrapped so its output is streamed to your log endpoint as well as the console. It's opt-in because we won't override your image's start command uninvited, and it needs your real one. If the forwarder can't run or can't reach us, your worker is unaffected — it keeps serving and logging locally.
Custom domain (admin only). Map your own hostname to an endpoint so callers use https://api.yourco.com/… instead of the /run/<id> path. POST /api/serverless/endpoints/{id}/domains { domain } returns the DNS to publish (a CNAME to the platform host + a _swarmdo-verify TXT); POST /api/serverless/domains/{domId}/verify checks the TXT and activates it; DELETE /api/serverless/domains/{domId} removes it. Once active, requests arriving on that Host route straight to the endpoint (masked).
Builds — from GitHub · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST | /api/builds | 🔑 | List / start a build. Body { repoUrl (https://github.com/org/repo), ref?, dockerfilePath?, contextDir? } — builds a container image from the repo's Dockerfile. |
| GET | /api/builds/{id} | 🔑 | Get a build's status + resulting image ref. |
| POST | /api/builds/{id}/sync | 🔑 | Poll the backing builder and refresh the build's status. |
On success the build's imageRef can be deployed straight to a serverless endpoint (POST /api/serverless/endpoints with that image). The backing builder is masked behind the platform.
Jobs & cache · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST | /api/jobs | 🔑 | List / submit batch jobs; /api/jobs/{id}, /{id}/cancel. |
| GET POST | /api/cache | 🔑 | Fleet image/model-weight cache + prewarm. |
Squads (teams) · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST | /api/teams | 🔑 | List / create squads (pooled-credit cost centers). |
| GET | /api/teams/{id} (+ members, contribute, allocate) | 🔑 | Manage roster & shared credit. |
Keys · secrets · account · 🔑
| Method | Path | Auth | Description |
|---|---|---|---|
| GET POST DEL | /api/keys · /api/keys/{id} | 🔑 | List / create / revoke API keys. |
| GET DEL | /api/sessions · /api/sessions/{id} | 🔑 | Active sessions & revocation. |
| GET POST DEL | /api/secrets · /api/secrets/{key} | 🔑 | Encrypted per-account env-var vault. |
| GET POST | /api/notifications · /read | 🔑 | In-app feed + mark read. |
| GET | /api/account · /api/audit · /api/referrals | 🔑 | Profile, your activity log, affiliate referrals. |
Host / supplier API · 🏷️
Independent providers list GPUs for resale. Authenticate with a supplier key (returned once at registration).
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/suppliers/register | 🌐 | Onboard a supplier; returns the API key once. |
| GET POST | /api/suppliers/listings | 🏷️ | List / create GPU listings (+ /{id} PUT). |
| GET POST | /api/suppliers/attestations | 🏷️ | Submit hardware attestation (GPU/VRAM/benchmark) + history. |
| POST | /api/host/register, GET /api/host | 🔑 | P2P host — a logged-in user rents out their own GPU. |
Operator · ⚙️
Admin-only, under /api/admin/*. Accepts an admin-role session or the x-admin-token. The operator console (/admin) is the UI for these — including toggling upstream providers on/off, markup rules, user management, provider reputation, host attestation, and user impersonation.
| Method | Path | Description |
|---|---|---|
| GET | /api/admin/dashboard · /audit · /users · /suppliers · /attestations | Operational views (margins, catalog, rentals, users, suppliers). |
| GET PUT | /api/admin/markup · /providers · /flags | Tune markup, toggle upstream providers, global kill-switches. |
| POST | /api/admin/impersonate · /attestations/simulate · /sla/incident | View-as-user, record attestations / SLA incidents. |
Client libraries — SDK · CLI · MCP
Status: the TypeScript SDK (@swarmdo/gpu-sdk) and the MCP server (@swarmdo/gpu-mcp) are both published on npm. The @swarmdogpu/cli lives in the repo and isn't published yet — run it from the monorepo, or use the REST API directly (every example above).
TypeScript SDK
CLI
MCP server (Claude Code / Desktop)
41 tools: catalog search and rentals, serverless deploy/scale/suspend/invoke, and the full diagnostic set — serverless_status, serverless_logs, serverless_purge_queue, serverless_restart — so an agent can resolve a stuck endpoint without you opening a provider console.
SwarmDoGPU API reference · base https://gpu.swarmdo.com · manage keys in the dashboard.