Protocol reference
Build a local gateway and your own WebSocket client to route completions for model-a.
Create a challenge
Send POST /challenges with no body, or send {"ms_per_credit": 50} to set the latency–cost exchange rate. You’ll get the challenge_id, ws_url, provider_urls, report_url, and ms_per_credit.
Connect and start
Connect to ws_url. When you receive a ready frame with the challenge ID and request total, send {"type":"start"}. Each challenge supports one client at a time and one run.
After start, the server sends 50 calibration pings, one at a time. Reply to each {"type":"ping","id":"…","sent_at":1700000000.0} with {"type":"pong","id":"…"} using the same ID. The server waits for that pong or a 2-second timeout before sending the next ping. It averages the valid round trips and excludes timeouts.
After calibration, the 120-second benchmark starts. You’ll receive 1,000 requests at an average of 500 per second, with no more pings:
{"type":"request","request_id":"req_0001","model":"model-a",
"prompt":"Complete this request. Nonce: …","sent_at":1700000000.0}
Call the providers
Forward each request to your gateway. From there, POST the original request_id, model, and prompt to one or more of the three /<challenge_id>/provider_a|provider_b|provider_c/v1/completions URLs returned on creation. Forward the prompt unchanged; a mismatch returns HTTP 400 without an output or charge. A successful response costs one credit even if the HTTP client disconnects; HTTP 503 failures are free.
{"request_id":"req_0001","provider":"provider_a","output":"…"}
Return each answer
Send each result back over the WebSocket. The first response for a dispatched request counts; duplicates and unknown IDs are ignored.
{"type":"response","request_id":"req_0001","output":"…"}
After all responses arrive or 120 seconds pass, you’ll receive complete with report_url and summary. You can also poll GET /challenges/{challenge_id}/status for state (created, calibrating, running, or complete), sent, answered, and correct. Read the full data at GET /{challenge_id}/report.json after completion.
How scoring works
Latency is measured at the challenge server, from sending a request to receiving its answer. Each wrong or missing answer counts as 120 seconds. The latency score is the percentage of the total-latency gap you closed between the best single provider with retries and the per-request oracle, clamped to 0–100.
Your latency is unchanged. Each baseline adds the average measured network round-trip time (RTT) once for the WebSocket hop and once per sequential provider attempt. Oracle and fire-all add two RTTs per request in total. If there was no valid pong, no RTT is added.
The overall score uses the same comparison after adjusting each strategy’s total latency by ms_per_credit × max(0, credits_used − 1000). The report shows RTT-adjusted baseline latencies and credits for all three single-provider strategies, the oracle, and fire-all.