Get early access Open the demo

SDKs

The fastest migration is no migration: point the OpenAI SDK you already use at Swurl and change the key.

Use your existing SDK

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.SWURL_API_KEY,
  baseURL: "https://api.swurl.ai/v1",
});

const res = await client.chat.completions.create({
  model: "auto",
  messages: [{ role: "user", content: "Explain this stack trace." }],
});

Everything in the chat completions surface works. Swurl-specific options ride along in the swurl field, which the OpenAI SDKs pass through untouched.

TypeScript

npm install @swurl/sdk
import { Swurl } from "@swurl/sdk";

const swurl = new Swurl({ apiKey: process.env.SWURL_API_KEY });

// Route automatically, with a per-call budget ceiling
const { text, route } = await swurl.chat({
  messages: [{ role: "user", content: "Draft a release note for 2.4." }],
  route: "balanced",
  budgetCents: 5,
});

console.log(route.model, route.costCents);

// Compare models in parallel
const results = await swurl.compare({
  models: ["gpt-5.2", "claude-opus-4.5", "gemini-3-pro"],
  messages: [{ role: "user", content: "Three likely causes of this churn spike?" }],
});

Python

pip install swurl
from swurl import Swurl

swurl = Swurl()  # reads SWURL_API_KEY

reply = swurl.chat(
    messages=[{"role": "user", "content": "Summarise this filing."}],
    route="conservative",
    require_zero_retention=True,
)
print(reply.text, reply.route.model, reply.route.cost_cents)

for chunk in swurl.stream(messages=[...]):
    print(chunk.text, end="")

Go

go get github.com/swurlai/swurl-go
client := swurl.New(os.Getenv("SWURL_API_KEY"))

reply, err := client.Chat(ctx, swurl.ChatRequest{
    Messages: []swurl.Message{{Role: "user", Content: "Rewrite this changelog entry."}},
    Route:    swurl.RouteBalanced,
})

Ruby

gem install swurl
swurl = Swurl::Client.new(api_key: ENV["SWURL_API_KEY"])

reply = swurl.chat(
  messages: [{ role: "user", content: "Tidy this migration script." }],
  route: "balanced"
)

Edge runtimes

All clients are built on fetch with no Node-specific dependencies, so they run unchanged on Cloudflare Workers, Deno Deploy and Vercel Edge. Streaming uses the standard ReadableStream.

Keys stay on the serverEdge runtimes are servers, but a browser bundle is not. Never put a Swurl key in client-side code — proxy through a route you control.