API Reference
Stream an AI chat response (agent or task-editor mode)
/api/ai/chat
Stream an AI chat response (agent or task-editor mode)
Operation IDpostAiChat
Authentication
- BearerAuth
http bearerAPI key token (envoy_<hex>). Create keys from Settings → API Keys — see Using the API.
Request body
This request body is required.
Content typeapplication/json
requestobject11 properties
conversation_idintegermessagestringmessagesarray<object>Array items
itemobject2 properties
rolestringrequiredRequest body roles are user/assistant only. Persisted conversation history may also contain role=summary rows from auto-compaction.
contentstring | array<object>requiredOne of
One of 1stringOne of 2array<object>Array items
itemobjectroute_contextstringreferencesarray<object>User-staged entity references (composer @-mentions / Add to chat). Invalid entries are ignored.
Array items
itemobject5 properties
typestringrequiredidstringrequiredlabelstringconnector_idintegerOwning connector (account references only)
integrationstringIntegration slug (account references only)
modestringeditor_kindstringWhich YAML editor is active when current_yaml is sent
connector_idsarray<integer>Array items
itemintegercurrent_yamlstringmodelstringPer-request model override. Must be one of the ids from GET /api/ai/status models; requests with an unknown model are rejected with 400.
approvalsarray<object>Array items
itemobject4 properties
tool_use_idstringdecisionstringmethodstringpathstringSuccess response body
200SSE stream events: text, thinking, thinking_signature, tool_call_start (name + tool_use_id, emitted when the model opens a tool_use block and its args are still being generated — lets the client show an in-progress card immediately), tool_call, tool_result, pending_approval, navigate, resource, title, conversation, compaction (status start|done|skipped; done includes message_id + summary), usage (context_tokens + context_window after each model response — drives the UI context meter), done, error. The internal turns event is not forwarded to the client.
SSE stream events: text, thinking, thinking_signature, tool_call_start (name + tool_use_id, emitted when the model opens a tool_use block and its args are still being generated — lets the client show an in-progress card immediately), tool_call, tool_result, pending_approval, navigate, resource, title, conversation, compaction (status start|done|skipped; done includes message_id + summary), usage (context_tokens + context_window after each model response — drives the UI context meter), done, error. The internal turns event is not forwarded to the client.
Content typetext/event-stream
responsestringError responses
400Validation error
Validation error
No response content schema is documented.
501AI not configured
AI not configured
No response content schema is documented.