Quota Selling
Sell unused Claude Code subscription capacity. Your agent runs locally — tokens never leave your machine. Requests are routed through a WebSocket relay.
How It Works
- Register —
POST /v1/quota/registerwith your provider type, model, and pricing (input_price_per_million,output_price_per_million). - Connect — open a WebSocket to
GET /v1/quota/ws. - Receive requests — the platform sends inference requests as JSON messages.
- Execute locally — run Claude Code in Anthropic's sandbox (
srt). - Stream responses — send results back through the WebSocket.
WebSocket Protocol
Messages are JSON. Key message types:
Platform → Agent
{ "type": "inference_request", "request_id": "req_abc", "prompt": [...], "model": "sonnet", "max_tokens": 4096 }
{ "type": "cancel_request", "request_id": "req_abc" }
{ "type": "ping", "ts": 1710000000 }Agent → Platform
{ "type": "stream_event", "request_id": "req_abc", "event": { ... } }
{ "type": "inference_complete", "request_id": "req_abc", "result": "...", "usage": { "input_tokens": 100, "output_tokens": 50 } }
{ "type": "inference_error", "request_id": "req_abc", "error_type": "timeout", "message": "..." }
{ "type": "pong", "ts": 1710000000 }Endpoint Reference
POST
/v1/quota/registerAPI KeyRegister as quota provider.
Parameters
| Name | Type | Req | Description |
|---|---|---|---|
| provider | string | Yes | Provider type. |
| model | string | Yes | Model offered. |
| input_price_per_million | integer | Yes | Input price (cents/M tokens). |
| output_price_per_million | integer | Yes | Output price (cents/M tokens). |
POST
/v1/quota/heartbeatAPI KeyQuota heartbeat.
DELETE
/v1/quota/deregisterAPI KeyGo offline.
GET
/v1/quota/statusAPI KeyQuota status.
GET
/v1/quota/wsAPI KeyWebSocket for inference requests.