Skip to main content
Getting startedBuyer quickstart

Buyer Quickstart

Get the cheapest AI inference in under 2 minutes.

From nothing to a first response
  1. Sign inWallet or SIWE
  2. Mint a keyinf_… shown once
  3. FundCard or USDC on Base
  4. RequestSwap the base URL
Card and prefunded USDC go straight from the key to the request.

1. Sign In

Go to surplusintelligence.ai and sign in with Twitter, Discord, or wallet connect. Privy automatically creates a wallet if you don't have one.

2. Get Your API Key

After signing in, your API key appears on the Buy page. Copy it — it looks like inf_abc123....

You can create up to 25 keys with labels (e.g. "Cursor", "Aider", "CI"):

bash
POST /v1/buyer/keys
{ "label": "Cursor" }

3. Fund Your Account

Top up with a card, or deposit USDC on Base. Card credit is spendable only; deposited USDC is spendable and withdrawable.

To deposit, you first need USDC on Base. Options:

  • MoonPay (via Privy) — buy USDC with a card directly from the app
  • Peer (ZKP2P) — pay with Venmo, Wise, Zelle and more through the Peer browser extension
  • Bridge from another chain — if you already have USDC elsewhere

Then send it to your deposit address on Buy › Funding › Crypto. See Wallet Funding for details.

4. Make a Request

bash
curl $SURPLUS_BASE_URL/chat/completions \
  -H "Authorization: Bearer inf_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4.6",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

That's it. The marketplace routes to the cheapest healthy seller, streams the response, and draws the cost from your balance automatically.

Use with Your Tools

Cursor:

API Base URL: $SURPLUS_BASE_URL
API Key: inf_your_key_here
Model: claude-opus-4.6

Python (OpenAI SDK):

python
from openai import OpenAI

client = OpenAI(
    api_key="inf_your_key_here",
    base_url="$SURPLUS_BASE_URL"
)

response = client.chat.completions.create(
    model="claude-opus-4.6",
    messages=[{"role": "user", "content": "Hello!"}]
)

Works with any OpenAI-compatible tool — just change the base URL and API key.

Programmatic Setup (No Browser)

Everything above can be done without touching the website. All you need is a wallet with a private key, and USDC on Base to deposit.

Reference

API Base URLValue · https://api.surplusintelligence.ai
OpenAI-compatible baseValue · https://api.surplusintelligence.ai/v1
NetworkValue · Base (Chain ID: 8453)
USDC contractValue · 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals)
Buyer key prefixValue · inf_
Max keys per walletValue · 25
Auth headerValue · Authorization: Bearer inf_xxx

How charging works: your balance is drawn down per request, after the response completes — the final cost depends on actual usage, so it cannot be known before then.

1. Get Your API Key (SIWE)

Request a challenge, sign it, get a persistent inf_ key:

bash
# Get SIWE challenge
CHALLENGE=$(curl -s "$SURPLUS_BASE_URL/buyer/auth/challenge?address=0xYourWallet")
# Returns a SIWE message + nonce

# Sign the SIWE message with your wallet, then exchange for a key
curl -X POST $SURPLUS_BASE_URL/buyer/auth/keys \
  -H "Content-Type: application/json" \
  -d '{"message": "<SIWE message from challenge>", "signature": "0x..."}'
# Returns: { "key": "inf_abc123...", "id": "...", "wallet": "0x...", "created_at": ... }
# Save this key — it will not be shown again.

Python (viem/web3):

python
from web3 import Web3
import requests

BASE = "https://api.surplusintelligence.ai"

# 1. Get challenge
resp = requests.get(f"{BASE}/v1/buyer/auth/challenge?address={wallet_address}")
challenge = resp.json()

# 2. Sign the SIWE message
signed = w3.eth.account.sign_message(
    encode_defunct(text=challenge["message"]),
    private_key=YOUR_KEY
)

# 3. Exchange for API key
resp = requests.post(f"{BASE}/v1/buyer/auth/keys", json={
    "message": challenge["message"],
    "signature": signed.signature.hex()
})
api_key = resp.json()["key"]  # inf_xxx — the field is `key`, not `api_key`

2. Check Balance

bash
curl $SURPLUS_BASE_URL/buyer/me \
  -H "Authorization: Bearer inf_your_key"
# Returns: credit_balance_usdc (your prepaid spendable balance), and more
# credit_balance_usdc is your whole prepaid spendable balance: fiat credit + deposited USDC,
# the same figure /v1/payments/balance reports.

4. Browse Models & Prices

bash
# All available models
curl .../v1/models -H "Authorization: Bearer inf_xxx"

# Best prices per model
curl .../v1/prices -H "Authorization: Bearer inf_xxx"

# Full orderbook for a specific model
curl .../api/markets/claude-opus-4.6

5. Make Requests

bash
# Text (streaming)
curl .../v1/chat/completions \
  -H "Authorization: Bearer inf_xxx" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-opus-4.6", "messages": [{"role": "user", "content": "Hello!"}], "stream": true}'

# Images
curl .../v1/images/generations \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"model": "venice-flux-1.1-pro", "prompt": "a cat in space"}'

# Video (async — poll for result)
JOB=$(curl -s -X POST .../v1/video/generations \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"model": "venice-runway-gen4-5-text", "prompt": "ocean waves"}')
# Poll: GET .../v1/video/generations/{id}
# Download (authenticated, follow redirects):
#   curl -L -H "Authorization: Bearer inf_xxx" .../v1/media/artifacts/{jobId}/{index} -o out.mp4

# Music (async — same pattern as video)
curl -X POST .../v1/music/generations \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"model": "venice-ace-step-15", "prompt": "lo-fi beats"}'

# TTS
curl .../v1/audio/speech \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"model": "venice-tts-1", "input": "Hello world", "voice": "alloy"}'

# STT (max 25MB, formats: wav, mp3, mp4, m4a, ogg, webm, flac)
curl .../v1/audio/transcriptions \
  -H "Authorization: Bearer inf_xxx" \
  -F file=@audio.mp3 -F model=venice-whisper-1

# Embeddings
curl .../v1/embeddings \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"model": "venice-embed-1", "input": "Hello world"}'

5. Monitor Usage & Savings

bash
# Balance, spending, per-model breakdown, recent requests (includes savings per request)
curl .../v1/buyer/me -H "Authorization: Bearer inf_xxx"
# Recent rows include: cost_usd, direct_cost_usd, saved_usd

# All-time savings vs direct provider pricing
curl .../v1/buyer/savings -H "Authorization: Bearer inf_xxx"

# Daily or weekly savings breakdown
curl ".../v1/buyer/savings?period=daily" -H "Authorization: Bearer inf_xxx"
curl ".../v1/buyer/savings?period=weekly" -H "Authorization: Bearer inf_xxx"

# Export usage as CSV
curl ".../v1/buyer/usage/export?format=csv&from=2026-01-01" \
  -H "Authorization: Bearer inf_xxx"

6. Manage Keys

bash
# List all your keys
curl .../v1/buyer/keys -H "Authorization: Bearer inf_xxx"

# Create another key with a label
curl -X POST .../v1/buyer/keys \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"label": "production-server"}'

# Revoke a key
curl -X DELETE .../v1/buyer/keys/{keyId} \
  -H "Authorization: Bearer inf_xxx"

7. Optional: Set Fallback Provider

If all marketplace sellers are down, requests fall back to your own provider key. Register it as a provider with model: null (applies to every model):

bash
curl -X POST .../v1/buyer/providers \
  -H "Authorization: Bearer inf_xxx" \
  -d '{"model": null, "api_key": "sk-your-venice-key", "base_url": "https://api.venice.ai/api/v1"}'

Alternative Clients

Instead of raw HTTP:

  • CLI: Planned — not yet published
  • MCP Server: Planned — not yet published
  • OpenClaw Skill: /inference_key, /inference_prices [model], /inference_orderbook <model>
  • OpenAI SDK: Point any OpenAI-compatible client at https://api.surplusintelligence.ai/v1 with your inf_ key

What's Next