The Token Broker speaks the OpenAI API. Point any OpenAI-compatible SDK at our base URL with a tb_… key from the console. Every request is routed to the cheapest healthy offer and settled per token.
export TB_API_KEY="tb_…" curl https://api.thetokenbroker.ai/v1/chat/completions \ -H "Authorization: Bearer $TB_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"claude-sonnet-5","messages":[{"role":"user","content":"hello"}]}'
from openai import OpenAI client = OpenAI( base_url="https://api.thetokenbroker.ai/v1", api_key="tb_…", ) r = client.chat.completions.create( model="gpt-5.4", messages=[{"role": "user", "content": "price check"}], stream=True, ) for chunk in r: print(chunk.choices[0].delta.content or "", end="")
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.thetokenbroker.ai/v1", apiKey: "tb_…", }); const r = await client.chat.completions.create({ model: "deepseek-v4-pro", messages: [{ role: "user", content: "hello" }], });
All inference endpoints take a bearer key: Authorization: Bearer tb_…. Keys are created in the console, shown once, and stored hashed. Each key can carry a monthly budget, a per-minute rate limit, and a model allowlist.
The canonical registry is frontier labs only — Anthropic, OpenAI, Google, DeepSeek, Moonshot, xAI, Zhipu. GET /v1/models returns live buyer-effective prices (all-in, spread included) and the number of live offers per model. Public prices: /markets.
| Field | Meaning |
|---|---|
| pricing.input_per_m_usd | All-in price per 1M input tokens |
| pricing.output_per_m_usd | All-in price per 1M output tokens |
| live_offers | Healthy offers currently live |
POST /v1/chat/completions — drop-in compatible. Streaming via SSE is supported and usage is always reported on the terminal chunk.
POST /v1/embeddings follows the same shape. Embeddings capacity depends on sellers listing it — check /v1/models for what's live.
| Header | Meaning |
|---|---|
| x-tb-request-id | Every request's permanent audit id |
| x-tb-price-micro | Exact charge in micro-USD (non-streaming) |
| x-tb-tier | The price band that filled — never the seller |
| x-tb-model | Canonical model id that served the request |
| Code | When |
|---|---|
| insufficient_credits | 402 — fund the account in the console |
| budget_exceeded | 402 — the key's monthly budget is spent |
| rate_limit_error | 429 — per-key RPM ceiling; raise it in the console |
| no_capacity | 503 — no healthy offers for the model right now |
| upstream_error | 502 — every candidate offer failed; retry |
Credits are prepaid inference entitlements purchased by card. They're non-transferable, never redeemable for cash, and expire after 12 months of inactivity. Canadian buyers are charged GST/HST; non-resident businesses are zero-rated with a tax ID on file. Refunds go back to the original card only, within 24 hours of purchase, for the unused portion. Full terms: Terms of Service.
Sellers manage endpoints and offers from the console, and every console action has a JSON API under /api/seller/*. Applications are reviewed within 48 hours. See /sell for tiers and rules.
POST /api/seller/apply — open an applicationPOST /api/seller/endpoints — connect an allowlisted upstreamPOST /api/seller/offers — list an offer at your pricePOST /api/seller/offers/:id/reprice — version your priceGET /api/seller/earnings — pending, held, available, paid