
Aliyun Cosyvoice Voice Clone
- 99 installs
- 396 repo stars
- Updated July 18, 2026
- cinience/alicloud-skills
Create cloned voices from reference audio with Alibaba Cloud Model Studio CosyVoice, then reuse the returned voice_id in later TTS synthesis.
About
Enrolls custom cloned voices via the CosyVoice voice-enrollment API using a public reference audio URL and a target CosyVoice model. A developer uses it when they need a reusable cloned voice_id for later text-to-speech calls.
- Supports cosyvoice-v3.5-plus/flash and v3 model targets
- Enrollment target_model must match the synthesis model or TTS fails
Aliyun Cosyvoice Voice Clone by the numbers
- 99 all-time installs (skills.sh)
- Ranked #789 of 1,335 Generative Media skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cinience/alicloud-skills --skill aliyun-cosyvoice-voice-cloneAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 99 |
|---|---|
| repo stars | ★ 396 |
| Last updated | July 18, 2026 |
| Repository | cinience/alicloud-skills ↗ |
What it does
Create cloned voices from reference audio with Alibaba Cloud Model Studio CosyVoice, then reuse the returned voice_id in later TTS synthesis.
Files
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-pluscosyvoice-v3.5-flashcosyvoice-v3-pluscosyvoice-v3-flashcosyvoice-v2
Recommended default in this repo:
target_model="cosyvoice-v3.5-plus"
Region and compatibility
cosyvoice-v3.5-plusandcosyvoice-v3.5-flashare available only in China mainland deployment mode (Beijing endpoint).- In international deployment mode (Singapore endpoint),
cosyvoice-v3-plusandcosyvoice-v3-flashdo not support voice clone/design. - The
target_modelused 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_KEYin your environment, or adddashscope_api_keyto~/.alibabacloud/credentials. - Provide a public audio URL for the enrollment sample.
Normalized interface (cosyvoice.voice_clone)
Request
model(string, optional): fixed tovoice-enrollmenttarget_model(string, optional): defaultcosyvoice-v3.5-plusprefix(string, required): letters/digits only, max 10 charsvoice_sample_url(string, required): public audio URLlanguage_hints(array[string], optional): only first item is usedmax_prompt_audio_length(float, optional): only forcosyvoice-v3.5-plus,cosyvoice-v3.5-flash,cosyvoice-v3-flashenable_preprocess(bool, optional): only forcosyvoice-v3.5-plus,cosyvoice-v3.5-flash,cosyvoice-v3-flash
Response
voice_id(string): use this as thevoiceparameter in later TTS callsrequest_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 orinstruct. - For
cosyvoice-v3.5-plus, supportedlanguage_hintsincludezh,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 zhValidation
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.txtPass 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.mdreferences/sources.md
interface:
display_name: "Alibaba Cloud AI Audio CosyVoice Voice Clone"
short_description: "CosyVoice custom voice enrollment from reference audio"
default_prompt: "Use $aliyun-cosyvoice-voice-clone to complete this ai/audio CosyVoice voice clone task on Alibaba Cloud."
{
"skill_name": "alicloud-ai-audio-cosyvoice-voice-clone",
"evals": [
{
"id": 1,
"prompt": "用阿里云百炼的 CosyVoice 给我做一个声音复刻。参考音频是 https://example.com/female-host.wav,目标模型用 cosyvoice-v3.5-plus,前缀就叫 host01。请给我可复用的请求 JSON,并说明后续合成时 voice_id 要怎么用。",
"expected_output": "Produces a clone enrollment request for cosyvoice-v3.5-plus and explains that the returned voice_id must be reused in later TTS calls with the same target_model.",
"files": [],
"expectations": [
"The output uses model \"voice-enrollment\".",
"The output sets target_model to cosyvoice-v3.5-plus.",
"The output includes prefix and reference audio URL.",
"The output explains that voice_id is reused in later synthesis requests."
]
},
{
"id": 2,
"prompt": "我要给客服机器人做英文音色克隆,音频地址是 https://example.com/agent-en.wav,语言提示 en,前缀 agent7。帮我准备最小可用的 CosyVoice clone 请求,并提醒我有哪些区域限制。",
"expected_output": "Produces a minimal English clone request and notes that cosyvoice-v3.5-plus/flash clone capabilities are limited to China mainland deployment mode.",
"files": [],
"expectations": [
"The request contains language_hints with en.",
"The request includes a public URL field for the enrollment sample.",
"The answer mentions China mainland deployment restrictions for v3.5 clone/design."
]
},
{
"id": 3,
"prompt": "帮我生成一个 CosyVoice 声音复刻模板,我要控制 max_prompt_audio_length=12 和 enable_preprocess=true,模型还是 cosyvoice-v3.5-plus,样本地址 https://example.com/news.wav,前缀 news9。",
"expected_output": "Produces a clone request including the optional preprocessing fields supported by cosyvoice-v3.5-plus.",
"files": [],
"expectations": [
"The request includes max_prompt_audio_length set to 12.",
"The request includes enable_preprocess set to true.",
"The request keeps target_model as cosyvoice-v3.5-plus."
]
}
]
}
CosyVoice Voice Clone API Reference
Endpoint
- Domestic:
POST https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization - International:
POST https://dashscope-intl.aliyuncs.com/api/v1/services/audio/tts/customization
Minimal request body
{
"model": "voice-enrollment",
"input": {
"action": "create_voice",
"target_model": "cosyvoice-v3.5-plus",
"prefix": "myvoice",
"url": "https://your-audio-file-url",
"language_hints": ["zh"]
}
}Important notes
target_modelmust match the later speech synthesis model.urlis required for clone mode.prefixmust be recognizable and up to 10 letters/digits.language_hintsuses only the first element.max_prompt_audio_lengthrange:[3.0, 30.0]for supported models.enable_preprocesscan denoise and normalize the input audio for supported models.
Response
{
"output": {
"voice_id": "yourVoiceId"
},
"usage": {
"count": 1
},
"request_id": "yourRequestId"
}Sources
- https://www.alibabacloud.com/help/zh/model-studio/cosyvoice-clone-design-api
- https://www.alibabacloud.com/help/en/model-studio/cosyvoice-clone-design-api
#!/usr/bin/env python3
"""Prepare and optionally validate a CosyVoice clone enrollment request."""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
def _load_json(path: str) -> dict:
return json.loads(Path(path).read_text(encoding="utf-8"))
def main() -> None:
parser = argparse.ArgumentParser(description="Prepare CosyVoice voice clone request")
parser.add_argument("--target-model", default="cosyvoice-v3.5-plus")
parser.add_argument("--prefix", required=True)
parser.add_argument("--voice-sample-url", required=True)
parser.add_argument("--language-hint", default="zh")
parser.add_argument("--max-prompt-audio-length", type=float)
parser.add_argument("--enable-preprocess", action="store_true")
parser.add_argument(
"--output",
default="output/aliyun-cosyvoice-voice-clone/request.json",
)
parser.add_argument("--validate-response", help="Path to a JSON response to validate")
args = parser.parse_args()
request = {
"model": "voice-enrollment",
"input": {
"action": "create_voice",
"target_model": args.target_model,
"prefix": args.prefix,
"url": args.voice_sample_url,
"language_hints": [args.language_hint],
},
}
if args.max_prompt_audio_length is not None:
request["input"]["max_prompt_audio_length"] = args.max_prompt_audio_length
if args.enable_preprocess:
request["input"]["enable_preprocess"] = True
out = Path(args.output)
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(json.dumps(request, ensure_ascii=False, indent=2), encoding="utf-8")
result = {"ok": True, "request_path": str(out)}
if args.validate_response:
response = _load_json(args.validate_response)
voice_id = ((response.get("output") or {}).get("voice_id"))
if not voice_id:
print(json.dumps({"ok": False, "error": "missing output.voice_id"}, ensure_ascii=False))
sys.exit(1)
result["response_valid"] = True
print(json.dumps(result, ensure_ascii=False))
if __name__ == "__main__":
main()