Authorizations
API Key authentication. For all API requests, include your API Key in the Authorization HTTP Header, prefixed with 'Bearer '. Example: Authorization: Bearer {API_KEY}. Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.
Body
Request body to send a chat message.
User Input/Question content.
User identifier, unique within the application. Note: The Service API does not share conversations created by the WebApp. Conversations created through the API are isolated from those created in the WebApp interface.
Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.
Mode of response return. streaming (recommended) uses SSE. blocking returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.
streaming, blocking Conversation ID to continue a conversation. Pass the previous message's conversation_id.
File list (images) for Vision-capable models.
- Option 1
- Option 2
Auto-generate conversation title. Default true. If false, use conversation rename API with auto_generate: true for async title generation.
Response
Successful response. The content type and structure depend on the response_mode parameter in the request.
- If
response_modeisblocking, returnsapplication/jsonwith aChatCompletionResponseobject. - If
response_modeisstreaming, returnstext/event-streamwith a stream ofChunkChatEventobjects.
Response object for blocking mode chat completion.
Event type, fixed as message.
"message"
Task ID for request tracking and stop response API.
Unique ID of this response/message event.
Unique message ID.
Conversation ID.
App mode, fixed as chat.
"chat"
Complete response content.
Message creation timestamp (Unix epoch seconds).