API
Middleware (public)
OpenAI-compatible
| Route | Auth | |
|---|---|---|
GET /v1/models | Bearer rk_… | auto (when more than one agent is on) and each agent that is on, with its description |
POST /v1/chat/completions | Bearer rk_… | OpenAI chat completions. model: an agent id or auto; stream: true for server-sent events |
Optional header: X-Session-Id keeps memory per session and agent, so only the new message needs to be sent.
Errors follow OpenAI's shape, { "error": { "message", "type", "code" } }: 401 invalid_api_key, 404 model_not_found, 429 demo_limit (demo mode), 502 agent_failed.
Settings
All with Authorization: Bearer <ADMIN_TOKEN>.
| Route | Body | |
|---|---|---|
GET /api/config | endpoint, provider (without its key), agents, API keys | |
PUT /api/provider | { baseURL, model, apiKey? } | set the provider; omit apiKey to keep the stored one |
DELETE /api/provider | back to the built-in model | |
PUT /api/agents | { disabled: ["id", …] } | turn agents off |
POST /api/keys | { name } | create a key: { id, name, key }, shown only here |
DELETE /api/keys/:id | revoke a key | |
GET /api/demo | (no auth) | { demo, adminToken? }: the published token in demo mode |
Agents Worker
Private: reached only through the middleware's service binding. Same /v1 routes, plus GET / (health and agent ids). The middleware sets these headers on each call:
| Header | |
|---|---|
X-Provider-Base-URL, X-Provider-Key, X-Provider-Model | the model provider for this request (absent: the built-in model) |
X-Agents | comma-separated ids of the agents that are on |
X-Session-Id | passed through from the client |
Authorization: Bearer <AGENTS_API_KEY> | when set |