API conventions
Machine-readable spec: openapi.yaml.
- Base URL:
http://127.0.0.1:8080locally, your Cloudflare hostname in production. - JSON bodies,
Content-Type: application/json. - Buyer auth:
Authorization: Bearer <buyer_key>. - Seller auth:
X-Seller-API-Key: <seller_key>(exceptPOST /v1/sellers/register). - Errors:
{ "code": "seller_unreachable", "message": "..." }. - Prices are decimal strings (per 1,000 tokens). Settlement uses scale-8 integers.
Error codes
Abbreviated. The canonical table is Errors.
| code | HTTP | meaning |
|---|---|---|
no_match | 404 | no seller matched the bid |
bid_timeout | 504 | bid expired before a seller matched |
rate_limited | 429 | per-key rate limit exceeded |
insufficient_balance | 402 | account has insufficient pre-funded balance |
seller_unreachable | 502 | winning seller could not be reached |
not_found | 404 | resource does not exist |
Endpoints
| Method | Path | Auth |
|---|---|---|
| POST | /v1/chat/completions | Buyer |
| POST | /v1/sellers/register | Public |
| POST | /v1/sellers/{id}/asks | Seller |
| DELETE | /v1/sellers/{id}/asks/{ask_id} | Seller |
| POST | /v1/sellers/{id}/capacity | Seller |
| GET | /v1/sellers/{id}/trades | Seller |