Overview
The Chat API enables you to send messages to AI providers, manage conversations, and stream responses in real-time.Send Message
POST /api/chat
Send a message to an AI provider and receive a complete response.Request Body
The message text to send to the AI
AI provider to use. Options:
ollama, groq, google, claude, openai, openrouter, or default (uses user’s default provider)Conversation ID to continue an existing conversation. If not provided, a new conversation will be created.
Conversation mood/tone. Options:
serious, friendly, or normalIf
true, prefer web search and web fetch tools for the responseBase64-encoded image data for vision-capable models
MIME type of the image (e.g.,
image/png, image/jpeg)Response
The AI’s response text
The conversation ID (newly created or the one provided in the request)
The actual provider used for the response
Stream Message
POST /api/chat
Stream AI responses in real-time using Server-Sent Events (SSE). This endpoint provides token-by-token streaming of the AI’s response.Request Body
Accepts the same parameters as/api/chat.
The message text to send to the AI
AI provider to use
Conversation ID to continue an existing conversation
Conversation mood:
serious, friendly, or normalEnable web search/fetch tools
Base64-encoded image data
Image MIME type
Response Events
The endpoint returns Server-Sent Events with the following event types:Initial metadata event containing conversation ID and provider
Text delta events containing chunks of the AI’s response
Reasoning/thinking events for models that support extended thinking
Status updates (e.g., tool execution, web search)
Final event with complete response
Error event if something goes wrong
List Conversations
GET /api/chat/conversations
Retrieve a list of conversations for the authenticated user.Query Parameters
Filter conversations by channel
Maximum number of conversations to return (1-100)
Response
Array of conversation objects
Get Conversation Messages
GET /api/chat/messages
Retrieve messages from a specific conversation.Query Parameters
The conversation ID to retrieve messages from
Maximum number of messages to return (1-100)
Response
The conversation ID
Array of message objects ordered by creation time
Delete Conversation
DELETE /api/chat/conversations/
Delete a conversation and all its messages.The ID of the conversation to delete
Error Responses
- 403 Forbidden: Conversation does not belong to the authenticated user
Truncate Conversation
POST /api/chat/conversations//truncate
Remove old messages from a conversation, keeping only the most recent messages.The ID of the conversation to truncate
Number of recent messages to keep. Set to 0 to delete all messages.
Response
Success status
The conversation ID
Number of messages kept
Number of messages deleted
Error Responses
- 403 Forbidden: Conversation does not belong to the authenticated user