Endpoints
Stream a chat turn
Content-Type: text/event-stream. Each event contains a text-delta that must be aggregated client-side:
Required fields
Idempotency
The server accepts an optionalIdempotency-Key header. If absent, the server generates one automatically.
Thread CRUD
List threads
Create a thread
title defaults to “New conversation”.
Get a thread
Update a thread
Delete a thread
Credit reservation
Chat uses 720,000 µUSD per turn (6 steps at 120,000 µUSD per step). Each step within a turn obtains a per-step credit lease. If a lease is refused mid-turn, the stream terminates withstopped_credits.
Consuming the stream
The recommended approach (used by the MCP client atapps/mcp/src/client.ts) is to aggregate text-delta events into a full message:
1
Connect the stream
Connect the SSE stream to a POST to
/api/v1/chat.2
Aggregate the deltas
For each
text-delta event, append text to the current assistant message.3
Detect completion
On
finish, the stream is complete.4
Persist the history
After the stream, use
PATCH /api/v1/threads/{id} or the internal saveChatMessages to persist the full message history.