WebSocket client event reference for Qwen-Audio-3.0-ASR-Flash-Streaming/Fun-ASR-Realtime real-time speech recognition
This topic describes the client events that the client sends to the server over WebSocket in the Qwen-Audio-3.0-ASR-Flash-Streaming/Fun-ASR-Realtime real-time speech recognition service, including the data structures and field definitions for run-task (start a task) and finish-task (end a task).
User guide: For model descriptions and selection guidance, see Speech-to-text models.
Event interaction flow: For the event interaction sequence, see WebSocket API.
run-task
Description: Starts a speech recognition task and sets parameters such as the model, audio format, and sample rate. When to send: Send immediately after the WebSocket connection is established. Response event: You can send audio only after the server returns the task-started event.Example
Copy
{
"header": {
"action": "run-task",
"task_id": "2bf83b9a-baeb-4fda-8d9a-xxxxxxxxxxxx",
"streaming": "duplex"
},
"payload": {
"task_group": "audio",
"task": "asr",
"function": "recognition",
"model": "qwen-audio-3.0-asr-flash-streaming",
"parameters": {
"format": "pcm",
"sample_rate": 16000
},
"input": {}
}
}
With context
Copy
{
"header": {
"action": "run-task",
"task_id": "2bf83b9a-baeb-4fda-8d9a-xxxxxxxxxxxx",
"streaming": "duplex"
},
"payload": {
"task_group": "audio",
"task": "asr",
"function": "recognition",
"model": "qwen-audio-3.0-asr-flash-streaming",
"parameters": {
"format": "pcm",
"sample_rate": 16000
},
"input": {
"context": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Hello there"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello, I am Qwen. How can I help you?"
}
]
}
]
}
}
}
Instant hot words
Copy
{
"header": {
"action": "run-task",
"task_id": "2bf83b9a-baeb-4fda-8d9a-xxxxxxxxxxxx",
"streaming": "duplex"
},
"payload": {
"task_group": "audio",
"task": "asr",
"function": "recognition",
"model": "qwen-audio-3.0-asr-flash-streaming",
"parameters": {
"format": "pcm",
"sample_rate": 16000,
"vocabulary": {"John Smith": 5, "Jane Doe": 5}
},
"input": {}
}
}
object
body
required
object
body
required
Message payload.
Show properties
Show properties
string
body
required
The task group. Set to
audio.string
body
required
The task type. Set to
asr.string
body
required
The function type. Set to
recognition.string
body
required
The model name. The Qwen-Audio-3.0-ASR-Flash-Streaming and Fun-ASR-Realtime model series are supported. For details, see Supported models.
object
body
required
The input object. Pass
{} when no context is provided.Only the
qwen-audio-3.0-asr-flash-streaming, fun-asr-realtime, and fun-asr-realtime-2025-11-07 models support context.Show properties
Show properties
array(object)
body
The conversation context, which improves recognition accuracy for domain-specific vocabulary. For usage details, see Context enhancement.
Limits: You can provide at most 5 context messages of each type (
input_text and text). If you exceed this limit, only the 5 most recent messages are kept. The total text length per turn (the combined length of the text fields of the user and assistant messages) cannot exceed 400 characters (counted by character, where each character counts as 1). Text beyond this limit is truncated from the end.When you provide context, the messages in
context must follow a specific order. Context messages must be arranged by conversation turn, and within each turn the user message (of type input_text) must come before its corresponding assistant message (of type text).Show properties
Show properties
string
body
required
The message role. Valid values:
user: The recognition results from previous turns of user speech, or a domain-specific word list.assistant: The responses from the large language model in previous turns.
array(object)
body
required
The list of message contents.
Show properties
Show properties
string
body
required
The content type. Valid values:
input_text: The recognition results from previous turns of user speech, or a domain-specific word list (used when role is user). You must also provide thetextfield.text: The responses from the large language model in previous turns (used when role is assistant). You must also provide thetextfield.
string
body
required
The text content. When
type is input_text, enter the recognition results from previous turns of user speech or a domain-specific word list. When type is text, enter the responses from the large language model in previous turns.object
body
required
The speech recognition parameters.
Show properties
Show properties
string
body
required
The audio format. Valid values:
pcm, wav, mp3, opus, speex, aac, amr.opus/speex: Must use Ogg encapsulation. wav: Must use PCM encoding. amr: Only the AMR-NB type is supported.
integer
body
required
The sample rate, in Hz. 8 kHz models support only 8000 Hz; other models support any sample rate.
string
body
The ID of a precompiled hot word list.Generate this ID in advance by calling the create hot word list API. Pass the ID during recognition to use the hot words in the list.Suitable for scenarios where the vocabulary is known and relatively stable, and where you need to reuse the same word list across requests.For usage details, see Precompiled hotwords.
object
body
Instant hot words.Passed as key-value pairs, where the key is the hot word text (
string) and the value is the hot word weight (integer). No hot word list needs to be created in advance. The weight ranges from [1, 5] or is set to 50: a value in [1, 5] makes the model more likely to output the word as the value increases; a value of 50 designates a super hot word, which greatly improves recall, but the number of super hot words cannot exceed 50.Suitable for temporary, session-level hot word optimization.When configured together with precompiled hot words, only the instant hot words take effect. For usage details, see Instant hotwords.Only
qwen-audio-3.0-asr-flash-streaming supports instant hot words.array[string]
body
The language of the audio to recognize. There is no default value; if not set, the model detects the language automatically.For the Qwen-Audio-3.0-ASR-Flash-Streaming model series, you can set up to 4 values; if you set more than 4, only the first 4 take effect. For the Fun-ASR-Realtime model series, you can set only 1 value; if you set multiple values, only the first one takes effect.
Show Click to view the supported language codes
Show Click to view the supported language codes
- qwen-audio-3.0-asr-flash-streaming, fun-asr-realtime, fun-asr-realtime-2025-11-07:
zh(Chinese),en(English),ja(Japanese),ko(Korean),vi(Vietnamese),th(Thai),id(Indonesian),ms(Malay),tl(Filipino),hi(Hindi),ar(Arabic),fr(French),de(German),es(Spanish),pt(Portuguese),ru(Russian),it(Italian),nl(Dutch),sv(Swedish),da(Danish),fi(Finnish),no(Norwegian),el(Greek),pl(Polish),cs(Czech),hu(Hungarian),ro(Romanian),bg(Bulgarian),hr(Croatian),sk(Slovak) - fun-asr-realtime-2026-02-28:
zh(Chinese),en(English),ja(Japanese) - fun-asr-realtime-2025-09-15:
zh(Chinese),en(English) - fun-asr-flash-8k-realtime, fun-asr-flash-8k-realtime-2026-01-28:
zh(Chinese)
boolean
body
Whether to enable semantic segmentation. Default value:
false.true: Enables semantic segmentation and disables VAD segmentation. More accurate, better suited to meeting transcription scenarios.false(default): Enables VAD segmentation and disables semantic segmentation. Lower latency, better suited to interactive scenarios.
integer
body
The VAD silence threshold for segmentation, in ms. When the silence after a segment of speech exceeds this threshold, the system determines that the sentence has ended. When
semantic_punctuation_enabled is set to true, this parameter is not used as the criterion for returning sentence_end, but setting it too low may affect recognition performance. Default value: 1300. Valid values: [200, 6000].boolean
body
Whether to enable multi-threshold mode. When enabled, this prevents VAD segments from becoming too long. Default value:
false.Takes effect only when
semantic_punctuation_enabled is false.boolean
body
Whether to enable heartbeat packets. Default value:
false.true: Keeps the connection to the server alive even when silent audio is sent continuously.false(default): Even when silent audio is continuously sent, the connection times out and closes after a period of time.
float
body
The threshold for distinguishing speech from noise, used to adjust the sensitivity of Voice Activity Detection (VAD). Valid values: [-1.0, 1.0].
- The closer the value is to -1: The noise threshold decreases, so noise is more likely to be recognized as speech, which may cause more noise to be transcribed.
- The closer the value is to +1: The noise threshold increases, so speech is more likely to be misjudged as noise, which may cause some speech to be filtered out.
This is an advanced configuration parameter. Adjusting it can significantly affect recognition results. Thoroughly test and verify the results before adjusting. Adjust in small increments based on the actual audio environment (a step of 0.1 is recommended).
string
body
Specifies the sensitive words to process during speech recognition, and supports setting different processing methods for different sensitive words. For details, see Sensitive word filtering.
continue-task
Description: Updates the conversation context during task execution to improve recognition. When to send: Send during task execution when you need to update the conversation context.Only the
qwen-audio-3.0-asr-flash-streaming, fun-asr-realtime, and fun-asr-realtime-2025-11-07 models support this event.Example
Copy
{
"header": {
"action": "continue-task",
"task_id": "2bf83b9a-baeb-4fda-8d9a-xxxxxxxxxxxx",
"streaming": "duplex"
},
"payload": {
"input": {
"context": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Hello there"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello, I am Qwen. How can I help you?"
}
]
}
]
}
}
}
object
body
required
object
body
required
Message payload.
Show properties
Show properties
object
body
required
The input object.
Show properties
Show properties
array(object)
body
The conversation context, which improves recognition accuracy for domain-specific vocabulary.
Limits: You can provide at most 5 context messages of each type (
input_text and text). If you exceed this limit, only the 5 most recent messages are kept. The total text length per turn (the combined length of the text fields of the user and assistant messages) cannot exceed 400 characters (counted by character, where each character counts as 1). Text beyond this limit is truncated from the end.When you provide context, the messages in
context must follow a specific order. Context messages must be arranged by conversation turn, and within each turn the user message (of type input_text) must come before its corresponding assistant message (of type text).Show properties
Show properties
string
body
required
The message role. Valid values:
user: The recognition results from previous turns of user speech, or a domain-specific word list.assistant: The responses from the large language model in previous turns.
array(object)
body
required
The list of message contents.
Show properties
Show properties
string
body
required
The content type. Valid values:
input_text: The recognition results from previous turns of user speech, or a domain-specific word list (used when role is user). You must also provide thetextfield.text: The responses from the large language model in previous turns (used when role is assistant). You must also provide thetextfield.
string
body
required
The text content. When
type is input_text, enter the recognition results from previous turns of user speech or a domain-specific word list. When type is text, enter the responses from the large language model in previous turns.finish-task
Description: Notifies the server that all audio has been sent and requests to end the task. When to send: Send after all audio data has been sent. Response event: The server returns the task-finished event.Example
Copy
{
"header": {
"action": "finish-task",
"task_id": "2bf83b9a-baeb-4fda-8d9a-xxxxxxxxxxxx",
"streaming": "duplex"
},
"payload": {
"input": {}
}
}
object
body
required