通過HTTP API管理定製熱詞列表,包括建立、查詢、更新和刪除熱詞列表。
使用者指南:提升識別準確率。熱詞列表數量上限等使用限制詳見熱詞限制與計費。
重要僅主業務空間支援熱詞功能,子業務空間暫不支援。
介面地址
新加坡
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customization
調用時請將{WorkspaceId}替換為真實的業務空間ID。
華北2(北京)
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/asr/customization
調用時請將{WorkspaceId}替換為真實的Workspace ID。
重要阿里雲百鍊為華北2(北京)、新加坡地區推出了業務空間專屬網域名稱,能夠為推理請求提供卓越的效能和更高的穩定性,建議遷移至新網域名稱:
- 華北2(北京)地區:從
dashscope.aliyuncs.com 遷移至 {WorkspaceId}.cn-beijing.maas.aliyuncs.com
- 新加坡地區:從
dashscope-intl.aliyuncs.com 遷移至 {WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
{WorkspaceId}需要替換為真實的Workspace ID。現有網域名稱仍可正常使用。
要求標頭
參數 | 類型 | 是否必選 | 說明 |
|---|
Authorization | string | 是 | 鑒權令牌,格式為Bearer <your_api_key>,使用時,將“<your_api_key>”替換為實際的API Key。 |
Content-Type | string | 是 | 請求體的媒體類型,固定為application/json。 |
建立熱詞列表
請求體 modelstring(必選) 定製熱詞模型,固定為speech-biasing。 inputobject(必選) 輸入參數對象。 屬性 action string(必選) 操作類型,固定為create_vocabulary。 target_model string(必選) 使用熱詞列表的語音辨識模型,必須與後續調用語音辨識介面時使用的模型一致。 prefix string(必選) 熱詞列表自訂首碼,僅允許數字和小寫字母,長度不超過10個字元。 vocabulary array[object](必選) 熱詞列表數組。 屬性 text string(必選) 熱詞文本。 熱詞文本的語言必須在所選模型的支援範圍內,不同模型支援的語言各不相同。 熱詞用於提升識別的準確率,請使用實際詞語而非任一字元組合。 長度限制:含非 ASCII 字元時不超過 15 個字元;純 ASCII 時空格分隔片段不超過 7 個。 weight integer(必選) 熱詞權重。常用值:4。 取值範圍:[1, 5]。 如果效果不明顯,可以適當增加權重,但權重過大可能產生負面效果,導致其他詞語識別不準確。 lang string(可選) 待識別音訊語言代碼。設定後,系統將對指定語種進行熱詞識別增強。如果無法提前確定語種,可不設定,模型會自動識別語種。 取值範圍(因模型而異):
-
Paraformer:
- zh: 中文
- en: 英文
- ja: 日語
- yue: 粵語
- ko: 韓語
- de:德語
- fr:法語
- ru:俄語
-
Fun-ASR:
| 以下為新加坡地區的配置,調用時請將"{WorkspaceId}"替換為真實的業務空間ID,各地區的配置不同。 新加坡地區和北京地區的API Key不同,詳情請參見擷取API Key。 curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-biasing",
"input": {
"action": "create_vocabulary",
"target_model": "fun-asr",
"prefix": "testpfx",
"vocabulary": [
{"text": "賽德克巴萊", "weight": 4}
]
}
}'
|
返回體 request_idstring 本次調用的唯一識別碼。 outputobject 模型返回的資料。 屬性 vocabulary_idstring 建立的熱詞列表ID。 usageobject 本次請求用量資訊。 屬性 count integer 建立的熱詞列表數量,固定為1。 | {
"output": {
"vocabulary_id": "vocab-testpfx-5112c3de3705486baxxxxxxx"
},
"usage": {
"count": 1
},
"request_id": "aee47022-2352-40fe-acfa-xxxx"
}
|
批量查詢熱詞列表
請求體 modelstring(必選) 定製熱詞模型,固定為speech-biasing。 inputobject(必選) 輸入參數對象。 屬性 action string(必選) 操作類型,固定為list_vocabulary。 prefix string(可選) 熱詞列表自訂首碼,如果設定則只返回指定首碼的熱詞列表。 page_index integer 頁碼索引,從0開始計數。 預設值:0。 page_size integer 每頁包含資料條數。 預設值:10。 | 以下為新加坡地區的配置,調用時請將"{WorkspaceId}"替換為真實的業務空間ID,各地區的配置不同。 新加坡地區和北京地區的API Key不同,詳情請參見擷取API Key。 curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-biasing",
"input": {
"action": "list_vocabulary",
"prefix": "testpfx",
"page_index": 0,
"page_size": 10
}
}'
|
返回體 request_idstring 本次調用的唯一識別碼。 outputobject 模型返回的資料。 屬性 vocabulary_listarray[object] 查詢到的熱詞列表。 屬性 vocabulary_idstring 熱詞列表ID。 gmt_createstring 建立時間。 gmt_modifiedstring 修改時間。 statusstring 狀態: usageobject 本次請求用量資訊。 | {
"output": {
"vocabulary_list": [
{
"gmt_create": "2026-03-02 18:07:38",
"gmt_modified": "2026-03-02 18:07:38",
"status": "OK",
"vocabulary_id": "vocab-ciotest-8e74bef2accf4xxxxxxxx"
},
{
"gmt_create": "2026-02-27 19:04:48",
"gmt_modified": "2026-02-28 13:40:40",
"status": "OK",
"vocabulary_id": "vocab-sifasr-f483ad46e1844fxxxxxxxx"
}
]
},
"usage": {
"count": 1
},
"request_id": "81d51a05-8cdd-45c0-973f-xxxxxxxx"
}
|
查詢熱詞列表
請求體 modelstring(必選) 定製熱詞模型,固定為speech-biasing。 inputobject(必選) 輸入參數對象。 屬性 action string(必選) 操作類型,固定為query_vocabulary。 vocabulary_id string(必選) 需要查詢的熱詞列表ID。 | 以下為新加坡地區的配置,調用時請將"{WorkspaceId}"替換為真實的業務空間ID,各地區的配置不同。 新加坡地區和北京地區的API Key不同,詳情請參見擷取API Key。 curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-biasing",
"input": {
"action": "query_vocabulary",
"vocabulary_id": "vocab-testpfx-xxxx"
}
}'
|
返回體 request_idstring 本次調用的唯一識別碼。 outputobject 模型返回的資料。 屬性 gmt_createstring 建立時間。 gmt_modifiedstring 修改時間。 statusstring 狀態: target_model string 使用熱詞列表的語音辨識模型,必須與後續調用語音辨識介面時使用的模型一致。 vocabularyarray[object] 查詢到的熱詞列表。 屬性 text string 熱詞文本。 weight integer 熱詞權重。 lang string 待識別音頻語種。 usageobject 本次請求用量資訊。 | {
"output": {
"gmt_create": "2025-12-19 11:47:11",
"gmt_modified": "2025-12-19 11:47:11",
"status": "OK",
"target_model": "fun-asr",
"vocabulary": [
{
"lang": "zh",
"text": "賽德克巴萊",
"weight": 4
}
]
},
"usage": {
"count": 1
},
"request_id": "3d461d3f-b2c4-4de5-xxxx"
}
|
更新熱詞列表
請求體 modelstring(必選) 定製熱詞模型,固定為speech-biasing。 inputobject(必選) 輸入參數對象。 屬性 action string(必選) 操作類型,固定為update_vocabulary。 vocabulary_id string(必選) 需要更新的熱詞列表ID。 vocabulary array[object](必選) 新的熱詞列表,將完全替換原有內容。 屬性 text string(必選) 熱詞文本。 熱詞文本的語言必須在所選模型的支援範圍內,不同模型支援的語言各不相同。 熱詞用於提升識別的準確率,請使用實際詞語而非任一字元組合。 長度限制:含非 ASCII 字元時不超過 15 個字元;純 ASCII 時空格分隔片段不超過 7 個。 weight integer(必選) 熱詞權重。常用值:4。 取值範圍:[1, 5]。 如果效果不明顯,可以適當增加權重,但權重過大可能產生負面效果,導致其他詞語識別不準確。 lang string(可選) 待識別音訊語言代碼。設定後,系統將對指定語種進行熱詞識別增強。如果無法提前確定語種,可不設定,模型會自動識別語種。 取值範圍(因模型而異):
-
Paraformer:
- zh: 中文
- en: 英文
- ja: 日語
- yue: 粵語
- ko: 韓語
- de:德語
- fr:法語
- ru:俄語
-
Fun-ASR:
| 以下為新加坡地區的配置,調用時請將"{WorkspaceId}"替換為真實的業務空間ID,各地區的配置不同。 新加坡地區和北京地區的API Key不同,詳情請參見擷取API Key。 curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-biasing",
"input": {
"action": "update_vocabulary",
"vocabulary_id": "vocab-testpfx-xxx",
"vocabulary": [
{"text": "賽德克巴萊", "weight": 4, "lang": "zh"}
]
}
}'
|
返回體 request_idstring 本次調用的唯一識別碼。 outputobject 模型返回的資料,固定為空白。 usageobject 本次請求用量資訊。 屬性 count integer 更新的熱詞列表數量,固定為1。 | {
"output": {},
"usage": {
"count": 1
},
"request_id": "aee47022-2352-40fe-acfa-xxxx"
}
|
刪除熱詞列表
請求體 modelstring(必選) 定製熱詞模型,固定為speech-biasing。 inputobject(必選) 輸入參數對象。 屬性 action string(必選) 操作類型,固定為delete_vocabulary。 vocabulary_id string(必選) 需要刪除的熱詞列表ID。 | 以下為新加坡地區的配置,調用時請將"{WorkspaceId}"替換為真實的業務空間ID,各地區的配置不同。 新加坡地區和北京地區的API Key不同,詳情請參見擷取API Key。 curl -X POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-biasing",
"input": {
"action": "delete_vocabulary",
"vocabulary_id": "vocab-testpfx-xxx"
}
}'
|
返回體 request_idstring 本次調用的唯一識別碼。 outputobject 模型返回的資料,固定為空白。 usageobject 本次請求用量資訊。 屬性 count integer 刪除的熱詞列表數量,固定為1。 | {
"output": {},
"usage": {
"count": 1
},
"request_id": "aee47022-2352-40fe-acfa-xxxx"
}
|