Integration

Use CloudSwap from Python

POST a job spec as JSON to https://cloudswap.ai/api/quote and read choice from the answer. The standard library is enough; no SDK is needed and quotes need no key.

Quote a job (standard library)

Prints the cheapest fit: provider, region, CloudSwap price per hour and per run.

quote.py
import json
import urllib.request

spec = {"vcpus": 16, "mem_gb": 32, "hours": 2, "regions": ["eu"], "spot_ok": True}
req = urllib.request.Request(
    "https://cloudswap.ai/api/quote",
    data=json.dumps(spec).encode(),
    headers={"content-type": "application/json"},
)
with urllib.request.urlopen(req) as r:
    q = json.load(r)

c = q["choice"]
print(c["provider"], c["region"], c["price_hr"], c["job_cost_usd"])

With requests and your key

The key raises your limit to 120 quotes a minute.

quote_key.py
import os
import requests

r = requests.post(
    "https://cloudswap.ai/api/quote",
    json={"vcpus": 8, "mem_gb": 32, "gpu_type": "L40S", "gpu_count": 1, "hours": 2},
    headers={"Authorization": "Bearer " + os.environ["CLOUDSWAP_API_KEY"]},
    timeout=30,
)
r.raise_for_status()
for o in r.json()["ranked"]:
    print(o["provider"], o["sku"], o["price_hr"], o["job_cost_usd"])

Read the price board

8 job shapes, cheapest offer per provider, refreshed every 15 minutes.

board.py
import json
import urllib.request

with urllib.request.urlopen("https://cloudswap.ai/api/board") as r:
    board = json.load(r)

for cat in board["categories"]:
    if cat["offers"]:
        o = cat["offers"][0]
        print(cat["label"], o["provider"], o["price_hr"])

Tools on the server

4 tools
ToolWhat it doesNeeds a key
quote_jobPrices a stateless job on every provider; returns the cheapest fit with its cost per run and the next best offers. Places nothing.No
list_providersLists the providers CloudSwap prices.No
run_jobRuns a stateless container job on the cheapest fitting machine, paid from prepaid credits. Not open to everyone yet.Yes
get_jobState, price, wall time and log tail of one of your jobs.Yes

API keys

A key is optional for quotes. With one you get 120 quotes a minute instead of 30, and usage history. Keys start with cs_live_. Get an API key.

Other ways in

Install the MCP

One line in Claude Code. Quotes are free today and need no sign-up.

Get an API keyRead the docs

Claude Code
claude mcp add --transport http cloudswap https://cloudswap.ai/mcp