跳转到主要内容
POST
/
v1
/
voice_clone
Voice Clone
curl --request POST \
  --url https://api.minimaxi.com/v1/voice_clone \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file_id": "<file_id of cloned voice>",
  "voice_id": "<voice_id>",
  "clone_prompt": {
    "prompt_audio": "<file_id of the prompt audio>",
    "prompt_text": "This voice sounds natural and pleasant."
  },
  "text": "A gentle breeze sweeps across the soft grass, carrying the fresh scent along with the songs of birds.",
  "model": "speech-2.5-hd-preview",
  "need_noise_reduction": false,
  "need_volume_normalization": false,
  "aigc_watermark": false
}'
{
  "input_sensitive": false,
  "input_sensitive_type": 0,
  "demo_audio": "",
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

Authorizations

Authorization
string
header
required

HTTP: Bearer Auth

  • Security Scheme Type: http
  • HTTP Authorization Scheme: Bearer API_key,用于验证账户信息,可在 账户管理>接口密钥 中查看。

Body

application/json

Voice clone request parameters

file_id
integer
required

待复刻音频的 file_id,通过文件上传接口获得 上传的待复刻音频文件需遵从以下规范:

  • 上传的音频文件格式需为:mp3、m4a、wav 格式
  • 上传的音频文件的时长最少应不低于 10 秒,最长应不超过 5 分钟
  • 上传的音频文件大小需不超过 20 mb
voice_id
string
required

克隆音色的 voice_id,正确示例:"MiniMax001"。用户进行自定义 voice_id 时需注意:

  • 自定义的 voice_id 长度范围[8,256]
  • 首字符必须为英文字母
  • 允许数字、字母、-、_
  • 末位字符不可为 -、_
  • voice_id 不可与已有 id 重复,否则会报错
clone_prompt
object

音色复刻示例音频,提供本参数将有助于增强语音合成的音色相似度和稳定性。若使用本参数,需同时上传一小段示例音频 上传的音频文件需遵从以下规范:

  • 上传的音频文件格式需为:mp3、m4a、wav 格式
  • 上传的音频文件的时长小于 8 秒
  • 上传的音频文件大小需不超过 20 mb
text
string

复刻试听参数,限制 2000 字符以内。模型将使用复刻后的音色朗读本段文本内容,并返回试听音频链接。 注:试听将根据字符数正常收取语音合成费用,定价与 T2A 各接口一致

model
enum<string>

复刻试听参数。指定合成试听音频使用的语音模型,提供 text 字段时必传此字段。可选项:

Available options:
speech-2.5-hd-preview,
speech-2.5-turbo-preview,
speech-02-hd,
speech-02-turbo,
speech-01-hd,
speech-01-turbo
language_boost
string

是否增强对指定的小语种和方言的识别能力。默认值为 null,可设置为 auto 让模型自主判断。可选值范围: ['Chinese', 'Chinese,Yue', 'English', 'Arabic', 'Russian', 'Spanish', 'French', 'Portuguese', 'German', 'Turkish', 'Dutch', 'Ukrainian', 'Vietnamese', 'Indonesian', 'Japanese', 'Italian', 'Korean', 'Thai', 'Polish', 'Romanian', 'Greek', 'Czech', 'Finnish', 'Hindi', 'Bulgarian', 'Danish', 'Hebrew', 'Malay', 'Persian', 'Slovak', 'Swedish', 'Croatian', 'Filipino', 'Hungarian', 'Norwegian', 'Slovenian', 'Catalan', 'Nynorsk', 'Tamil', 'Afrikaans', 'auto']

need_noise_reduction
boolean
default:false

音频复刻参数,表示是否开启降噪,默认值为 false

need_volume_normalization
boolean
default:false

音频复刻参数,是否开启音量归一化,默认值为 false

aigc_watermark
boolean
default:false

是否在合成试听音频的末尾添加音频节奏标识,默认值为 false

Response

200 - application/json

Successful response

input_sensitive
object

输入音频是否命中风控

demo_audio
string

如果请求体中传入了试听文本 text 以及合成试听音频的模型 model,那么本参数将以链接形式返回试听音频,否则本参数为空值

base_resp
object
I