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