主题模式
MiniMax 音色快速复刻 API 文档
接口简介
使用本接口进行音色快速复刻。复刻得到的音色若 7 天内未正式调用,则系统会删除该音色。
请求地址与鉴权
| 项目 | 说明 |
|---|---|
| 请求方法 | POST |
| 请求地址 | /v1/audio/minimax/voices/clone |
| Content-Type | application/json |
| 鉴权方式 | Authorization: Bearer {api_key} |
请求参数
请求体为 application/json。
主请求体
| 参数名 | 类型 | 必填 | 说明 | 默认值 | 取值范围/格式 |
|---|---|---|---|---|---|
file_id | integer | 是 | 待复刻音频的 file_id,通过 文件上传接口 获得 | - | 上传规范见下方「复刻音频规范」 |
voice_id | string | 是 | 克隆音色的自定义 ID | - | 长度 [8,256];首字符须为英文字母;允许数字、字母、-、_;末位不可为 -、_;不可与已有 id 重复 |
clone_prompt | object | 否 | 示例音频,可增强音色相似度与稳定性;若使用则 prompt_audio、prompt_text 均为必填 | - | 见下方「clone_prompt」 |
text | string | 否 | 复刻试听文本,模型将用复刻音色朗读并返回试听音频链接;提供时需同时传 model;按字符数收取 T2A 费用 | - | 不超过 1000 字符;支持语气词标签如 (laughs)、(breath) 等(speech-2.8 系列) |
model | string | 试听必填 | 试听音频使用的语音模型;传 text 时必传 | - | speech-2.8-hd、speech-2.8-turbo、speech-2.6-hd、speech-2.6-turbo、speech-02-hd、speech-02-turbo、speech-01-hd、speech-01-turbo |
language_boost | string | 否 | 是否增强指定小语种/方言识别 | null | Chinese、English、auto 等,见官方枚举 |
need_noise_reduction | boolean | 否 | 是否开启降噪 | false | - |
need_volume_normalization | boolean | 否 | 是否开启音量归一化 | false | - |
aigc_watermark | boolean | 否 | 是否在试听音频末尾添加节奏标识 | false | - |
复刻音频规范(file_id 对应文件)
| 要求 | 说明 |
|---|---|
| 格式 | mp3、m4a、wav |
| 时长 | 不少于 10 秒,不超过 5 分钟 |
| 文件大小 | 不超过 20 MB |
clone_prompt(示例音频)
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt_audio | integer | 是 | 示例音频的 file_id,通过 示例音频上传接口 获得 |
prompt_text | string | 是 | 示例音频的对应文本,需与音频内容一致,句末需有标点 |
示例音频文件规范:mp3/m4a/wav,时长小于 8 秒,大小不超过 20 MB。
请求示例
cURL
bash
curl -X POST "https://aiping.cn/api/v1/audio/minimax/voices/clone" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_id": 123456789,
"voice_id": "MyVoice01",
"clone_prompt": {
"prompt_audio": 987654321,
"prompt_text": "This voice sounds natural and pleasant."
},
"text": "A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent.",
"model": "speech-2.8-hd",
"need_noise_reduction": false,
"need_volume_normalization": false,
"aigc_watermark": false
}'最小请求体(仅必填)
json
{
"file_id": 123456789,
"voice_id": "MyVoice01"
}响应格式
成功响应(application/json)
json
{
"input_sensitive": {
"type": 0
},
"demo_audio": "https://example.com/demo.mp3",
"base_resp": {
"status_code": 0,
"status_msg": "success"
}
}input_sensitive:输入音频风控结果。input_sensitive.type:0 正常,1 严重违规,2 色情,3 广告,4 违禁,5 谩骂,6 暴恐,7 其他。demo_audio:若请求中传入了text与model,返回试听音频链接;否则为空。base_resp.status_code:0 表示成功,非 0 见下方错误码。
错误码(base_resp.status_code)
| 状态码 | 说明 |
|---|---|
| 0 | 请求结果正常 |
| 1000 | 未知错误 |
| 1001 | 超时 |
| 1002 | 触发限流 |
| 1004 | 鉴权失败 |
| 1013 | 服务内部错误 |
| 2013 | 输入格式信息不正常 |
| 2038 | 无复刻权限,请检查账号认证状态 |