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