alicloud-ai-audio-cosyvoice-voice-clone
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCategory: provider
分类:服务商
Model Studio CosyVoice Voice Clone
Model Studio CosyVoice 语音克隆
Use the CosyVoice voice enrollment API to create cloned voices from public reference audio.
使用CosyVoice语音注册API,通过公开参考音频创建克隆语音。
Critical model names
关键模型名称
Use and one of these values:
model="voice-enrollment"target_modelcosyvoice-v3.5-pluscosyvoice-v3.5-flashcosyvoice-v3-pluscosyvoice-v3-flashcosyvoice-v2
Recommended default in this repo:
target_model="cosyvoice-v3.5-plus"
使用,并选择以下值之一:
model="voice-enrollment"target_modelcosyvoice-v3.5-pluscosyvoice-v3.5-flashcosyvoice-v3-pluscosyvoice-v3-flashcosyvoice-v2
本仓库推荐默认值:
target_model="cosyvoice-v3.5-plus"
Region and compatibility
地域与兼容性
- and
cosyvoice-v3.5-plusare available only in China mainland deployment mode (Beijing endpoint).cosyvoice-v3.5-flash - In international deployment mode (Singapore endpoint), and
cosyvoice-v3-plusdo not support voice clone/design.cosyvoice-v3-flash - The used during enrollment must match the model used later in speech synthesis, otherwise synthesis fails.
target_model
- 和
cosyvoice-v3.5-plus仅在中国大陆部署模式(北京接入点)可用。cosyvoice-v3.5-flash - 在国际部署模式(新加坡接入点)下,和
cosyvoice-v3-plus不支持语音克隆/定制功能。cosyvoice-v3-flash - 注册时使用的必须与后续语音合成使用的模型一致,否则合成会失败。
target_model
Endpoint
接入端点
- Domestic:
https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization - International:
https://dashscope-intl.aliyuncs.com/api/v1/services/audio/tts/customization
- 国内:
https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization - 国际:
https://dashscope-intl.aliyuncs.com/api/v1/services/audio/tts/customization
Prerequisites
前置条件
- Set in your environment, or add
DASHSCOPE_API_KEYtodashscope_api_key.~/.alibabacloud/credentials - Provide a public audio URL for the enrollment sample.
- 在环境变量中设置,或在
DASHSCOPE_API_KEY中添加~/.alibabacloud/credentials。dashscope_api_key - 提供用于注册样本的公开音频URL。
Normalized interface (cosyvoice.voice_clone)
标准化接口(cosyvoice.voice_clone)
Request
请求参数
- (string, optional): fixed to
modelvoice-enrollment - (string, optional): default
target_modelcosyvoice-v3.5-plus - (string, required): letters/digits only, max 10 chars
prefix - (string, required): public audio URL
voice_sample_url - (array[string], optional): only first item is used
language_hints - (float, optional): only for
max_prompt_audio_length,cosyvoice-v3.5-plus,cosyvoice-v3.5-flashcosyvoice-v3-flash - (bool, optional): only for
enable_preprocess,cosyvoice-v3.5-plus,cosyvoice-v3.5-flashcosyvoice-v3-flash
- (字符串,可选):固定为
modelvoice-enrollment - (字符串,可选):默认值为
target_modelcosyvoice-v3.5-plus - (字符串,必填):仅包含字母/数字,最多10个字符
prefix - (字符串,必填):公开音频URL
voice_sample_url - (字符串数组,可选):仅第一个元素会被使用
language_hints - (浮点数,可选):仅适用于
max_prompt_audio_length、cosyvoice-v3.5-plus、cosyvoice-v3.5-flashcosyvoice-v3-flash - (布尔值,可选):仅适用于
enable_preprocess、cosyvoice-v3.5-plus、cosyvoice-v3.5-flashcosyvoice-v3-flash
Response
响应参数
- (string): use this as the
voice_idparameter in later TTS callsvoice - (string)
request_id - (number, optional)
usage.count
- (字符串):后续TTS调用中用作
voice_id参数voice - (字符串)
request_id - (数字,可选)
usage.count
Operational guidance
操作指南
- For Chinese dialect reference audio, keep ; control dialect style later in synthesis via text or
language_hints=["zh"].instruct - For , supported
cosyvoice-v3.5-plusincludelanguage_hints,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.
- 对于中文方言参考音频,保持;后续可通过文本或
language_hints=["zh"]参数控制方言风格。instruct - 对于,支持的
cosyvoice-v3.5-plus包括language_hints、zh、en、fr、de、ja、ko、ru、pt、th、id。vi - 避免频繁调用注册接口;每次调用都会创建一个新的自定义语音并消耗配额。
Local helper script
本地辅助脚本
Prepare a normalized request JSON:
bash
python skills/ai/audio/alicloud-ai-audio-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准备标准化请求JSON:
bash
python skills/ai/audio/alicloud-ai-audio-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
验证步骤
bash
mkdir -p output/alicloud-ai-audio-cosyvoice-voice-clone
for f in skills/ai/audio/alicloud-ai-audio-cosyvoice-voice-clone/scripts/*.py; do
python3 -m py_compile "$f"
done
echo "py_compile_ok" > output/alicloud-ai-audio-cosyvoice-voice-clone/validate.txtPass criteria: command exits 0 and is generated.
output/alicloud-ai-audio-cosyvoice-voice-clone/validate.txtbash
mkdir -p output/alicloud-ai-audio-cosyvoice-voice-clone
for f in skills/ai/audio/alicloud-ai-audio-cosyvoice-voice-clone/scripts/*.py; do
python3 -m py_compile "$f"
done
echo "py_compile_ok" > output/alicloud-ai-audio-cosyvoice-voice-clone/validate.txt通过标准:命令执行退出码为0,且生成文件。
output/alicloud-ai-audio-cosyvoice-voice-clone/validate.txtOutput And Evidence
输出与证据
- Save artifacts, command outputs, and API response summaries under .
output/alicloud-ai-audio-cosyvoice-voice-clone/ - Include ,
target_model, and sample URL in the evidence file.prefix
- 将产物、命令输出和API响应摘要保存至目录下。
output/alicloud-ai-audio-cosyvoice-voice-clone/ - 证据文件中需包含、
target_model和样本URL。prefix
References
参考资料
references/api_reference.mdreferences/sources.md
references/api_reference.mdreferences/sources.md