• 製品
  • 料金
  • リソース
  • サポート
このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

大規模言語モデル(LLM)

Feature Overview

In Cascade (three-stage) mode, the LLM (Large Language Model) operates as the second stage in the conversation pipeline, serving as the core intelligence of the AI chatbot. The LLM receives user text transcribed by ASR, runs inference, and streams reply text, which is then synthesized and broadcast by TTS.
The LLM stage is integrated using a unified OpenAI-compatible protocol with no vendor lock-in:
Supports runtime hot updates, enabling dynamic model switching and prompt tuning during conversations.
Supports MCP tool invocation (Function Calling), allowing integration with RAG, business queries, and other advanced scenarios.
Supported LLMType values:
LLMType
Description
openai (recommended)
OpenAI-compatible protocol. Supports GPT series, DeepSeek, Alibaba Qwen, etc.
hunyuan
Tencent Hunyuan
deepseek
DeepSeek
custom
Self-hosted LLM gateway (must support OpenAI-compatible protocol)
Note:
In S2S (end-to-end) mode, speech understanding and generation are handled directly by an end-to-end model. There is no separate LLM stage, and LLMConfig configuration is not required.

Configuration Structure

To create an AI chat task, configure the LLM using LLMConfig. LLMConfig uses a flat field structure; vendor-specific extension parameters are passed via CustomFields and CustomHeaders.
Field Name
Required
Type
Description
LLMType
Yes
String
LLM integration type: openai (recommended) / hunyuan / deepseek / custom.
Model
Yes
String
Model name (e.g., gpt-4o-mini, hunyuan-lite).
APIKey
No
String
Vendor API Key.
Note:
Conditionally required. Can be omitted for test accounts; must be provided in production.
APIUrl
No
String
OpenAI-compatible endpoint.
Note:
Conditionally required. Can be omitted for test accounts; must be provided in production.
SystemPrompt
No
String
System prompt. Maximum length ≤ 5000.
FailureMessage
No
String
Fallback TTS text if LLM fails, prevents conversation interruption.
MaxTokens
No
Integer
Maximum tokens per reply. Default: 1024; 0 = unlimited.
ThinkingMode
No
Boolean
Enable thinking mode. Default: false.
MaxHistory
No
Integer
Conversation history cache rounds. Range: 0–1024, default: 30, recommended: 10–30.
MaxToolRound
No
Integer
Maximum MCP tool invocation rounds. Range: 0–50, default: 10.
Timeout
No
Integer
Request timeout (ms). Range: 1000–60000, default: 10000.
Temperature
No
Float
Sampling temperature: 0.0–2.0, default 1.0. Higher values increase randomness; lower values yield more deterministic output.
TopP
No
Float
Sampling probability: 0.0–1.0, default 1.0. Lower values increase determinism.
McpServer
No
Object
MCP tool definition. See McpServer Definition.
CustomHeaders
No
String
JSON string. Custom HTTP request headers.
CustomFields
No
String
JSON string. Vendor extension parameters, passed through as-is.
HistoryMessages
No
Array of Object
Initial history messages. Each item includes Role (user/assistant/system) and Content.

LLM Vendor Integration Examples

OpenAI-Compatible Protocol (Recommended)

Works with GPT series, DeepSeek, Alibaba Qwen, and any model offering an OpenAI-compatible interface:
"LLMConfig": {
"LLMType": "openai",
"Model": "gpt-4o-mini",
"APIKey": "<your-api-key>",
"APIUrl": "https://api.openai.com/v1/chat/completions",
"SystemPrompt": "You are a concise conversation assistant.",
"Timeout": 20000,
"Temperature": 0.7
}

Tencent Hunyuan

"LLMConfig": {
"LLMType": "hunyuan",
"Model": "hunyuan-lite",
"APIKey": "<your-api-key>",
"APIUrl": "<Hunyuan OpenAI-compatible endpoint, see official documentation>",
"SystemPrompt": "You are a concise conversation assistant.",
"Temperature": 0.7
}

DeepSeek

"LLMConfig": {
"LLMType": "deepseek",
"Model": "deepseek-chat",
"APIKey": "<your-api-key>",
"APIUrl": "<DeepSeek OpenAI-compatible endpoint, see official documentation>",
"SystemPrompt": "You are a concise conversation assistant.",
"Temperature": 0.7
}
Note:
Vendors such as DeepSeek and Alibaba Qwen also support the OpenAI protocol and can be integrated directly using LLMType=openai.

Custom LLM Gateway (custom)

Best for self-hosted LLM services, on-premise deployments, or scenarios requiring gateway-level RAG retrieval, web search, multi-model orchestration, and unified output:
1. Implement an HTTP interface compatible with the OpenAI Chat Completions protocol and set it as the APIUrl.
2. The gateway can freely implement business logic (knowledge base queries, sub-model invocation, etc.) as long as it returns a streaming response per protocol.
3. Pass authentication headers required for the gateway via CustomHeaders.
"LLMConfig": {
"LLMType": "custom",
"Model": "your-model",
"APIKey": "<your-gateway-key>",
"APIUrl": "https://your-custom-llm-gateway/v1/chat/completions",
"SystemPrompt": "Please answer user questions in a friendly tone based on knowledge base content.",
"Temperature": 0.7
}

Context Management

Initial History Messages (HistoryMessages)

When creating a task, you can inject initial context (such as user profile or prior conversation summary) using HistoryMessages. This allows the AI chatbot to start its first conversation with memory:
"HistoryMessages": [
{ "Role": "user", "Content": "My name is Xiao Wang, and I am a programmer." },
{ "Role": "assistant", "Content": "Nice to meet you, Xiao Wang!" }
]

Conversation History Cache (MaxHistory)

The backend automatically caches the most recent MaxHistory conversation rounds as context:
Range: 0–1024, default: 30, recommended: 10–30.
Higher values increase token usage and inference latency; lower values may result in loss of context in multi-turn conversations.

Active Text Injection

In addition to voice input, you can use the control interface's text injection command to add text to the conversation context at runtime and trigger an LLM response. For details, see Injecting Text to LLM or TTS.

Output Control

Method
Description
MaxTokens
Limits reply length per turn. Controls latency and cost. 0 = unlimited.
FailureMessage
Fallback text broadcast when LLM invocation fails. Prevents conversation interruption.
FilterBracketsContent
Filters bracketed content in LLM replies. Prevents actions/emotions from being read aloud by TTS.
Configure FilterBracketsContent in AgentConfig:
Value
Filtered Content
1
Chinese parentheses ()
2
English parentheses ()
3
Chinese square brackets 【】
4
English square brackets []
5
English curly braces {}
Note:
You can select up to five options. Typical use: LLM persona models often annotate actions/emotions as (smile), [happy], etc. Configuring this prevents TTS from reading them aloud.

Function Calling / MCP Tools

McpServer lets you configure MCP (Model Context Protocol) tool services, ideal for advanced conversation scenarios requiring business-side Function Calling or RAG retrieval:
"McpServer": {
"Name": "weather-tools",
"Url": "https://your-mcp-server/sse",
"Timeout": 5000,
"Headers": "{\"Authorization\":\"Bearer xxx\"}",
"ToolList": ["get_weather", "get_forecast"]
}
Field Name
Type
Description
Name
String
Unique MCP identifier.
Url
String
Integration address.
Timeout
Integer
Request timeout (ms). Default: 5000.
Headers
String
JSON string. Custom request headers (authentication, etc.).
ToolList
Array of String
Tool allowlist.
The number of tool invocation rounds is limited by MaxToolRound (range 0–50, default 10).

Runtime Hot Update

All fields in LLMConfig support hot updates—you can update the task interface at runtime to:
Switch models (Model, LLMType)
Modify system prompts (SystemPrompt) and sampling parameters (Temperature, TopP)
Adjust conversation history cache rounds (MaxHistory)
Note:
Update requests must include a SequenceNumber (monotonically increasing), ensuring the backend processes updates in order. Updates with non-increasing sequence numbers will be rejected. This is different from ASR/TTS/Vision configuration, which do not support hot updates and require task recreation.

Notes

APIKey and APIUrl are required in production; otherwise, LLM invocation will fail.
VLM (Visual Language Model) requirements: To enable visual understanding, Model must be a multimodal model (e.g., hunyuan-vision, gpt-4o, gpt-4o-mini, qwen-vl-plus). See Visual Understanding Capabilities for more information.
Reply retrieval methods:
Server-side: When an LLM reply is completed, the server receives the final reply text (including round ID) via LLM reply callback. See AI Conversation Callback Events.
Client-side: LLM reply text is available in real time via SDK subtitle events. See Client Real-Time Subtitles.
Timeout setting: The default Timeout is 10000ms. If thinking mode is enabled or model inference is slow, increase this value to avoid reply interruption due to timeout.
Cost control: MaxTokens and MaxHistory directly affect token usage. Adjust these values to fit your business requirements.