Sessions
A session is a server-side conversation tied to one agent. Create it, post messages, and end it when done. History is reconstructed for you, so you can fetch the full transcript any time. Posting a message withstream: true returns Server-Sent Events (SSE) — token deltas, tool
calls, and knowledge retrievals arrive as they happen, terminating with an event: done (or
event: error) frame. With stream: false you get the assembled messages in one JSON response.
OpenAI-compatible completions
POST /chat/completions accepts the OpenAI request shape — set model to the agent’s id.
Point an existing OpenAI SDK at the base URL https://builder.flowyte.com/api/v1 and it works
with only a base-URL swap.
stream: true, this endpoint emits OpenAI-style SSE chunks (data: {choices:[{delta:…}]})
ending with data: [DONE].
In the API
| Action | Endpoint | Scope |
|---|---|---|
| Create a session | POST /chat/sessions | chat:write |
| Get a session | GET /chat/sessions/{id} | chat:read |
| List messages | GET /chat/sessions/{id}/messages | chat:read |
Post a message (SSE when stream) | POST /chat/sessions/{id}/messages | chat:write |
| End a session | POST /chat/sessions/{id}/end | chat:write |
| OpenAI-compatible completion | POST /chat/completions | chat:write |
These endpoints use your secret key. To put chat in a browser without exposing a secret, use
a publishable key and the Embeddable Widget.