


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}}]
Name | Type | Required or Not | Description |
request_id | string(255) | Yes | Request ID, used to identify a request (concatenate messages, recommend using a different request_id per request). |
session_id | string(64) | Yes | Session ID, used to identify a session (provided by the external system, recommend importing different session_id for different user clients, otherwise messages from different users within the same application may get mixed up). Parameter length: 2-64 characters Verification rule: ^[a-zA-Z0-9_-]{2,64}$. You can use uuid to generate this value. uuid example: 1b9c0b03-dc83-47ac-8394-b366e3ea67ef |
content | string(6000) | Yes | Message content. If sending a picture, transmit the image link in markdown format, such as . The image link must be public read. |
file_infos | Object array | No | File information. If you fill this field, the content field can be left blank. 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. These parameters can be recognized and used by the workflow. For details, refer to the operation instructions of the start node. The value of custom API parameters. Multiple key:value pairs can be configured, where key is the parameter name and value is the runtime value of the corresponding parameter. Note: The key and value types of the map are string, such as {"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}}"} Set knowledge base search scope scenario: Custom parameters are used to set the knowledge base search scope. 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(2000) | No | Role directive (Note): Use the application configuration default setting when empty, or take the current value when filled. Maximum value limit: Different models have differences in maximum value. Refer to the ListModel API RoleLenLimit. |
incremental | bool | No | Control whether the content in reply and thinking events is incrementally output. Default false. Note: Set this field to true to take effect only for reply and thinking events. Reply event effect: ![]() Thinking event effect: ![]() |
search_network | string | No | Whether online search is enabled. Value ranges from...to... empty string: follow application configuration enable: Turn on online search disable: Turn off online search Note: The value field is meaningless when online search is not enabled in application configuration. |
model_name | string | No | Support importing specified models during the dialogue process. Using different model names under the same session_id maintains context correlation. The following custom models are currently supported: lke-deepseek-r1:DeepSeek-R1 lke-deepseek-v3:DeepSeek-V3 lke-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 and is selected by default) enable: Enable workflow disable: Disable workflow |
Name | Type | Required or Not | Description |
file_name | string | Yes | File 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 (concatenate 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) | Unique ID of associated messages |
session_id | string(64) | Session ID, used to identify a session (provided by the external system, recommend importing different session_id for different user clients, 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 message output is complete In streaming mode, messages are returned multiple times, each time overwriting the previous answer When is_final == true, the stop generation button hides and the like/dislike buttons appear |
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 detection result. Normal business logic processing begins only after sensitivity detection is passed. ![]() |
is_llm_generated | bool | Whether the model generates content |
reply_method | uint8 | Response method: 1: large model reply 2: unknown question reply 3: refused question reply 4: sensitive reply 5: accepted Q&A pair precedence reply 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 |
custom_params | string array | User-customized business parameters for passing through QA business parameters Description: This field may be empty. If empty, the field does not return. |
task_flow | Object | Task flow debugging information Description: This field may be empty. If empty, the field does not return. |
work_flow | Object | Workflow debugging info Description: This field may be empty. If empty, the field does not return. |
quote_infos | Object array | Quoted information. |
Name | Type | Description |
id | string | Hit knowledge ID |
type | uint32 | Hit knowledge type: 1: QA 2: Document fragment |
seg_id | string | Segment ID, view segment details via the DescribeSegments API |
Name | Type | Description |
workflow_name | string | workflow name |
workflow_id | string | Flow ID |
qworkflow_run_id | string | Flow running ID |
option_cards | string array | tab |
current_node | Object | Node Information |
outputs | string array | Output Results |
Name | Type | Description |
NodeID | string | Node ID |
NodeType | int32 | Node type: 0: unspecified 1: start node 2: Parameter extraction node 3: model node 4: knowledge q&a node 5: knowledge retrieve node 6: Tag extraction node 7: code execution node 8: tool node 9: Logic judgment node 10: reply node → message node 11: tab node 12: loop node 13: intent recognition node 14: workflow node 15: plug-in node 16: end node |
NodeName | string | Node name |
Status | int32 | Status: 0: initial state 1: Running 2: executed successfully 3: execution failed |
Input | string | Node input. json string (including ordinary string) |
Output | string | Final node output. json string (including ordinary string) |
TaskOutput | string | Task output. (Original output) |
FailMessage | string | exception information |
CostMilliSeconds | string | Total node duration. If the node is called multiple times, the duration is the sum of all calls. |
Reply | string | Reply content of the current node. Parameter extraction, message node, and reply end node may not be empty. |
BelongNodeID | string | The ID of the referenced node when the associated workflow is referenced. The workflow to which the task belongs is non-empty when referenced. |
StatisticInfo | Object | LLM statistical information |
Name | Type | Description |
ModelName | string | Model Name |
FirstTokenCost | uint32 | Duration of first token |
TotalCost | uint32 | Reasoning total time |
InputTokens | uint32 | token count |
OutputTokens | uint32 | token count |
TotalTokens | uint32 | input + output tokens |
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 | Current conversation status: processing, success, failed |
status_summary_title | string | Current conversation status description |
elapsed | int | Call duration, ms |
token_count | int | Token consumption in this round's request (when containing multiple processes, calculations will be aggregated) |
procedures | Object array | Invocation process list |
Name | Type | Description |
name | string | English name, one-to-one with the title field knowledge, large_language_model |
title | string | Invocation process description, corresponding to the name field, with Chinese meanings as follows: Call the knowledge base, large model reply |
status | string | Invocation process status: processing, success, 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": "Calling 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": "Calling the Knowledge Base","token_count": 323,"used_count": 553},"message_id": "89d91395-06bc-4f2e-b240-06f7b4498b0c6e"}]
Name | Type | Required or Not | Description |
record_id | string(64) | Yes | Message ID (message ID of the rated reply event) |
score | uint8 | Yes | Score Like Create and bind policy Query instance Reset instance access password |
reasons | string array | No | Reasons (user feedback, can have multiple) |
Name | Type | Required or Not | Description |
record_id | string(64) | Yes | Message ID (message ID of the reply event message that needs to be stopped) |
Name | Type | Description |
record_id | string(64) | Unique message ID |
references | Object array | Reference source |
Name | Type | Description |
id | uint64 | The ID usage method 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 reference source details. If needed, you can obtain corresponding parameters through the above API and concatenate them for redirection: https://lke.tencentcloud.com/preview?id=${docid}&botBizId=${appid}&page=${page number of the redirected 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 means multiple reference serial numbers. |
type | uint32 | Reference source type 1: Q&A 2: Document fragment 4: Online retrieved content 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 address set for opening the external reference link of the document. When type = 4, this url is the source address retrieved from online search. |
name | string | Reference source name |
doc_id | uint64 | Reference source document ID |
doc_biz_id | uint64 | Reference source document business ID. You can call the Document Detail API to check the basic information of the corresponding document. |
doc_name | string | Reference source document name |
qa_biz_id | string | Reference source 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 stories.docx""id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name": "100 idioms and their historical stories + (1)""qa_biz_id": "0","type": 2,"url": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}],"trace_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},"message_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]
Name | Type | Description |
request_id | string(255) | Request ID, used to identify a request (concatenate 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, ms |
is_workflow | bool | Whether it is a 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 array | Debug process information |
index | uint32 | Process index |
name | string | English name, one-to-one with the title field |
title | string | Invocation process description, corresponding to the name field, with Chinese meanings as follows: call the knowledge base, large model reply, thinking |
status | string | Status: processing - active, success - successful, failed - failed |
icon | string | Icon, used for show |
switch | string | whether to switch 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. Unit: ms. |
Name | Type | Description |
content | string | Debug output |

["thought",{"type": "thought","payload": {"elapsed": 0,"is_workflow": false,"procedures": [{"debugging": {The user is asking about the features of DeepSeek-R1 for the third time. The previous two responses already detailed its high efficiency, long-context processing, versatility across multiple fields, security compliance, multilingual support, flexible deployment, and cost-effectiveness. Possible reasons for repeating the question include: - The user may not fully understand the previous answers and needs a more concise summary. - They might want to confirm the accuracy of the information. - They could be checking for updates. - They may be testing response consistency. - They might need the information for a specific purpose, such as a report or comparing different models. Next steps: - Verify if previous responses were comprehensive, covering aspects like training data, supported frameworks, and performance metrics. - Check if technical details (model structure, training methods, or practical applications) might be of interest.},"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, see 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 | fail to render |
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 | Message like/dislike failed |
460024 | Invalid tag |
460025 | Image Analysis failed |
460031 | Current application connections exceed the request limit. Try again later. |
460032 | Insufficient balance for the current application model |
460033 | Application does not exist or insufficient permissions |
460034 | Content too long |
460035 | Compute content too long, stopped |
460036 | Process node preview parameter exception |
460037 | Search for resource used up, call failed |
460038 | The AppID request shows abnormal behavior, call failed |
Feedback