


wss://wss.lke.tencentcloud.com/v1/qbot/chat/conn/?EIO=4&transport=websocket.0{"sid":"xxx","upgrades":[],"pingInterval":25000,"pingTimeout":5000}
40{"token":"xx-xx-xx-xx-xx"}
2
3

42["Type",{"payload":{event body}}]Example:42["send",{"payload":{see the data structure for each following event}}]
Name | Type | Required | Description |
request_id | string(255) | No | Request ID, used to identify a request (connect messages, recommend using a different request_id per request). For easy troubleshooting, it is required. |
session_id | string(64) | Yes | Conversation ID, used to identify a session (provided by an external system, it is advisable for different client sessions to import different session_id, otherwise messages from different users within the same application may get mixed up). Parameter Length: 2 to 64 characters Verification rule: ^[a-zA-Z0-9_-]{2,64}$. Normally, uuid can be used to generate this value. uuid example: 1b9c0b03-dc83-47ac-8394-b366e3ea67ef |
content | string | Yes | Message content. If sending picture, transmit Markdown format image link herein, such as . Among them, image link needs to be public read [image ingestion into tcadp cos is required]. Maximum value limit: Different models have differences in maximum value. Refer to the InputLenLimit of the ListModel API. |
file_infos | Object array | No | File information. If you fill this field, the content field can be empty. For data structure, refer to file_infos, dependent on real-time document parsing. Note: If there is no file information, this field can be left blank or set to an empty array. |
custom_variables | map[string]string | No | Workflow scenario: Custom parameters can be used to pass parameters to the API parameter field of the workflow start node. The workflow can identify and use the parameters through this API parameter field. For details, refer to the start node operation instructions. Customize the value of API parameter. Multiple key:value pairs can be configured, where key is the name of the custom parameter and value is the runtime value of the corresponding user-defined parameter. Note: Both the key and value in the map are of string type, for example {"UserID":"10220022"}. Invalid parameters include: {"UserID": 10220022}. The value can also be a json string, such as {"Data": "{\\"UserID\\":\\"10220022\\",\\"Score\\":{\\"Chinese\\":89,\\"Math\\":98}}"} Knowledge Base Retrieval Scope Settings Scenario: Custom parameters are used to set the search scope in the knowledge library. If needed, input multiple parameter values separated by English vertical bars (|), for example: "user1|user2". Note: If you need to specify a knowledge base for retrieval in a question, you can input relevant tag values through this field. For details, refer to Set Knowledge Base Search Scope. |
system_role | string | No | Role directive (Note prompt content) uses the default setting of the application configuration when empty, and takes the current value when filled. Maximum value limit: Different models have differences in maximum value. Refer to the RoleLenLimit of the ListModel API. |
incremental | bool | No | Control whether the content in reply event and thinking event is incrementally output, false by default. Note: This field set to true only takes effect for reply and thinking events. Effect of reply event: ![]() Effect of thinking event: ![]() |
model_name | string | No | Support importing a specified model during the dialogue process. Using different model names under the same session_id maintains context correlation with each other. The following custom models are currently supported: Deepseek/deepseek-v3.1-terminus: DeepSeek-V3.1-Terminus Deepseek/deepseek-v3-250324: DeepSeek-V3-0324 Deepseek/deepseek-r1-0528: DeepSeek-R1-0528 Note: Ensure the selected model has sufficient tokens or postpaid mode is enabled to avoid errors during the process. |
stream | string | No | Whether streaming is enabled. Value ranges from...to... Empty string: follow application configuration enable: streaming disable: Non-streaming transmission |
workflow_status | string | No | Whether workflow is enabled. Value ranges from...to... Empty string: follow application configuration (the page has no portal to configure workflow, which is enabled by default) enable: Enable workflow disable: Disable workflow |
Name | Type | Required | Description |
file_name | string | Yes | Document name. |
file_size | string | Yes | Real-time document parsing API response file size. |
file_url | string | Yes | Real-time document parsing API response file URL. |
file_type | string | Yes | File type. |
doc_id | string | Yes | Real-time document parsing API response doc_id. |
Name | Type | Description |
request_id | string(255) | Request ID, used to identify a request (connect messages, recommend using a different request_id per request). |
content | string | Reply message content |
file_infos | Object array | File Information |
record_id | string(64) | Unique message ID |
related_record_id | string(64) | Associated Unique Message ID |
session_id | string(64) | Conversation ID, used to identify a session (provided by an external system, it is advisable for different client sessions to import different session_id, otherwise messages from different users within the same application may get mixed up). |
is_from_self | bool | Whether the message is sent by the client |
can_rating | bool | Whether the message record can be evaluated |
timestamp | int64 | message timestamp (in seconds) |
is_final | bool | Whether the reply event message output is completed In streaming mode, messages are returned multiple times, each time overwriting the previous answer. When is_final == true, the stop generation button is hidden and the like and dislike buttons are displayed. reference and reply events have no fixed sequential relationship. It is not recommended to use this field as the identification of message completion. |
is_evil | bool | whether it hits sensitive content Note: After message uplink, sensitive content detection is first performed, and a [reply] event is returned to inform the sensitive content detection result. Normal business logic processing starts only after sensitive content detection is passed. ![]() |
is_llm_generated | bool | whether the content is generated by the model |
reply_method | uint8 | Response method as follows: 1: large model reply 2: unknown question reply 3: refused question reply 4: sensitive reply 5: accepted Q&A pair reply with precedence 6: welcome message reply 7: number of concurrencies exceeded reply 8: global intervention knowledge 9: task flow reply 10: task flow answer 11: search engine reply 12: polished knowledge reply 13: image understanding reply 14: real-time document reply 15: clarification confirmation reply 16: workflow reply 17: workflow operation completed 18: Intelligent Agent reply 19: multi-intent reply |
knowledge | Object array | Hit knowledge |
option_cards | string array | Tab, proprietary task flow Description: This field may be empty. If empty, the field will not be returned. |
custom_params | string array | Custom business parameter for transparently transmitting business parameters in QA Description: This field may be empty. If empty, the field will not be returned. |
task_flow | Object | Task flow debug information Description: This field may be empty. If empty, the field will not be returned. |
work_flow | Object | Workflow debug information Description: This field may be empty. If empty, the field will not be returned. |
quote_infos | Object array | Quoted information. |
Name | Type | Description |
id | string | Hit knowledge ID |
type | uint32 | Hit knowledge Type: 1: Q&A 2: Document fragment |
seg_id | string |
Name | Type | Description |
workflow_name | string | Workflow name |
workflow_id | string | Workflow ID. |
qworkflow_run_id | string | Workflow run ID |
option_cards | string array | Tab |
current_node | Object | Current Node Info |
outputs | string array | Output Result |
Name | Type | Description |
NodeID | string | Node ID |
NodeType | int32 | Node type: 0: not specified. 1: Start Node 2: Parameter Extractor Node 3: LLM Node 4: Knowledge Q&A Node 5: Knowledge Retrieve Node 6: Tag Extractor Node 7: code execution node. 8: Tool Node 9: Logical Judgment Node 10: Reply Node → Message Node 11: Tab Node 12: Loop Node 13: Intent Recognizer Node 14: Workflow Node 15: Plugin Node 16: End Node |
NodeName | string | Node name. |
Status | int32 | Status: 0: Initial status 1: running 2: operation successful 3: execution failed |
Input | string | Input of the node. json string (including ordinary string). |
Output | string | Final output of the node. json string (including ordinary string). |
TaskOutput | string | Task output. (Original output) |
FailMessage | string | exception message |
CostMilliSeconds | string | Total time consumed by the node. If the node is called multiple times, the duration is the sum of all calls. |
Reply | string | Reply content of the current node. Current parameter extraction, message node, and end reply node may not be empty. |
BelongNodeID | string | ID of the referenced node when the associated workflow is referenced. The workflow to which the task belongs is not empty when referenced. |
StatisticInfo | Object | LLM statistical information |
Name | Type | Description |
ModelName | string | Model Name |
FirstTokenCost | uint32 | First token duration |
TotalCost | uint32 | reasoning total time |
InputTokens | uint32 | Input token count |
OutputTokens | uint32 | Output token count |
TotalTokens | uint32 | Input + output total token |
Name | Type | Description |
index | int | The index of the reference, the icon should be designed and implemented by the connecting party |
position | int | position in the reply content (Chinese character, English character, or symbol counts as one character) |

["reply",{"type": "reply","payload": {"can_feedback": true,"can_rating": false,"content": "Tencent stock performance on February 13, 2025:\\n\\n### Tencent Holdings (00700.HK) Hong Kong Stock Market Performance\\n\\n- **Stock Fluctuation**: Tencent Holdings stock experienced distinct fluctuations on February 13, 2025, with an intraday amplitude of 4.35%. This reflects both the short-term impact of market emotion and capital competition, as well as the long-term logic of the sector environment and company fundamentals.\\n- **Price Range**: The stock reached a high of HKD 464.6 and a low of HKD 437 on the day.\\n\\n### Tencent Holdings (TCTZF.us) US Stock Market Performance\\n\\n- **Stock Increase**: In the US market, Tencent Holdings (TCTZF.us) stock rose by 5.05% intraday on February 13, 2025, with the latest price at USD 58.10 per share.\\n- **Market Feedback**: This unusual change drew extensive market attention, with investors starting to mine the causes and impact behind it.\\n\\nPlease note, the above information is for reference only. Investment is at risk, please be cautious.""quote_infos": [{"index": 1,"position": 323}],},"message_id": "xxxxxxxxxxxxxxxxxxxxxxx"}]
Name | Type | Description |
session_id | string(64) | Session id |
request_id | string(255) | Request id for sending corresponding event |
record_id | string(64) | Message record id for sending corresponding event |
status_summary | string | Conversation status. This round: processing. Successful: success. Failed: failed. |
status_summary_title | string | Conversation status description. This round |
elapsed | int | Call duration. This round: ms |
token_count | int | token consumption of this round request (when containing multiple processes, the count will be aggregated). |
procedures | Object array | Invocation process list |
Name | Type | Description |
name | string | English name, one-to-one correspondence with the title field below knowledge, task_flow, search_engine, image, large_language_model, pot_math, file |
title | string | Invocation process description, corresponding to the name field. The Chinese meanings are as follows: Call knowledge base, call task flow, call search engine, call image understanding, large model reply, call calculator, read file |
status | string | Invocation process status. In processing: processing. Successful: success. Failed: failed. |
input_count | int | Token consumption of this process input |
output_count | int | Token consumption of this process output |
count | int | Token consumption of this process: input + output |
["token_stat",{"type": "token_stat","payload": {"elapsed": 1616,"order_count": 50000000,"procedures": [{"count": 323,"input_count": 308,"name": "knowledge","output_count": 15,"status": "success","title": "Call the knowledge base"}],"record_id": "Hpe_20240625_185659_215_EsH2uf8L","request_id": "8PUcDU6xyQ-301747294000","session_id": "2d071ef7-ef76-44df-84a4-9210672ed700c8","status_summary": "success","status_summary_title": "Call knowledge base""token_count": 323,"used_count": 553},"message_id": "89d91395-06bc-4f2e-b240-06f7b4498b0c6e"}]
Name | Type | Required | Description |
record_id | string(64) | Yes | Message ID (message ID of the rated reply event) |
score | uint8 | Yes | Score: 1: Like 2: Dislike |
reasons | string array | No | Selected reasons (user feedback, can have multiple) |
feedback_content | string | No | feedback content |
Name | Type | Required | Description |
record_id | string(64) | Yes | Message ID (message ID of the reply event that needs to be stopped) |
Name | Type | Description |
record_id | string(64) | Unique message ID |
references | Object array | Reference |
Name | Type | Description |
id | string | The id method of use is divided into two parts. See the following two examples: 1. When the reference source Type is 1, 2, or 3, you can call the detail list acquisition source API to view the reference source details. If needed, you can obtain the corresponding parameter through the above API and navigate to: https://lke.cloud.tencent.com/preview?id=${docid}&botBizId=${appid}&page=${page number of the redirected doc document}&name=${name of the redirected sheet}&test=1 Note: The id field corresponds to the ReferBizIds field in DescribeRefer 2. When the reference source type is 4, the id represents the serial numbers of multiple reference sources. |
type | uint32 | Reference source type 1: Q&A 2: Document fragment 4: Content retrieved online Note: When type = 2, the granularity of the reference return is document slice dimensional data, which needs to be used with the id field. A document [doc_id] may contain multiple slices. Determine whether to show duplicates. |
url | string | When type = 2, this url is the custom redirect link set for opening the external reference link of the document. When type = 4, this url is the source address found in the online search. |
name | string | Reference source name |
doc_id | uint64 | Reference document ID |
doc_biz_id | uint64 | Reference document business ID. You can call the Document Detail API to check the basic information of the corresponding document. |
doc_name | string | Reference document name |
qa_biz_id | string | Reference QA business ID |
["reference",{"type": "reference","payload": {"record_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","references": [{"doc_biz_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","doc_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","doc_name": "100 Idioms and Their Historical Figures' Stories (1).docx""id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name": "100 Idioms and Its Historical Figures Stories+ (1)""qa_biz_id": "0","type": 2,"url": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}],"trace_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},"message_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]
["reply",{"type": "reply","payload": {"can_feedback": true,"can_rating": false,"content": "\\n\\nAs of 14:59 on February 13, 2025, the total box office of "Nezha 2" ("Nezha: The Devil's Birth") (including pre-sale)The revenue has exceeded **980 million CNY**, just one step away from the 1 billion milestone[3][4][7][8]. This box office result has surpassed "Black Panther".Became the only non-Hollywood film in the top 18 of the global box office chart. According to Beacon Professional Edition's prediction, "Ne Zha 2" may finally reach **15.338 billion yuan**, while Maoyan predicts a higher **16.032 billion yuan**.In addition, the overseas box office of the video has exceeded 6.27 million RMB.},"message_id": "**************************"}]
["reference",{"type": "reference","payload": {"record_id": "**************************","references": [{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "1","name": "Grossing over 8.2 billion, it entered the top 31 global box office charts! Nezha 2's overseas premiere moved audiences to tears, with merchandise selling out within 3 days.""qa_biz_id": "0","type": 4,"url": "https://new.qq.com/rain/a/20250210A04P8O00"},{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "2","name": "Just now! Nezha 2 box office exceeds 9 billion.""qa_biz_id": "0","type": 4,"url": "https://new.qq.com/rain/a/20250211A07V6J00"},{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "3","name": "Sprint to billions of box office. "Nezha 2" grosses 9.8 billion.""qa_biz_id": "0","type": 4,"url": "https://view.inews.qq.com/a/20250213A04F7F00?scene=qqsearch"},{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "4","name": "Box office of 'Nezha 2' hits 9.8 billion CNY, film and television stocks surge""qa_biz_id": "0","type": 4,"url": "https://view.inews.qq.com/a/20250213A04L4M00?scene=qqsearch"},{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "5","name": "Ne Zha 2 box office exceeds 3 billion""qa_biz_id": "0","type": 4,"url": "https://new.qq.com/rain/a/20250202A03TL500"},{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "6","name": "Ne Zha 2 box office surpasses last year's champion""qa_biz_id": "0","type": 4,"url": "https://new.qq.com/rain/a/20250203A02PAT00"},{"doc_biz_id": "0","doc_id": "0","doc_name": "","id": "7","name": "Box office of 'Nezha 2' hits 9.8 billion CNY","qa_biz_id": "0","type": 4,"url": "https://view.inews.qq.com/a/20250213A04DPH00?scene=qqsearch"}],"trace_id": "**************************"},"message_id": "**************************"}]
Name | Type | Description |
request_id | string(255) | Request ID, used to identify a request (connect messages, recommend using a different request_id per request). |
error | Object | Error |
Name | Type | Description |
code | uint32 | Error code |
message | string | Error Message |
Name | Type | Description |
elapsed | int | Call duration. This round: ms |
is_workflow | bool | Whether workflow |
procedures | Object array | Invocation process list |
record_id | string(64) | Message record id for sending corresponding event |
request_id | string(255) | Request id for sending corresponding event |
session_id | string(64) | Session id |
trace_id | string | Link id |
workflow_name | string | Workflow name |
Name | Type | Description |
debugging | Object | debugging information |
index | uint32 | Process Index |
name | string | English name, one-to-one correspondence with the title field below. knowledge, task_flow, search_engine, image, large_language_model, pot_math, file, thought |
title | string | Invocation process description, corresponding to the name field. The Chinese meanings are as follows: Call knowledge base, call task flow, call search engine, call image understanding, large model reply, call calculator, read file, think |
status | string | Status: processing - active; success - success; failed - failed |
icon | string | icon for show |
switch | string | whether to switch over the Agent |
workflow_name | string | Workflow name |
plugin_type | int32 | Plugin type. 0: Custom plugin; 1: Official plugin; 2: Workflow |
elapsed | uint32 | Request execution time, ms |
Name | Type | Description |
content | string | content output during debugging |

["thought",{"type": "thought","payload": {"elapsed": 0,"is_workflow": false,"procedures": [{"debugging": {"content": "\\nOK, the user is asking about the features of DeepSeek-R1, and this is already the third time. The previous two times, I have already listed its high efficiency, long-context processing, versatility across multiple fields, security compliance, multilingual support, flexible deployment, and cost-effectiveness in detail. The user might be confirming the information or hoping for a more concise or different perspective in the response.\\n\\nI need to consider why the user is repeating the question. Possible situations include: the user did not fully understand the previous answer and needs a simpler summary; or they want to confirm the accuracy of the information; or they want to know if there are any new updates. In addition, the user might be testing the consistency of the responses, or they need the information for specific scenarios, such as reports or comparing different models.\\n\\nNext, I should check if the previous answers were comprehensive and if any important features were missed. For example, whether the training data, supported frameworks, or specific performance metrics were mentioned. Additionally, the user might be interested in technical details, such as the model structure, training methods, or practical applications."},"elapsed": 9954,"icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png","index": 0,"name": "thought","plugin_type": 0,"status": "processing","switch": "","title": "Think""workflow_name": ""}],"record_id": "piQ_20250208_140511_254_45ja7HPq","request_id": "rjbuFuYeDB-8487350785","session_id": "dfd04cd0-ef69-4fb6-a447-a0b44018a93f","trace_id": "9a9613dbaa9edd27958bd1180c524295 / piQ_20250208_140511_254_45ja7HPq","workflow_name": ""},"message_id": "7070ef0d-4c28-4d5a-abc8-2ea2e7fa027d"}]
Error Code | Error Message |
400 | Request parameter error, please refer to the access documentation |
460001 | Token verification failed |
460002 | Event handler not found |
460004 | Application does not exist |
460006 | Message does not exist or insufficient permissions |
460007 | Session creation failed |
460008 | Failed to render Prompt |
460009 | Visitor does not exist |
460010 | The session does not exist or insufficient permissions |
460011 | Exceeding the concurrency limit |
460020 | Model request timeout |
460021 | Knowledge base not released |
460022 | Failed to create visitor. |
460023 | Failed to like or dislike the message |
460024 | Invalid tag |
460025 | Image analysis failed. |
460031 | The number of connections for this application has exceeded the request limit. Try again later. |
460032 | Current application model insufficient balance |
460033 | Application does not exist or insufficient permissions |
460034 | Content too long |
460035 | Content too long, computation has been stopped |
460036 | Process node preview parameter error |
460037 | Search for resource exhausted, call failed |
460038 | The AppID request has abnormal behavior, call failed |
Framework | Package name | Installation |
Vue2 | lke-component | npm i lke-component |
Vue3 | lke-component-vue3 | npm i lke-component-vue3 |
React | lke-component | npm i lke-component |
// main.jsimport Vue from 'vue'import lkeComponent from 'lke-component'Vue.use(lkeComponent)
<template><div><!-- thinking process --><MsgThoughtv-if="thought.content":content="thought.content":title="thought.title":status="thought.status":elapsed="thought.elapsed"/><!-- message content --><MsgContent:content="message.content":isFinal="message.isFinal":isReplaceLinks="true"clazzMd="answer-md"/><!-- loading... --><MsgLoadingv-if="loading":loadingMessage="true"loadingText="Thinking..."/></div></template><script>export default {data() {return {loading: false,message: {content: '',isFinal: true},thought: {content: '',title: 'Think Done'status: 'success',elapsed: 0}}}}</script>
<script>import { MsgContent, MsgLoading, MsgThought } from 'lke-component'export default {components: { MsgContent, MsgLoading, MsgThought }}</script>
// main.jsimport { createApp } from 'vue'import App from './App.vue'import lkeComponent from 'lke-component-vue3'import 'lke-component-vue3/style.css'createApp(App).use(lkeComponent).mount('#app')
<template><div><MsgThoughtv-for="(thought, i) in thoughts":key="i":content="thought.content":title="thought.title":titleIcon="thought.titleIcon":nodeName="thought.nodeName":status="thought.status":elapsed="thought.elapsed"/><MsgContent:content="message.content":isFinal="message.isFinal":isPrintAnimate="!message.isFinal"/></div></template><script setup>import { ref } from 'vue'const message = ref({content: '',isFinal: true})const thoughts = ref([])</script>
<script setup>import { MsgContent, MsgThought } from 'lke-component-vue3'import 'lke-component-vue3/style.css'</script>
import { useState } from 'react'import { MsgContent, MsgThought } from 'lke-component/react'import 'lke-component/css' // must import styleexport default function Chat() {const [message, setMessage] = useState({content: '',isFinal: true})const [thoughts, setThoughts] = useState([])return (<div>{thoughts.map((thought, i) => (<MsgThoughtkey={i}content={thought.content}title={thought.title}titleIcon={thought.titleIcon}nodeName={thought.nodeName}status={thought.status}elapsed={thought.elapsed}detailVisible={thought.detailVisible}onTitleClick={() => {// Toggle unfold/collapseconst next = [...thoughts]next[i].detailVisible = !next[i].detailVisiblesetThoughts(next)}}/>))}<MsgContentcontent={message.content}isFinal={message.isFinal}isReplaceLinks={true}clazzMd="answer-md"/></div>)}
Feedback