A single command invokes Bailian's speech synthesis and recognition capabilities from the terminal, with hot-word vocabulary management for improved accuracy.
Append --help to any command for full parameter details, e.g. bl speech synthesize --help. Every parameter that accepts a file URL also accepts a local path — the CLI auto-uploads it to temporary storage (valid for 48 hours), so you never need to host files as URLs yourself. Command details on this page are verified against bl 2.2.1.
Speech synthesis
bl speech synthesize
Synthesize speech from text. Requires API Key authentication.
Usage
bl speech synthesize --text <text> [flags]
| Parameter | Type | Required | Description |
|---|
--text <text> | string | no | Text to synthesize into speech (or use --text-file) |
--text-file <path> | string | no | Read text from a file instead of --text |
--model <model> | string | no | Model ID (default: configured Profile TTS model, otherwise cosyvoice-v3-flash). System voices vary by model |
--voice <voice> | string | no | Voice ID. Use --list-voices for the selected model (e.g. qwen-audio-3.0-tts-plus/flash, cosyvoice-v3-flash); for v3.5-flash provide a clone/design voice ID |
--list-voices | switch | no | List built-in system voices for the selected model and exit (console link shown in output) |
--format <format> | string | no | Audio format: mp3, pcm, wav, opus (default: mp3; streaming default: pcm) |
--sample-rate <rate> | string | no | Audio sample rate in Hz (e.g. 24000) |
--volume <volume> | string | no | Volume 0-100 (default: 50) |
--rate <rate> | string | no | Speech rate 0.5-2.0 (default: 1.0) |
--pitch <pitch> | string | no | Pitch multiplier 0.5-2.0 (default: 1.0) |
--seed <seed> | string | no | Random seed 0-65535 for reproducible synthesis |
--language <lang> | string | no | Language hint (e.g. zh, en, ja, ko, fr, de) |
--instruction <text> | string | no | Natural language instruction to control speech style (e.g. "Use a gentle tone") |
--enable-ssml | switch | no | Enable SSML markup parsing in input text |
--out <path> | string | no | Save audio to file (default: auto-generate in temp dir) |
--stream | switch | no | Stream raw PCM audio to stdout (pipe to player) |
--concurrent <n> | number | no | Run N parallel requests (default: 1) |
Example: Synthesize speech from text using a TTS model
bl speech synthesize --list-voices --model qwen-audio-3.0-tts-plus
Speech recognition
bl speech recognize
Recognize speech from audio files (FunAudio-ASR / Qwen-ASR Flash). Requires API Key authentication.
Usage
bl speech recognize --url <audio-url> [flags]
| Parameter | Type | Required | Description |
|---|
--url <url> | array | yes | Audio file URL or local file path (repeatable, max 100) |
--model <model> | string | no | Model ID (default: configured Profile ASR model, otherwise fun-asr). Async: fun-asr / -filetrans / paraformer-; sync: qwen3-asr-flash* / fun-asr-flash* / qwen-audio-*-asr-flash |
--language <lang> | string | no | Language hint (e.g. zh, en, ja). Classic async/input-audio: language_hints; qwen3-filetrans: language; qwen3 sync: asr_options.language |
--diarization | switch | no | Enable automatic speaker diarization |
--speaker-count <n> | number | no | Expected number of speakers (requires --diarization) |
--vocabulary-id <id> | string | no | Pre-built hot-word vocabulary ID (create it via speech vocabulary create). Its target_model must exactly match --model, otherwise it is silently ignored. Wider model support than --vocabulary, including Fun-ASR and Paraformer |
--vocabulary <json> | string | no | Instant hot words as JSON object of word→weight, e.g. '{"Fendouzhe":4}'. Weight 1-5 (4 recommended; higher values can hurt other words), 50 for super hot word. No pre-built vocabulary needed. Takes effect only on Qwen-Audio-3.0-ASR-Flash models |
--context <text> | string | no | Context enhancement word list to improve accuracy on proper nouns; must contain the target words themselves (a topic description alone has little effect); max 400 chars. Takes effect only on Qwen-Audio-3.0-ASR-Flash and Fun-ASR-Flash models |
--channel-id <n> | number | no | Audio channel ID (default: 0) |
--out <path> | string | no | Save full transcription result to JSON file |
--async | switch | no | Return async task id without waiting |
--poll-interval <seconds> | number | no | Polling interval in seconds (default: 2) |
Example: Recognize speech from an audio file URL
bl speech recognize --url https://example.com/audio.mp3
Hot-word vocabulary management
Manage reusable pre-built hot-word vocabularies to improve ASR accuracy on proper nouns.
bl speech vocabulary create
Create a precompiled hot-word vocabulary for ASR. Requires API Key authentication.
Usage
bl speech vocabulary create --model <model> --prefix <prefix> (--words <json> | --words-file <path>) [flags]
| Parameter | Type | Required | Description |
|---|
--model <model> | string | yes | ASR model this vocabulary is built for. Must exactly match the --model passed to speech recognize later, otherwise the vocabulary is silently ignored |
--prefix <prefix> | string | yes | Custom vocabulary prefix. Digits and lowercase letters only, max 10 chars |
--words <json> | string | no | Hot words as JSON object of word→weight, e.g. '{"Fendouzhe":4}'; or the API entry array for per-entry lang. Weight 1-5 (4 recommended); when the vocabulary target_model is a Qwen-Audio-3.0-ASR-Flash series model, 50 is also allowed as super hot word. Or use --words-file |
--words-file <path> | string | no | JSON file with the hot words (use - for stdin) |
--lang <code> | string | no | Language code applied to every hot word when using object form (optional; ignored for array form). Paraformer: zh/en/ja/yue/ko/de/fr/ru; Fun-ASR: zh/en/ja |
Example: Create a hot-word vocabulary for ASR with custom words
bl speech vocabulary create --model fun-asr --prefix demo --words '{"Fendouzhe":4,"Jingluo":4}'
- The --model must exactly match the --model used later with
speech recognize --vocabulary-id; a mismatch causes silent failure with no error.
bl speech vocabulary list
List precompiled hot-word vocabularies. Requires API Key authentication.
Usage
bl speech vocabulary list [--prefix <prefix>] [--page <n>] [--page-size <n>]
| Parameter | Type | Required | Description |
|---|
--prefix <prefix> | string | no | Filter by vocabulary prefix |
--page <n> | number | no | Page number, 1-based (default: 1). Mapped to API page_index (0-based) as page - 1 |
--page-size <n> | number | no | Results per page (default: 10) |
Example: List precompiled hot-word vocabularies by prefix
bl speech vocabulary list --prefix demo
- List responses do not include target_model; use
speech vocabulary get to inspect the model a vocabulary was built for.
- Vocabularies with status UNDEPLOYED are silently ignored by ASR.
bl speech vocabulary get
Get details of a precompiled hot-word vocabulary. Requires API Key authentication.
Usage
bl speech vocabulary get --id <id>
| Parameter | Type | Required | Description |
|---|
--id <id> | string | yes | Hot-word vocabulary ID |
Example: Retrieve details of a specific hot-word vocabulary
bl speech vocabulary get --id vocab-demo-xxx
- Use this command to confirm target_model before calling
speech recognize --vocabulary-id; a model mismatch causes silent failure.
bl speech vocabulary update
Replace the contents of a precompiled hot-word vocabulary. Requires API Key authentication.
Usage
bl speech vocabulary update --id <id> (--words <json> | --words-file <path>) [flags]
| Parameter | Type | Required | Description |
|---|
--id <id> | string | yes | Hot-word vocabulary ID |
--words <json> | string | no | Hot words as JSON object of word→weight, e.g. '{"Fendouzhe":4}'; or the API entry array for per-entry lang. Weight 1-5 (4 recommended); when the vocabulary target_model is a Qwen-Audio-3.0-ASR-Flash series model, 50 is also allowed as super hot word. Or use --words-file |
--words-file <path> | string | no | JSON file with the hot words (use - for stdin) |
--lang <code> | string | no | Language code applied to every hot word when using object form (optional; ignored for array form). Paraformer: zh/en/ja/yue/ko/de/fr/ru; Fun-ASR: zh/en/ja |
--yes | switch | no | Confirm this high-risk operation |
This fully replaces all hot words in the vocabulary. Entries not listed will be discarded and cannot be undone.
Example: Preview updating hot-word vocabulary with specified words
bl speech vocabulary update --id vocab-demo-xxx --words '{"Fendouzhe":4}' --dry-run
- update is a full replace, not an append. Prefer --dry-run first to preview the complete vocabulary that will be written.
bl speech vocabulary delete
Delete a precompiled hot-word vocabulary. Requires API Key authentication.
Usage
bl speech vocabulary delete --id <id>
| Parameter | Type | Required | Description |
|---|
--id <id> | string | yes | Hot-word vocabulary ID |
--yes | switch | no | Confirm this high-risk operation |
This permanently deletes the specified hot-word vocabulary and cannot be undone.
Example: Preview deleting hot-word vocabulary
bl speech vocabulary delete --id vocab-demo-xxx --dry-run