public

Handle Send Chat Message

This endpoint is used to send a new chat message.

Args: chat_message_req (SendMessageRequest): Details about the new chat message. - When stream=True (default): Returns StreamingResponse with SSE - When stream=False: Returns ChatFullResponse with complete data request (Request): The current HTTP request context. user (User): The current user, obtained via dependency injection. _ (None): Rate limit check is run if user/group/global rate limits are enabled.

Returns: StreamingResponse | ChatFullResponse: Either streams or returns complete response.

post/chat/send-chat-message

Request body

messagestring required
allowed_tool_idsinteger[] nullable
forced_tool_idinteger nullable
deep_researchboolean
mcp_headersobject nullable

Headers forwarded to MCP tool calls made while answering this message, e.g. {"Authorization": "Bearer <user_jwt>", "X-User-ID": "user123"}. Use this to pass end-user credentials through to MCP servers that require them.

origin'webapp' | 'chrome_extension' | 'api' | 'slackbot' | 'widget' | 'discordbot' | 'mobile' | 'unknown' | 'unset'

Origin of a chat message for telemetry tracking.

parent_message_idinteger nullable
chat_session_idstring uuid nullable
streamboolean
include_citationsboolean
additional_contextstring nullable

A string of extra context injected into the LLM call for this request. The context is passed to the model but is not stored in the database and will not appear in the chat history. Use this to supply ephemeral, request-scoped information (e.g. the user's current page URL, session metadata, or any runtime context) without polluting the persistent conversation history. Pass null or omit the field to use no additional context.

Response

If stream=true, returns text/event-stream. If stream=false, returns application/json (ChatFullResponse).

answerstring required
answer_citationlessstring required
pre_answer_reasoningstring nullable
message_idinteger required
chat_session_idstring uuid nullable
incognitoboolean
error_msgstring nullable

Changes