Category: provider
Model Studio CosyVoice Voice Clone
Use the CosyVoice voice enrollment API to create cloned voices from public reference audio.
Critical model names
Use model="voice-enrollment" and one of these target_model values:
cosyvoice-v3.5-plus
cosyvoice-v3.5-flash
cosyvoice-v3-plus
cosyvoice-v3-flash
cosyvoice-v2
Recommended default in this repo:
target_model="cosyvoice-v3.5-plus"
Region and compatibility
cosyvoice-v3.5-plus and cosyvoice-v3.5-flash are available only in China mainland deployment mode (Beijing endpoint).
- In international deployment mode (Singapore endpoint),
cosyvoice-v3-plus and cosyvoice-v3-flash do not support voice clone/design.
- The
target_model used during enrollment must match the model used later in speech synthesis, otherwise synthesis fails.
Endpoint
- Domestic:
https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization
- International:
https://dashscope-intl.aliyuncs.com/api/v1/services/audio/tts/customization
Prerequisites
- Set
DASHSCOPE_API_KEY in your environment, or add dashscope_api_key to ~/.alibabacloud/credentials.
- Provide a public audio URL for the enrollment sample.
Normalized interface (cosyvoice.voice_clone)
Request
model (string, optional): fixed to voice-enrollment
target_model (string, optional): default cosyvoice-v3.5-plus
prefix (string, required): letters/digits only, max 10 chars
voice_sample_url (string, required): public audio URL
language_hints (array[string], optional): only first item is used
max_prompt_audio_length (float, optional): only for cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-flash
enable_preprocess (bool, optional): only for cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-flash
Response
voice_id (string): use this as the voice parameter in later TTS calls
request_id (string)
usage.count (number, optional)
Operational guidance
- For Chinese dialect reference audio, keep
language_hints=["zh"]; control dialect style later in synthesis via text or instruct.
- For
cosyvoice-v3.5-plus, supported language_hints include zh, en, fr, de, ja, ko, ru, pt, th, id, vi.
- Avoid frequent enrollment calls; each call creates a new custom voice and consumes quota.
Local helper script
Prepare a normalized request JSON:
python skills/ai/audio/aliyun-cosyvoice-voice-clone/scripts/prepare_cosyvoice_clone_request.py \
--target-model cosyvoice-v3.5-plus \
--prefix myvoice \
--voice-sample-url https://example.com/voice.wav \
--language-hint zh
Validation
mkdir -p output/aliyun-cosyvoice-voice-clone
for f in skills/ai/audio/aliyun-cosyvoice-voice-clone/scripts/*.py; do
python3 -m py_compile "$f"
done
echo "py_compile_ok" > output/aliyun-cosyvoice-voice-clone/validate.txt
Pass criteria: command exits 0 and output/aliyun-cosyvoice-voice-clone/validate.txt is generated.
Output And Evidence
- Save artifacts, command outputs, and API response summaries under
output/aliyun-cosyvoice-voice-clone/.
- Include
target_model, prefix, and sample URL in the evidence file.
References
references/api_reference.md
references/sources.md
1---2name: aliyun-cosyvoice-voice-clone3description: Use when creating cloned voices with Alibaba Cloud Model Studio CosyVoice customization models, especially cosyvoice-v3.5-plus or cosyvoice-v3.5-flash, from reference audio and then reusing the returned voice_id in later TTS calls.4---5
6Category: provider
7
8# Model Studio CosyVoice Voice Clone
9
10Use the CosyVoice voice enrollment API to create cloned voices from public reference audio.
11
12## Critical model names
13
14Use `model="voice-enrollment"` and one of these `target_model` values:
15- `cosyvoice-v3.5-plus`
16- `cosyvoice-v3.5-flash`
17- `cosyvoice-v3-plus`
18- `cosyvoice-v3-flash`
19- `cosyvoice-v2`
20
21Recommended default in this repo:
22- `target_model="cosyvoice-v3.5-plus"`
23
24## Region and compatibility
25
26- `cosyvoice-v3.5-plus` and `cosyvoice-v3.5-flash` are available only in China mainland deployment mode (Beijing endpoint).
27- In international deployment mode (Singapore endpoint), `cosyvoice-v3-plus` and `cosyvoice-v3-flash` do not support voice clone/design.
28- The `target_model` used during enrollment must match the model used later in speech synthesis, otherwise synthesis fails.
29
30## Endpoint
31
32- Domestic: `https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization`
33- International: `https://dashscope-intl.aliyuncs.com/api/v1/services/audio/tts/customization`
34
35## Prerequisites
36
37- Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials`.
38- Provide a public audio URL for the enrollment sample.
39
40## Normalized interface (cosyvoice.voice_clone)
41
42### Request
43- `model` (string, optional): fixed to `voice-enrollment`
44- `target_model` (string, optional): default `cosyvoice-v3.5-plus`
45- `prefix` (string, required): letters/digits only, max 10 chars
46- `voice_sample_url` (string, required): public audio URL
47- `language_hints` (array[string], optional): only first item is used
48- `max_prompt_audio_length` (float, optional): only for `cosyvoice-v3.5-plus`, `cosyvoice-v3.5-flash`, `cosyvoice-v3-flash`
49- `enable_preprocess` (bool, optional): only for `cosyvoice-v3.5-plus`, `cosyvoice-v3.5-flash`, `cosyvoice-v3-flash`
50
51### Response
52- `voice_id` (string): use this as the `voice` parameter in later TTS calls
53- `request_id` (string)
54- `usage.count` (number, optional)
55
56## Operational guidance
57
58- For Chinese dialect reference audio, keep `language_hints=["zh"]`; control dialect style later in synthesis via text or `instruct`.
59- For `cosyvoice-v3.5-plus`, supported `language_hints` include `zh`, `en`, `fr`, `de`, `ja`, `ko`, `ru`, `pt`, `th`, `id`, `vi`.
60- Avoid frequent enrollment calls; each call creates a new custom voice and consumes quota.
61
62## Local helper script
63
64Prepare a normalized request JSON:
65
66```bash
67python skills/ai/audio/aliyun-cosyvoice-voice-clone/scripts/prepare_cosyvoice_clone_request.py \
68 --target-model cosyvoice-v3.5-plus \
69 --prefix myvoice \
70 --voice-sample-url https://example.com/voice.wav \
71 --language-hint zh
72```
73
74## Validation
75
76```bash
77mkdir -p output/aliyun-cosyvoice-voice-clone
78for f in skills/ai/audio/aliyun-cosyvoice-voice-clone/scripts/*.py; do
79 python3 -m py_compile "$f"
80done
81echo "py_compile_ok" > output/aliyun-cosyvoice-voice-clone/validate.txt
82```
83
84Pass criteria: command exits 0 and `output/aliyun-cosyvoice-voice-clone/validate.txt` is generated.
85
86## Output And Evidence
87
88- Save artifacts, command outputs, and API response summaries under `output/aliyun-cosyvoice-voice-clone/`.
89- Include `target_model`, `prefix`, and sample URL in the evidence file.
90
91## References
92
93- `references/api_reference.md`
94- `references/sources.md`