curl --request POST \
--url https://api.minimaxi.com/v1/voice_clone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_id": 123456789,
"voice_id": "<voice_id>",
"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 along with the songs of birds.",
"model": "speech-2.8-hd",
"text_validation": "This voice sounds natural and pleasant.",
"accuracy": 0.7,
"need_noise_reduction": false,
"need_volume_normalization": false,
"aigc_watermark": false
}
'import requests
url = "https://api.minimaxi.com/v1/voice_clone"
payload = {
"file_id": 123456789,
"voice_id": "<voice_id>",
"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 along with the songs of birds.",
"model": "speech-2.8-hd",
"text_validation": "This voice sounds natural and pleasant.",
"accuracy": 0.7,
"need_noise_reduction": False,
"need_volume_normalization": False,
"aigc_watermark": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_id: 123456789,
voice_id: '<voice_id>',
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 along with the songs of birds.',
model: 'speech-2.8-hd',
text_validation: 'This voice sounds natural and pleasant.',
accuracy: 0.7,
need_noise_reduction: false,
need_volume_normalization: false,
aigc_watermark: false
})
};
fetch('https://api.minimaxi.com/v1/voice_clone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.minimaxi.com/v1/voice_clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_id' => 123456789,
'voice_id' => '<voice_id>',
'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 along with the songs of birds.',
'model' => 'speech-2.8-hd',
'text_validation' => 'This voice sounds natural and pleasant.',
'accuracy' => 0.7,
'need_noise_reduction' => false,
'need_volume_normalization' => false,
'aigc_watermark' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.minimaxi.com/v1/voice_clone"
payload := strings.NewReader("{\n \"file_id\": 123456789,\n \"voice_id\": \"<voice_id>\",\n \"clone_prompt\": {\n \"prompt_audio\": 987654321,\n \"prompt_text\": \"This voice sounds natural and pleasant.\"\n },\n \"text\": \"A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent along with the songs of birds.\",\n \"model\": \"speech-2.8-hd\",\n \"text_validation\": \"This voice sounds natural and pleasant.\",\n \"accuracy\": 0.7,\n \"need_noise_reduction\": false,\n \"need_volume_normalization\": false,\n \"aigc_watermark\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.minimaxi.com/v1/voice_clone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_id\": 123456789,\n \"voice_id\": \"<voice_id>\",\n \"clone_prompt\": {\n \"prompt_audio\": 987654321,\n \"prompt_text\": \"This voice sounds natural and pleasant.\"\n },\n \"text\": \"A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent along with the songs of birds.\",\n \"model\": \"speech-2.8-hd\",\n \"text_validation\": \"This voice sounds natural and pleasant.\",\n \"accuracy\": 0.7,\n \"need_noise_reduction\": false,\n \"need_volume_normalization\": false,\n \"aigc_watermark\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimaxi.com/v1/voice_clone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_id\": 123456789,\n \"voice_id\": \"<voice_id>\",\n \"clone_prompt\": {\n \"prompt_audio\": 987654321,\n \"prompt_text\": \"This voice sounds natural and pleasant.\"\n },\n \"text\": \"A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent along with the songs of birds.\",\n \"model\": \"speech-2.8-hd\",\n \"text_validation\": \"This voice sounds natural and pleasant.\",\n \"accuracy\": 0.7,\n \"need_noise_reduction\": false,\n \"need_volume_normalization\": false,\n \"aigc_watermark\": false\n}"
response = http.request(request)
puts response.read_body{
"input_sensitive": false,
"input_sensitive_type": 0,
"demo_audio": "",
"extra_info": {
"audio_length": 11124,
"audio_sample_rate": 32000,
"audio_size": 179926,
"bitrate": 128000,
"word_count": 18,
"usage_characters": 18
},
"base_resp": {
"status_code": 0,
"status_msg": "success"
}
}音色快速复刻
使用本接口进行音色快速复刻。 复刻得到的音色若 7 天内未正式调用,则系统会删除该音色。 调用本接口前,请先完成个人或企业认证。
curl --request POST \
--url https://api.minimaxi.com/v1/voice_clone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_id": 123456789,
"voice_id": "<voice_id>",
"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 along with the songs of birds.",
"model": "speech-2.8-hd",
"text_validation": "This voice sounds natural and pleasant.",
"accuracy": 0.7,
"need_noise_reduction": false,
"need_volume_normalization": false,
"aigc_watermark": false
}
'import requests
url = "https://api.minimaxi.com/v1/voice_clone"
payload = {
"file_id": 123456789,
"voice_id": "<voice_id>",
"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 along with the songs of birds.",
"model": "speech-2.8-hd",
"text_validation": "This voice sounds natural and pleasant.",
"accuracy": 0.7,
"need_noise_reduction": False,
"need_volume_normalization": False,
"aigc_watermark": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_id: 123456789,
voice_id: '<voice_id>',
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 along with the songs of birds.',
model: 'speech-2.8-hd',
text_validation: 'This voice sounds natural and pleasant.',
accuracy: 0.7,
need_noise_reduction: false,
need_volume_normalization: false,
aigc_watermark: false
})
};
fetch('https://api.minimaxi.com/v1/voice_clone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.minimaxi.com/v1/voice_clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_id' => 123456789,
'voice_id' => '<voice_id>',
'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 along with the songs of birds.',
'model' => 'speech-2.8-hd',
'text_validation' => 'This voice sounds natural and pleasant.',
'accuracy' => 0.7,
'need_noise_reduction' => false,
'need_volume_normalization' => false,
'aigc_watermark' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.minimaxi.com/v1/voice_clone"
payload := strings.NewReader("{\n \"file_id\": 123456789,\n \"voice_id\": \"<voice_id>\",\n \"clone_prompt\": {\n \"prompt_audio\": 987654321,\n \"prompt_text\": \"This voice sounds natural and pleasant.\"\n },\n \"text\": \"A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent along with the songs of birds.\",\n \"model\": \"speech-2.8-hd\",\n \"text_validation\": \"This voice sounds natural and pleasant.\",\n \"accuracy\": 0.7,\n \"need_noise_reduction\": false,\n \"need_volume_normalization\": false,\n \"aigc_watermark\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.minimaxi.com/v1/voice_clone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_id\": 123456789,\n \"voice_id\": \"<voice_id>\",\n \"clone_prompt\": {\n \"prompt_audio\": 987654321,\n \"prompt_text\": \"This voice sounds natural and pleasant.\"\n },\n \"text\": \"A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent along with the songs of birds.\",\n \"model\": \"speech-2.8-hd\",\n \"text_validation\": \"This voice sounds natural and pleasant.\",\n \"accuracy\": 0.7,\n \"need_noise_reduction\": false,\n \"need_volume_normalization\": false,\n \"aigc_watermark\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimaxi.com/v1/voice_clone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_id\": 123456789,\n \"voice_id\": \"<voice_id>\",\n \"clone_prompt\": {\n \"prompt_audio\": 987654321,\n \"prompt_text\": \"This voice sounds natural and pleasant.\"\n },\n \"text\": \"A gentle breeze sweeps across the soft grass(breath), carrying the fresh scent along with the songs of birds.\",\n \"model\": \"speech-2.8-hd\",\n \"text_validation\": \"This voice sounds natural and pleasant.\",\n \"accuracy\": 0.7,\n \"need_noise_reduction\": false,\n \"need_volume_normalization\": false,\n \"aigc_watermark\": false\n}"
response = http.request(request)
puts response.read_body{
"input_sensitive": false,
"input_sensitive_type": 0,
"demo_audio": "",
"extra_info": {
"audio_length": 11124,
"audio_sample_rate": 32000,
"audio_size": 179926,
"bitrate": 128000,
"word_count": 18,
"usage_characters": 18
},
"base_resp": {
"status_code": 0,
"status_msg": "success"
}
}授权
请求体
Voice clone request parameters
克隆音色的 voice_id,正确示例:"MiniMax001"。用户进行自定义 voice_id 时需注意:
- 自定义的 voice_id 长度范围[8,256]
- 首字符必须为英文字母
- 允许数字、字母、-、_
- 末位字符不可为 -、_
- voice_id 不可与已有 id 重复,否则会报错
音色复刻示例音频,提供本参数将有助于增强语音合成的音色相似度和稳定性。若使用本参数,需同时上传一小段示例音频 上传的音频文件需遵从以下规范:
- 上传的音频文件格式需为:mp3、m4a、wav 格式
- 上传的音频文件的时长小于 8 秒
- 上传的音频文件大小需不超过 20 mb
Show child attributes
Show child attributes
复刻试听参数,限制 1000 字符以内。模型将使用复刻后的音色朗读本段文本内容,并返回试听音频链接。 注:试听将根据字符数正常收取语音合成费用,定价与 T2A 各接口一致
- 语气词标签:仅当模型选择
speech-2.8-hd或speech-2.8-turbo时,支持在文本中插入语气词标签。支持的语气词:(laughs)(笑声)、(chuckle)(轻笑)、(coughs)(咳嗽)、(clear-throat)(清嗓子)、(groans)(呻吟)、(breath)(正常换气)、(pant)(喘气)、(inhale)(吸气)、(exhale)(呼气)、(gasps)(倒吸气)、(sniffs)(吸鼻子)、(sighs)(叹气)、(snorts)(喷鼻息)、(burps)(打嗝)、(lip-smacking)(咂嘴)、(humming)(哼唱)、(hissing)(嘶嘶声)、(emm)(嗯)、(whistles)(口哨)、(sneezes)(喷嚏)、(crying)(抽泣)、(applause)(鼓掌)
复刻试听参数。指定合成试听音频使用的语音模型,提供 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 是否增强对指定的小语种和方言的识别能力。默认值为 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 可选参数。音频复刻样本(file_id 或 clone_prompt.prompt_audio 中的音频)的预期文本内容。提供后,服务会对该音频做 ASR 识别,并将识别文本与 text_validation 做相似度比对;若相似度低于 accuracy,请求会被拒绝并返回错误码 1043(The asr similarity check failed)。长度上限 200 字符。
200可选参数。配合 text_validation 使用的 ASR 相似度阈值,取值范围 [0, 1]。未传或传 0 时取默认值 0.7。
0 <= x <= 1音频复刻参数,表示是否开启降噪,默认值为 false
音频复刻参数,是否开启音量归一化,默认值为 false
是否在合成试听音频的末尾添加音频节奏标识,默认值为 false
响应
Successful response
此页面对您有帮助吗?