阿里雲百煉 CLI 語音合成(TTS)、語音識別(ASR)與熱詞詞彙表管理的命令速查。
一條命令即可在終端機呼叫阿里雲百煉語音合成與識別能力,並管理熱詞詞彙表以提升識別準確率。
將文字合成為語音。需要 API Key 鑑權。
語法
範例:預覽可用音色列表
識別音頻檔案中的語音(FunAudio-ASR / Qwen-ASR Flash)。需要 API Key 鑑權。
語法
範例:識別指定音頻檔案中的語音
管理可重複使用的預建構熱詞詞彙表,提升 ASR 對專有名詞的識別準確率。
建立用於語音識別的預編譯熱詞表。需要 API Key 鑑權。
語法
範例:建立指定前綴的熱詞表
列出預編譯熱詞表。需要 API Key 鑑權。
語法
範例:列出指定前綴的熱詞表
檢視預編譯熱詞表詳情。需要 API Key 鑑權。
語法
範例:查詢特定熱詞詞彙表的詳細資訊
取代預先編譯熱詞詞彙表的內容。需要 API Key 認證。
語法
範例:預覽以指定熱詞更新熱詞詞彙表
刪除預先編譯的熱詞詞彙表。需要 API Key 認證。
語法
範例:預覽刪除熱詞表
語音合成
bl speech synthesize
將文字合成為語音。需要 API Key 鑑權。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--text <text> | string | 否 | 要合成為語音的文字(也可使用 --text-file) |
--text-file <path> | string | 否 | 從檔案讀取文字,而非使用 --text |
--model <model> | string | 否 | 模型 ID(預設:Profile 配置的 TTS 模型,否則為 qwen-audio-3.1-tts-flash)。系統音色因模型而異;使用 CosyVoice 音色時需明確指定 cosyvoice-v3-flash |
--voice <voice> | string | 否 | 音色 ID。使用 --list-voices 查看所選模型的內建音色(如 qwen-audio-3.1-tts-flash/plus、qwen-audio-3.0-tts-plus/flash、cosyvoice-v3-flash);使用 v3.5-flash 時需提供複製/設計音色 ID |
--list-voices | switch | 否 | 列出所選模型的內建系統音色並退出(輸出中會顯示控制台連結) |
--format <format> | string | 否 | 音頻格式:mp3、pcm、wav、opus(預設:mp3;串流模式預設:pcm) |
--sample-rate <rate> | string | 否 | 音頻採樣率,單位為 Hz(例如 24000) |
--volume <volume> | string | 否 | 音量 0–100(預設:50) |
--rate <rate> | string | 否 | 語速 0.5–2.0(預設:1.0) |
--pitch <pitch> | string | 否 | 音高倍數 0.5–2.0(預設:1.0) |
--seed <seed> | string | 否 | 用於重現合成結果的隨機種子 0–65535 |
--language <lang> | string | 否 | 語言提示(例如 zh、en、ja、ko、fr、de) |
--instruction <text> | string | 否 | 用於控制語音風格的自然語言指令(例如「使用溫柔的語氣」) |
--enable-ssml | switch | 否 | 解析輸入文字中的 SSML 標記 |
--out <path> | string | 否 | 將音頻儲存至檔案(預設:在臨時目錄中自動產生路徑) |
--stream | switch | 否 | 將原始 PCM 音頻串流輸出至 stdout(可透過管道傳給播放器) |
--concurrent <n> | number | 否 | 平行發送 N 個請求(預設:1) |
--model auto透過百煉自研 MCP 自動路由 AIGC 模型,只使用 MCP 工具支援的文字和音色參數。不相容的參數(如--format、--sample-rate、--stream)直接傳回用法錯誤,不會回退到 REST 呼叫。- 串流輸出指定 JSON 格式時,需透過
--out指定儲存檔案,避免音訊資料與 JSON 結果混在同一輸出串流。
語音識別
bl speech recognize
識別音頻檔案中的語音(FunAudio-ASR / Qwen-ASR Flash)。需要 API Key 鑑權。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--url <url> | array | 是 | 音頻檔案 URL 或本地檔案路徑(可重複,最多 100 個) |
--model <model> | string | 否 | 模型 ID(預設:Profile 配置的 ASR 模型,否則為 fun-asr)。非同步:fun-asr / -filetrans / paraformer-;同步:qwen3-asr-flash* / fun-asr-flash* / qwen-audio-*-asr-flash |
--language <lang> | string | 否 | 語言提示(例如 zh、en、ja)。傳統非同步/input-audio:language_hints;qwen3-filetrans:language;qwen3 同步:asr_options.language |
--diarization | switch | 否 | 啟用自動說話人分離 |
--speaker-count <n> | number | 否 | 預期的說話人數量(需啟用 --diarization) |
--vocabulary-id <id> | string | 否 | 預編譯熱詞清單 ID(可用 speech vocabulary create 建立)。其 target_model 必須與 --model 完全一致,否則靜默失效且無報錯。支援模型比 --vocabulary 更廣,含 Fun-ASR 與 Paraformer 系列 |
--vocabulary <json> | string | 否 | 即時熱詞,JSON 物件「熱詞→權重」,例如 '{"奮鬥者":4}'。權重 1-5(推薦 4,過高會拖累其他詞),50 表示超級熱詞。無需預先建立熱詞表。僅 Qwen-Audio-3.0-ASR-Flash 系列模型生效 |
--context <text> | string | 否 | 上下文增強詞表,提升專有名詞準確率;須包含待識別的原詞本身(只寫主題描述效果有限),最長 400 字元。僅 Qwen-Audio-3.0-ASR-Flash 系列與 Fun-ASR-Flash 模型生效 |
--channel-id <n> | number | 否 | 音頻音道 ID(預設:0) |
--out <path> | string | 否 | 將完整轉寫結果儲存至 JSON 檔案 |
--async | switch | 否 | 直接返回非同步任務 ID,不等待任務完成 |
--poll-interval <seconds> | number | 否 | 輪詢間隔,單位為秒(預設:2) |
--model auto透過百煉自研 MCP 自動路由 AIGC 模型,只使用 MCP 工具支援的參數,並簡化文字輸出。不相容的參數直接傳回用法錯誤,不會回退到 REST 呼叫。音訊僅支援公網 http(s) URL;本機檔案需改用--model <id>指定具體模型。- JSON 輸出保留完整回應和轉寫結果。沒有轉寫結果時仍傳回任務資訊。
熱詞詞彙表管理
管理可重複使用的預建構熱詞詞彙表,提升 ASR 對專有名詞的識別準確率。
bl speech vocabulary create
建立用於語音識別的預編譯熱詞表。需要 API Key 鑑權。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--model <model> | string | 是 | 此熱詞表服務的 ASR 模型(必填)。必須與後續 speech recognize 的 --model 完全一致,否則熱詞表靜默失效 |
--prefix <prefix> | string | 是 | 熱詞表自訂前綴(必填)。僅允許數字和小寫字母,最長 10 個字元 |
--words <json> | string | 否 | 熱詞,JSON 物件「熱詞→權重」,例如 '{"奮鬥者":4}';需要逐條指定語言時可傳 API 的項目陣列。權重 1-5(推薦 4);當熱詞表的 target_model 為 Qwen-Audio-3.0-ASR-Flash 系列時還可使用 50(超級熱詞)。也可使用 --words-file |
--words-file <path> | string | 否 | 包含熱詞的 JSON 檔案(使用 - 從 stdin 讀取) |
--lang <code> | string | 否 | 物件形態時應用至所有熱詞的語言代碼(選填;陣列形態忽略)。Paraformer 支援 zh/en/ja/yue/ko/de/fr/ru;Fun-ASR 支援 zh/en/ja |
- --model 必須與後續
speech recognize --vocabulary-id使用的 --model 完全一致;不一致時熱詞表會靜默失效且無報錯。
bl speech vocabulary list
列出預編譯熱詞表。需要 API Key 鑑權。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--prefix <prefix> | string | 否 | 按熱詞表前綴過濾 |
--page <n> | number | 否 | 頁碼,從 1 開始(預設:1)。映射為 API 的 page_index(從 0 開始):page - 1 |
--page-size <n> | number | 否 | 每頁結果數(預設:10) |
- list 回應不含 target_model;要對齊模型請使用
speech vocabulary get。 - status 為 UNDEPLOYED 的熱詞表會被 ASR 靜默忽略。
bl speech vocabulary get
檢視預編譯熱詞表詳情。需要 API Key 鑑權。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--id <id> | string | yes | 熱詞詞彙表 ID |
- 在呼叫
speech recognize --vocabulary-id之前,先用此命令確認 target_model;模型不符會導致靜默失敗。
bl speech vocabulary update
取代預先編譯熱詞詞彙表的內容。需要 API Key 認證。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--id <id> | string | yes | 熱詞詞彙表 ID |
--words <json> | string | no | 熱詞,以 word→weight 的 JSON 物件表示,例如 '{"Fendouzhe":4}';或使用逐條目指定 lang 的 API 條目陣列。權重 1-5(建議 4);當詞彙表的 target_model 是 Qwen-Audio-3.0-ASR-Flash 系列模型時,也允許使用 50 作為超級熱詞。或使用 --words-file |
--words-file <path> | string | no | 包含熱詞的 JSON 檔案(使用 - 表示 stdin) |
--lang <code> | string | no | 使用物件形式時套用到每個熱詞的語言代碼(可選;陣列形式時忽略)。Paraformer:zh/en/ja/yue/ko/de/fr/ru;Fun-ASR:zh/en/ja |
--yes | switch | no | 確認此高風險操作 |
- update 是完全取代而非附加。建議先使用 --dry-run 預覽將寫入的完整詞彙表。
bl speech vocabulary delete
刪除預先編譯的熱詞詞彙表。需要 API Key 認證。
語法
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
--id <id> | string | 是 | 熱詞表 ID |
--yes | switch | 否 | 確認執行此高風險操作 |