$npx -y skills add cinience/alicloud-skills --skill aliyun-qwen-ttsUse when generating human-like speech audio with Model Studio DashScope Qwen TTS models (qwen3-tts-flash, qwen3-tts-instruct-flash). Use when converting text to speech, producing voice lines for short drama/news videos, or documenting TTS request/response fields for DashScope.
| 1 | Category: provider |
| 2 | |
| 3 | # Model Studio Qwen TTS |
| 4 | |
| 5 | ## Validation |
| 6 | |
| 7 | ```bash |
| 8 | mkdir -p output/aliyun-qwen-tts |
| 9 | python -m py_compile skills/ai/audio/aliyun-qwen-tts/scripts/generate_tts.py && echo "py_compile_ok" > output/aliyun-qwen-tts/validate.txt |
| 10 | ``` |
| 11 | |
| 12 | Pass criteria: command exits 0 and `output/aliyun-qwen-tts/validate.txt` is generated. |
| 13 | |
| 14 | ## Output And Evidence |
| 15 | |
| 16 | - Save generated audio links, sample audio files, and request payloads to `output/aliyun-qwen-tts/`. |
| 17 | - Keep one validation log per execution. |
| 18 | |
| 19 | ## Critical model names |
| 20 | |
| 21 | Use one of the recommended models: |
| 22 | - `qwen3-tts-flash` |
| 23 | - `qwen3-tts-instruct-flash` |
| 24 | - `qwen3-tts-instruct-flash-2026-01-26` |
| 25 | |
| 26 | ## Prerequisites |
| 27 | |
| 28 | - Install SDK (recommended in a venv to avoid PEP 668 limits): |
| 29 | |
| 30 | ```bash |
| 31 | python3 -m venv .venv |
| 32 | . .venv/bin/activate |
| 33 | python -m pip install dashscope |
| 34 | ``` |
| 35 | - Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials` (env takes precedence). |
| 36 | |
| 37 | ## Normalized interface (tts.generate) |
| 38 | |
| 39 | ### Request |
| 40 | - `text` (string, required) |
| 41 | - `voice` (string, required) |
| 42 | - `language_type` (string, optional; default `Auto`) |
| 43 | - `instruction` (string, optional; recommended for instruct models) |
| 44 | - `stream` (bool, optional; default false) |
| 45 | |
| 46 | ### Response |
| 47 | - `audio_url` (string, when stream=false) |
| 48 | - `audio_base64_pcm` (string, when stream=true) |
| 49 | - `sample_rate` (int, 24000) |
| 50 | - `format` (string, wav or pcm depending on mode) |
| 51 | |
| 52 | ## Quick start (Python + DashScope SDK) |
| 53 | |
| 54 | ```python |
| 55 | import os |
| 56 | import dashscope |
| 57 | |
| 58 | # Prefer env var for auth: export DASHSCOPE_API_KEY=... |
| 59 | # Or use ~/.alibabacloud/credentials with dashscope_api_key under [default]. |
| 60 | # Beijing region; for Singapore use: https://dashscope-intl.aliyuncs.com/api/v1 |
| 61 | dashscope.base_http_api_url = "https://dashscope.aliyuncs.com/api/v1" |
| 62 | |
| 63 | text = "Hello, this is a short voice line." |
| 64 | response = dashscope.MultiModalConversation.call( |
| 65 | model="qwen3-tts-instruct-flash", |
| 66 | api_key=os.getenv("DASHSCOPE_API_KEY"), |
| 67 | text=text, |
| 68 | voice="Cherry", |
| 69 | language_type="English", |
| 70 | instruction="Warm and calm tone, slightly slower pace.", |
| 71 | stream=False, |
| 72 | ) |
| 73 | |
| 74 | audio_url = response.output.audio.url |
| 75 | print(audio_url) |
| 76 | ``` |
| 77 | |
| 78 | ## Streaming notes |
| 79 | |
| 80 | - `stream=True` returns Base64-encoded PCM chunks at 24kHz. |
| 81 | - Decode chunks and play or concatenate to a pcm buffer. |
| 82 | - The response contains `finish_reason == "stop"` when the stream ends. |
| 83 | |
| 84 | ## Operational guidance |
| 85 | |
| 86 | - Keep requests concise; split long text into multiple calls if you hit size or timeout errors. |
| 87 | - Use `language_type` consistent with the text to improve pronunciation. |
| 88 | - Use `instruction` only when you need explicit style/tone control. |
| 89 | - Cache by `(text, voice, language_type)` to avoid repeat costs. |
| 90 | |
| 91 | ## Output location |
| 92 | |
| 93 | - Default output: `output/aliyun-qwen-tts/audio/` |
| 94 | - Override base dir with `OUTPUT_DIR`. |
| 95 | |
| 96 | ## Workflow |
| 97 | |
| 98 | 1) Confirm user intent, region, identifiers, and whether the operation is read-only or mutating. |
| 99 | 2) Run one minimal read-only query first to verify connectivity and permissions. |
| 100 | 3) Execute the target operation with explicit parameters and bounded scope. |
| 101 | 4) Verify results and save output/evidence files. |
| 102 | |
| 103 | ## References |
| 104 | |
| 105 | - `references/api_reference.md` for parameter mapping and streaming example. |
| 106 | - Realtime mode is provided by `skills/ai/audio/aliyun-qwen-tts-realtime/`. |
| 107 | - Voice cloning/design are provided by `skills/ai/audio/aliyun-qwen-tts-voice-clone/` and `skills/ai/audio/aliyun-qwen-tts-voice-design/`. |
| 108 | |
| 109 | - Source list: `references/sources.md` |