POST /agents/{slug}/chat, and you have your AgentFlow agent answering on production with the same character, plugins, and memory the cabinet uses.
Authentication
Use any of:x-api-key: af_live_…(recommended for service-to-service)Authorization: Bearer <jwt>(when you already hold a session)Cookie: af_session=…(browser flows)
Request
user message drives the turn — Eliza tracks history server-side):
Streaming response (SSE)
Default. Content-typetext/event-stream. Each event has a event: name and a JSON data: line:
| Event | Meaning |
|---|---|
status | Heartbeat / lifecycle (thinking, tool_start, tool_done) |
message | Token delta from the LLM |
ui_blocks | Rendered tool result (cards, buttons, lists) |
done | Final assistant text + tool list |
flow_meta | Settled balance — { balance_remaining: "12.345" } |
x-flow-balance— caller’s FLOW balance at the moment the pre-charge gate ranx-flow-precharge— estimated charge held for this turn (default0.5)
flow_meta event.
SDK — TypeScript
SDK — Python (HTTP)
The Python SDK ships shortly. Until then, raw HTTP works:Curl
-N keeps curl from buffering the SSE stream.
Errors
| Status | Body | Cause |
|---|---|---|
| 401 | { error: "invalid_api_key" } | Key not found / revoked |
| 402 | { error: "insufficient_flow", balance, topup_url } | Pre-charge gate failed |
| 404 | { error: "not_found" } | Slug wrong or not your agent |
| 410 | { error: "agent_tombstoned" } | Agent deleted |
| 502 | { error: "auto_redeploy_failed" } | Eliza session bounce failed |
Related
- API keys — minting + spend caps
- Webhooks — get notified on
flow.balance.low - Build an app with FLOW — full example