Quickstart
1. Get a key and fund it
Sign in with your wallet in the app, create an API key, then add funds by depositing USDC. Deposits are credited automatically once confirmed. Card payments are coming soon.
2. Point your client at spillway
export OPENAI_BASE_URL=https://api.spillway.now/v1
export OPENAI_API_KEY=sk-spill-...import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.spillway.now/v1", apiKey: process.env.SPILL_KEY });
const stream = await client.chat.completions.create({
model: "claude-sonnet-5-5",
messages: [{ role: "user", content: "Write a haiku about rivers" }],
stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");Anthropic SDK and Claude Code
spillway also speaks the Anthropic Messages format, including streaming, tools and count_tokens.
export ANTHROPIC_BASE_URL=https://api.spillway.now
export ANTHROPIC_API_KEY=sk-spill-...
claude # Claude Code now routes through spillwayEmbeddings
client.embeddings.create(model="text-embedding-3-small", input=["hello", "world"])API reference
POST /v1/chat/completions: OpenAI Chat Completions, streaming supported.POST /v1/messages: Anthropic Messages, streaming supported.POST /v1/messages/count_tokensgives a local estimate.POST /v1/embeddings: OpenAI embeddings.GET /v1/models: models with live, healthy supply.GET /v1/prices: reference price vs best live price per model.GET /v1/requests/:id: the authoritative record for one request (tokens, cost, attempts).
Routing controls
X-Min-Discount: 70only routes to offers at least 70% below list price. It can tighten the key's floor but never loosen it.- Trust mode:
trusted(default) only uses known provider hosts and seller-run endpoints.allalso uses untrusted hosts. - Failover: if an offer errors before sending any bytes, the next cheapest eligible offer is tried, up to 4 attempts.
Cost headers
Non-streamed responses include x-spill-buyer-cost-micro (integer micro-USD) and usage.buyer_cost_micro. For streams, call GET /v1/requests/:id with the x-spill-request-id header value.
Key budgets and customer keys (whitelabel)
Give any key a spending budget in the dashboard. A request is refused with 402 key_budget_exceeded once the next request would go over it. Create a manager key to mint one key per customer from your own backend. Customer keys bill to your account, so you can resell spillway under your own brand.
curl https://api.spillway.now/v1/keys -H "Authorization: Bearer $MANAGER_KEY" \
-d '{"name":"customer-42","budget_usd":25,"min_discount_pct":50}'
# GET /v1/keys · PATCH /v1/keys/:id {budget_usd, reset_spend} · DELETE /v1/keys/:idx402: pay per request without an account
Agents can call the gateway with no API key. The first call returns 402 with x402 payment requirements (scheme exact; available when the deposit chain supports EIP-3009 USDC, such as Base). The client signs an EIP-3009 authorization and retries with an X-PAYMENT header. We settle it on-chain, serve the request, and return the transaction in X-PAYMENT-RESPONSE. If you pay more than the request costs, the difference stays in that wallet's withdrawable balance. Sign in with the same wallet to see or withdraw it.
Any standard x402 client library works (for example x402-fetch or x402-axios).
Rate limits
- 1,200 requests per minute per API key (
x-ratelimit-*headers on every response). - 6,000 requests per 5 minutes per source IP.
Errors
402 insufficient_balance: top up or deposit.404 no_sellers_for_model: no healthy offer under your filters.404 minimum_discount_not_met: the message names the best discount available.503 upstream_unavailable: every attempted offer failed.
Selling
In Sell capacity, choose the API format your endpoint speaks (OpenAI Chat Completions or Anthropic Messages), then add the endpoint (your own vLLM/SGLang server, or capacity you are authorized to resell), set a discount and a daily cap. Every new offer gets a live probe (16 output tokens). Earnings accrue per request and are paid in USDC once you reach $5 or after 72 hours, whichever comes first. You can also trigger a payout yourself.
Use a dedicated key with provider-side spend limits. You are responsible for complying with your upstream provider's terms.