Create or Continue Chat
Generate a chat completion. Streaming (stream: true): Returns an SSE stream. The LLM call runs in a background task that is decoupled from the HTTP connection — if the client disconnects mid-stream (tab close, navigation, network drop) the model continues generating and the assistant message + artifacts are persisted once it finishes. Poll GET /v1/chats/{id} to check completion status. Non-streaming (stream: false): Returns a single JSON response after the model finishes generating. Extended thinking: Models that support reasoning (e.g. AI models-opus-4-6) emit reasoning-start / reasoning-delta / reasoning-end SSE events before the text response. These events can take 60-120 seconds; keep the connection open and display a thinking indicator while they arrive.
Authorizations
Headers
Body
Request schema for chat completions.
Enable reasoning/thinking tokens for supported models. When enabled, the model will expose its thinking process in the response. Supported by: AI models (extended thinking), AI models o1/o3, AI models thinking models. Note: Reasoning tokens are billed separately and may significantly increase costs.
true
false
When enabled, URLs in user messages are automatically fetched and their content is provided to the AI as context. Enables 'summarize this article' or 'what does this page say' use cases. If a URL cannot be fetched (e.g., too large, blocked, or inaccessible), the error is communicated so the AI can inform the user.
true
false
File IDs to associate with this chat before processing. Use when the frontend uploads files first then creates/sends a chat message. Files are associated with the chat (creating vectors if needed) and included in RAG context. If vectors are not ready yet, extracted text is used as fallback context.
Control whether original images are fetched from storage and attached to the LLM prompt for image_ocr RAG chunks. null (default) — server decides: enabled when the model supports vision and RAG_IMAGE_ATTACHMENT_ENABLED is true. true — force on for this request (model must support vision). false — disable for this request regardless of server defaults. Image tokens are billed as part of the normal input token charge.
null
Response
Server-Sent Events stream of chat completion chunks (when stream=true). Each SSE event has the format: data: <json>\n\n where <json> matches the StreamingChatResponse schema. The final event has finished: true and includes usage stats. A data: [DONE]\n\n event is sent after the last chunk.