Documentation menu · api-reference

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

MethodPathDescription
POST/v1/chat/completionsOpenAI Chat Completions; stream and non-stream, tools, images. Adds a thin object and x-thin-* headers.
POST/anthropic/v1/messagesAnthropic Messages, translated onto the exchange.
POST/anthropic/v1/messages/count_tokensToken count for an Anthropic request.
POST/v1/route/previewRouting decision (eligible + rejected) without calling upstream.
GET/v1/modelsModels with ≥1 live offer; ?all=1 for the full reference catalog.
GET/v1/balanceBalance and the calling key's spend vs budgets.
GET/v1/requestsRequest log; ?limit=50&before=req_…
GET/v1/requests/{id}One request, including its receipt.

Policy paths

Auth: API key

MethodPathDescription
*/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)

MethodPathDescription
GET/v1/receipts/{id}Signed receipt: { receipt, signature, kid }.
POST/v1/receipts/verifyPublic. Checks a signed receipt → { valid }.
GET/.well-known/thin-receipts.jsonPublic. Ed25519 JWKS.

Limit batches

Auth: API key

MethodPathDescription
POST/v1/batchesCreate a batch with a price limit and deadline.
GET/v1/batchesList batches.
GET/v1/batches/{id}Batch object with counts and last market check.
GET/v1/batches/{id}/resultsPer-row results.
POST/v1/batches/{id}/cancelCancel the remaining rows.

Price locks

Auth: Public / API key

MethodPathDescription
GET/v1/market/locksPublic. Available locks.
POST/v1/locks/{lock_id}/purchaseBuy into a lock: { amount_micro }.
GET/v1/holdingsYour holdings.

Market data

Auth: Public

MethodPathDescription
GET/v1/market/statsExchange-wide live stats.
GET/v1/marketEvery 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/catalogReference catalog with list prices; ?q= to search.

Dashboard: auth & account

Auth: Session

MethodPathDescription
POST/api/auth/register{ email, password, name } → { token, account }
POST/api/auth/login{ email, password } → { token, account }
POST/api/auth/logoutEnd the session.
GET/api/meAccount.
PATCH/api/me{ name, payout_address }
GET/api/overviewBuyer and seller summaries with daily series; ?days=30.
GET/api/notificationsNotifications.
POST/api/notifications/readMark all read.

Dashboard: keys, requests, billing

Auth: Session

MethodPathDescription
GET/api/keysList keys.
POST/api/keysCreate a key → { key, secret } (secret shown once).
PATCH/api/keys/{id}Name, policy, budgets, model_map, unfreeze.
DELETE/api/keys/{id}Revoke.
GET/api/requestsRequest log; limit, before, model, status.
GET/api/billingBalance, card status and ledger.
POST/api/billing/checkout{ amount_usd } → { url }, or 503 not_configured.

Dashboard: selling

Auth: Session

MethodPathDescription
POST/api/offers/discover{ base_url, api_key } → upstream models matched to the catalog.
GET/api/offersYour offers.
POST/api/offersCreate 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}/verifyRun Proof-of-Model now.
GET/api/offers/{id}/verificationsVerification history.
GET/api/locksYour published locks.
POST/api/locksPublish a lock.
DELETE/api/locks/{id}Withdraw unsold capacity.
GET/api/earningsAccrued, paid, pending payout, fee and payouts.
POST/api/payouts{ amount_micro, destination } (min $5).