Skip to main content
POST
/
chat-messages
{
  "event": "message",
  "task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "mode": "chat",
  "answer": "<string>",
  "metadata": {
    "usage": {
      "prompt_tokens": 123,
      "prompt_unit_price": "<string>",
      "prompt_price_unit": "<string>",
      "prompt_price": "<string>",
      "completion_tokens": 123,
      "completion_unit_price": "<string>",
      "completion_price_unit": "<string>",
      "completion_price": "<string>",
      "total_tokens": 123,
      "total_price": "<string>",
      "currency": "<string>",
      "latency": 123
    },
    "retriever_resources": [
      {
        "position": 123,
        "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dataset_name": "<string>",
        "document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "document_name": "<string>",
        "segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "score": 123,
        "content": "<string>"
      }
    ]
  },
  "created_at": 123
}

Authorizations

Authorization
string
header
required

API Key authentication.

Body

application/json

Request body to send an advanced chat message.

query
string
required

User input/question content.

user
string
required

User identifier. 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.

inputs
object

Key/value pairs for app variables. For file type variables, value should be an InputFileObject.

response_mode
enum<string>
default:streaming

Response mode. Cloudflare timeout is 100s for blocking.

Available options:
streaming,
blocking
conversation_id
string

Conversation ID to continue.

files
object[]

List of files for Vision-capable models or general file input.

  • Option 1
  • Option 2
auto_generate_name
boolean
default:true

Auto-generate conversation title.

Response

Successful response. The content type and structure depend on the response_mode.

  • blocking: application/json with ChatCompletionResponse.
  • streaming: text/event-stream with ChunkAdvancedChatEvent stream.

Response for blocking mode chat.

event
string
Example:

"message"

task_id
string<uuid>
id
string<uuid>

Unique ID of this response event.

message_id
string<uuid>
conversation_id
string<uuid>
mode
string
Example:

"chat"

answer
string
metadata
object
created_at
integer