API reference
Base URL http://localhost:8787. API keys go in Authorization: Bearer sk-thin-… or x-api-key. Dashboard routes use a session token.
Units and ids
Money is integer microdollars in *_micro fields; prices are per 1M tokens. Timestamps are ISO-8601 UTC. Errors use the OpenAI envelope — see Errors.
Inference
Auth: API key
| Method | Path | Description |
|---|---|---|
POST | /v1/chat/completions | OpenAI Chat Completions; stream and non-stream, tools, images. Adds a thin object and x-thin-* headers. |
POST | /anthropic/v1/messages | Anthropic Messages, translated onto the exchange. |
POST | /anthropic/v1/messages/count_tokens | Token count for an Anthropic request. |
POST | /v1/route/preview | Routing decision (eligible + rejected) without calling upstream. |
GET | /v1/models | Models with ≥1 live offer; ?all=1 for the full reference catalog. |
GET | /v1/balance | Balance and the calling key's spend vs budgets. |
GET | /v1/requests | Request log; ?limit=50&before=req_… |
GET | /v1/requests/{id} | One request, including its receipt. |
Policy paths
Auth: API key
| Method | Path | Description |
|---|---|---|
* | /p/{policy}/v1/… | Any /v1 inference route with routing policy tokens in the path. |
* | /p/{policy}/anthropic/… | Any /anthropic route with routing policy tokens in the path. |
Receipts
Auth: API key (verify and keys are public)
| Method | Path | Description |
|---|---|---|
GET | /v1/receipts/{id} | Signed receipt: { receipt, signature, kid }. |
POST | /v1/receipts/verify | Public. Checks a signed receipt → { valid }. |
GET | /.well-known/thin-receipts.json | Public. Ed25519 JWKS. |
Limit batches
Auth: API key
| Method | Path | Description |
|---|---|---|
POST | /v1/batches | Create a batch with a price limit and deadline. |
GET | /v1/batches | List batches. |
GET | /v1/batches/{id} | Batch object with counts and last market check. |
GET | /v1/batches/{id}/results | Per-row results. |
POST | /v1/batches/{id}/cancel | Cancel the remaining rows. |
Price locks
Auth: Public / API key
| Method | Path | Description |
|---|---|---|
GET | /v1/market/locks | Public. Available locks. |
POST | /v1/locks/{lock_id}/purchase | Buy into a lock: { amount_micro }. |
GET | /v1/holdings | Your holdings. |
Market data
Auth: Public
| Method | Path | Description |
|---|---|---|
GET | /v1/market/stats | Exchange-wide live stats. |
GET | /v1/market | Every model with offers. q, modality, sort, verified=1, zdr=1, region. |
GET | /v1/market/{model} | Order book, locks and price history for one model (id URL-encoded). |
GET | /v1/catalog | Reference catalog with list prices; ?q= to search. |
Dashboard: auth & account
Auth: Session
| Method | Path | Description |
|---|---|---|
POST | /api/auth/register | { email, password, name } → { token, account } |
POST | /api/auth/login | { email, password } → { token, account } |
POST | /api/auth/logout | End the session. |
GET | /api/me | Account. |
PATCH | /api/me | { name, payout_address } |
GET | /api/overview | Buyer and seller summaries with daily series; ?days=30. |
GET | /api/notifications | Notifications. |
POST | /api/notifications/read | Mark all read. |
Dashboard: keys, requests, billing
Auth: Session
| Method | Path | Description |
|---|---|---|
GET | /api/keys | List keys. |
POST | /api/keys | Create a key → { key, secret } (secret shown once). |
PATCH | /api/keys/{id} | Name, policy, budgets, model_map, unfreeze. |
DELETE | /api/keys/{id} | Revoke. |
GET | /api/requests | Request log; limit, before, model, status. |
GET | /api/billing | Balance, card status and ledger. |
POST | /api/billing/checkout | { amount_usd } → { url }, or 503 not_configured. |
Dashboard: selling
Auth: Session
| Method | Path | Description |
|---|---|---|
POST | /api/offers/discover | { base_url, api_key } → upstream models matched to the catalog. |
GET | /api/offers | Your offers. |
POST | /api/offers | Create an offer; runs verification → { offer, verification } or 422. |
PATCH | /api/offers/{id} | Prices, pricing mode, caps, schedule, concurrency, status, key rotation. |
DELETE | /api/offers/{id} | Delist and destroy the credential. |
POST | /api/offers/{id}/verify | Run Proof-of-Model now. |
GET | /api/offers/{id}/verifications | Verification history. |
GET | /api/locks | Your published locks. |
POST | /api/locks | Publish a lock. |
DELETE | /api/locks/{id} | Withdraw unsold capacity. |
GET | /api/earnings | Accrued, paid, pending payout, fee and payouts. |
POST | /api/payouts | { amount_micro, destination } (min $5). |