OpenPi API docs
This page is the Swagger UI for /openapi.json. The script below loads the UI from the OpenAPI document. The text here is the same contract when that script is unavailable.
Auth
Set PI_GPT_API_KEY on the router. Send it on chat and health as Authorization: Bearer <key> or X-API-Key: <key>. An unset variable returns 503. A wrong key returns 401. The docs and the OpenAPI JSON do not require the key. Do not put the key in a query string.
Chat
POST /api/chat. If mode is omitted, the model is Flash (qwen3:0.6b on pi4) at the medium budget. low, medium, and high stay on that checkpoint. A full inference cap waits in a queue of 8 and the page shows Waiting for a free slot. A full queue returns 503, the same short message as the page. A map hit does not take a slot.
curl -sS http://127.0.0.1:18080/api/chat \
-H 'content-type: application/json' \
-H 'authorization: Bearer YOUR_KEY' \
-d '{"messages":[{"role":"user","content":"status"}]}'
Health
GET /api/health with the same key. public_model is flash.