API

All chat requests go to a single streaming endpoint.

POST /api/chat
Authentication
When `REQUIRE_AUTH=true`, include one of these headers:
Authorization: Bearer YOUR_KEY
x-api-key: YOUR_KEY
x-workspace-key: YOUR_KEY
Request body
{
  "provider": "auto",
  "profile": "auto",
  "ecoMode": true,
  "maxOutputTokens": 256,
  "temperature": 0.2,
  "messages": [
    { "role": "user", "content": "hello" }
  ]
}
Streaming events
Responses are SSE streams with events:
delta: incremental text
meta: provider, model, tokens, emissions
error: error message
done: end of stream
event: delta
data: {"text":"hello"}

event: meta
data: {"provider":"openai","model":"gpt-5-mini"}

event: done
data: {"ok":true}
Conversations
Save and retrieve chat history per workspace.
GET /api/conversations
POST /api/conversations