// guides · 05
Headless HTTP API
okami serve exposes the agent through a tiny stdlib HTTP server. It is fail-closed: without OKAMI_API_TOKEN, the API refuses to start.
Start it
okami config set OKAMI_API_TOKEN <strong-token>
okami serve --host 127.0.0.1 --port 8765Endpoints
| endpoint | contract |
|---|---|
| GET /health | returns { ok: true } |
| POST /chat | body { "agent": "okami", "message": "..." }; requires Authorization: Bearer <token> |
curl
curl -s http://127.0.0.1:8765/chat \
-H 'Authorization: Bearer <strong-token>' \
-H 'content-type: application/json' \
-d '{"agent":"okami","message":"summarize this repo"}'
