Send a message to the AI trading assistant and receive a streaming response via Server-Sent Events (SSE).
Authentication: Requires a JWT from /v1/auth/verify as a Bearer token.
Rate limiting: 20 requests per minute per wallet (configurable via AI_RATE_LIMIT_RPM).
Response format: The response is an SSE stream (text/event-stream).
Each event has an event type and JSON data field. The stream ends with
a done event containing the conversation ID and token usage.
Conversation continuity: Omit conversation_id to start a new conversation.
Include it to continue an existing conversation with message history.
SSE event types:
text — AI-generated text chunk (streamed incrementally)tool_start — Tool execution started (for UX loading indicators)tool_result — Tool execution completed with summarystrategy — Trade recommendation card for user confirmationtable — Tabular data displayoptions_chain — Options chain dataprice_quote — Single instrument price quoteaccount_summary — Account balance overvieworder_status — Order placement/cancellation resulterror — Error during processing (non-fatal, stream may continue)done — Stream complete with conversation ID and usage statsData conventions in SSE events: Unlike the main REST API which uses internal units (micros, millicontracts), AI Chat SSE events use human-readable units:
1.50 not 1500000)2.0 not 2000)10000.0 not 10000000000)JWT obtained from POST /v1/auth/verify after SIWS authentication.
Include as: Authorization: Bearer <jwt>
SSE stream of AI response events
Server-Sent Events stream. Each event has format:
event: <type>
data: <json>