header 参数:
| 参数 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| header.action | string | 是 | 指令类型。设为 run-task。 |
| header.task_id | string | 是 | 唯一任务 ID。在 finish-task 指令中须使用相同值。 |
| header.streaming | string | 是 | 通信模式。设为 duplex。 |
payload 参数:
| 参数 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| payload.task_group | string | 是 | 任务组。设为 audio。 |
| payload.task | string | 是 | 任务类型。设为 asr。 |
| payload.function | string | 是 | 功能类型。设为 recognition。 |
| payload.model | string | 是 | 模型名称。请参见模型列表。 |
| payload.input | object | 是 | 输入配置。设为 {}。 |
| payload.parameters | |||
| format | string | 是 | 音频格式:pcm、wav、mp3、opus、speex、aac、amr。详见 WebSocket API 音频要求。 |
| sample_rate | integer | 是 | 音频采样率,单位 Hz。推荐使用 16000 Hz。 |
| vocabulary_id | string | 否 | 热词表 ID,用于热词识别。详见自定义热词。 |
| semantic_punctuation_enabled | boolean | 否 | 是否启用语义标点。默认值:false。- true:高精度标点,适用于会议场景。启用后将禁用 VAD 标点。- false:低延迟 VAD 标点,适用于交互场景。语义标点在断句准确性上更优,VAD 标点响应更快。 |
| max_sentence_silence | integer | 否 | VAD 静音阈值,单位毫秒。静音时长超过此值时断句。默认值:1300。取值范围:[200, 6000]。仅在 semantic_punctuation_enabled 为 false 时生效。 |
| multi_threshold_mode_enabled | boolean | 否 | 防止 VAD 模式下产生过长语句。默认值:false。仅在 semantic_punctuation_enabled 为 false 时生效。 |
| heartbeat | boolean | 否 | 是否启用保活。默认值:false。- true:持续发送静音音频时保持连接不断开。- false:连续 60 秒发送静音音频后连接超时断开。 |
| language_hints | array[string] | 否 | 识别语言代码。不设置时自动检测语言。支持的语言代码:zh(中文)、en(英文)、ja(日文)。 |
| speech_noise_threshold | float | 否 | 语音噪声检测阈值,用于调节 VAD 灵敏度。取值范围:[-1.0, 1.0]。接近 -1:更多噪声可能被识别为语音。接近 +1:部分语音可能被过滤为噪声。 |
speech_noise_threshold 是高级参数,微小的调整会显著影响识别质量。建议以 0.1 为步长逐步调整,并充分测试。header 参数:
| 参数 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| header.action | string | 是 | 指令类型。设为 finish-task。 |
| header.task_id | string | 是 | 任务 ID。须与 run-task 指令中的 task_id 一致。 |
| header.streaming | string | 是 | 通信模式。设为 duplex。 |
payload 参数:
| 参数 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| payload.input | object | 是 | 输入配置。设为 {}。 |