跳转到主要内容
POST
/
v1
/
voice_design
Voice Design
curl --request POST \
  --url https://api.minimaxi.com/v1/voice_design \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "prompt": "讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。",
  "preview_text": "夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……"
}
'
import requests

url = "https://api.minimaxi.com/v1/voice_design"

payload = {
"prompt": "讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。",
"preview_text": "夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
prompt: '讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。',
preview_text: '夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……'
})
};

fetch('https://api.minimaxi.com/v1/voice_design', 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_design",
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([
'prompt' => '讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。',
'preview_text' => '夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);

$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_design"

payload := strings.NewReader("{\n \"prompt\": \"讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。\",\n \"preview_text\": \"夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")

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_design")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"prompt\": \"讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。\",\n \"preview_text\": \"夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.minimaxi.com/v1/voice_design")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"prompt\": \"讲述悬疑故事的播音员,声音低沉富有磁性,语速时快时慢,营造紧张神秘的氛围。\",\n \"preview_text\": \"夜深了,古屋里只有他一人。窗外传来若有若无的脚步声,他屏住呼吸,慢慢地,慢慢地,走向那扇吱呀作响的门……\"\n}"

response = http.request(request)
puts response.read_body
{
  "trial_audio": "hex 编码音频",
  "voice_id": "ttv-voice-2025060717322425-xxxxxxxx",
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

授权

Authorization
string
header
必填

HTTP: Bearer Auth

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

请求头

Content-Type
enum<string>
默认值:application/json
必填

请求体的媒介类型,请设置为 application/json,确保请求数据的格式为 JSON

可用选项:
application/json

请求体

application/json
prompt
string
必填

音色描述。

preview_text
string
必填

试听音频文本。 注:试听音频的合成将收取 2 元/万字符的费用

Maximum string length: 500
voice_id
string

自定义生成音色的 voice_id。当不传入此参数时,将自动生成并返回一个唯一的 voice_id

aigc_watermark
boolean

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

响应

200 - application/json
voice_id
string

生成的音色 ID,可用于语音合成

trial_audio
string

使用生成的音色合成的试听音频,以 hex 编码形式返回

base_resp
object

状态码和状态详情