Skip to main content

Speech Synthesis & Recognition

Bailian CLI command reference for speech synthesis (TTS), speech recognition (ASR), and hot-word vocabulary management.

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]
ParameterTypeRequiredDescription
--text <text>stringnoText to synthesize into speech (or use --text-file)
--text-file <path>stringnoRead text from a file instead of --text
--model <model>stringnoModel ID (default: configured Profile TTS model, otherwise cosyvoice-v3-flash). System voices vary by model
--voice <voice>stringnoVoice 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-voicesswitchnoList built-in system voices for the selected model and exit (console link shown in output)
--format <format>stringnoAudio format: mp3, pcm, wav, opus (default: mp3; streaming default: pcm)
--sample-rate <rate>stringnoAudio sample rate in Hz (e.g. 24000)
--volume <volume>stringnoVolume 0-100 (default: 50)
--rate <rate>stringnoSpeech rate 0.5-2.0 (default: 1.0)
--pitch <pitch>stringnoPitch multiplier 0.5-2.0 (default: 1.0)
--seed <seed>stringnoRandom seed 0-65535 for reproducible synthesis
--language <lang>stringnoLanguage hint (e.g. zh, en, ja, ko, fr, de)
--instruction <text>stringnoNatural language instruction to control speech style (e.g. "Use a gentle tone")
--enable-ssmlswitchnoEnable SSML markup parsing in input text
--out <path>stringnoSave audio to file (default: auto-generate in temp dir)
--streamswitchnoStream raw PCM audio to stdout (pipe to player)
--concurrent <n>numbernoRun 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]
ParameterTypeRequiredDescription
--url <url>arrayyesAudio file URL or local file path (repeatable, max 100)
--model <model>stringnoModel 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>stringnoLanguage hint (e.g. zh, en, ja). Classic async/input-audio: language_hints; qwen3-filetrans: language; qwen3 sync: asr_options.language
--diarizationswitchnoEnable automatic speaker diarization
--speaker-count <n>numbernoExpected number of speakers (requires --diarization)
--vocabulary-id <id>stringnoPre-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>stringnoInstant 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>stringnoContext 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>numbernoAudio channel ID (default: 0)
--out <path>stringnoSave full transcription result to JSON file
--asyncswitchnoReturn async task id without waiting
--poll-interval <seconds>numbernoPolling 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]
ParameterTypeRequiredDescription
--model <model>stringyesASR model this vocabulary is built for. Must exactly match the --model passed to speech recognize later, otherwise the vocabulary is silently ignored
--prefix <prefix>stringyesCustom vocabulary prefix. Digits and lowercase letters only, max 10 chars
--words <json>stringnoHot 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>stringnoJSON file with the hot words (use - for stdin)
--lang <code>stringnoLanguage 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>]
ParameterTypeRequiredDescription
--prefix <prefix>stringnoFilter by vocabulary prefix
--page <n>numbernoPage number, 1-based (default: 1). Mapped to API page_index (0-based) as page - 1
--page-size <n>numbernoResults 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>
ParameterTypeRequiredDescription
--id <id>stringyesHot-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]
ParameterTypeRequiredDescription
--id <id>stringyesHot-word vocabulary ID
--words <json>stringnoHot 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>stringnoJSON file with the hot words (use - for stdin)
--lang <code>stringnoLanguage 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
--yesswitchnoConfirm 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>
ParameterTypeRequiredDescription
--id <id>stringyesHot-word vocabulary ID
--yesswitchnoConfirm 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