跳转到主要内容
POST
/
v3
/
minimax-speech-2.8-turbo
MiniMax Speech 2.8 Turbo 同步语音合成
curl --request POST \
  --url https://api.highwayapi.ai/v3/minimax-speech-2.8-turbo \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "text": "<string>",
  "stream": true,
  "voice_modify": {
    "pitch": 123,
    "timbre": 123,
    "intensity": 123,
    "sound_effects": "<string>"
  },
  "audio_setting": {
    "format": "<string>",
    "bitrate": 123,
    "channel": 123,
    "force_cbr": true,
    "sample_rate": 123
  },
  "output_format": "<string>",
  "voice_setting": {
    "vol": 123,
    "pitch": 123,
    "speed": 123,
    "emotion": "<string>",
    "voice_id": "<string>",
    "latex_read": true,
    "text_normalization": true
  },
  "aigc_watermark": true,
  "language_boost": "<string>",
  "stream_options": {
    "exclude_aggregated_audio": true
  },
  "timber_weights": [
    {
      "weight": 123,
      "voice_id": "<string>"
    }
  ],
  "subtitle_enable": true,
  "continuous_sound": true,
  "pronunciation_dict": {
    "tone": [
      "<string>"
    ]
  }
}
'
import requests

url = "https://api.highwayapi.ai/v3/minimax-speech-2.8-turbo"

payload = {
    "text": "<string>",
    "stream": True,
    "voice_modify": {
        "pitch": 123,
        "timbre": 123,
        "intensity": 123,
        "sound_effects": "<string>"
    },
    "audio_setting": {
        "format": "<string>",
        "bitrate": 123,
        "channel": 123,
        "force_cbr": True,
        "sample_rate": 123
    },
    "output_format": "<string>",
    "voice_setting": {
        "vol": 123,
        "pitch": 123,
        "speed": 123,
        "emotion": "<string>",
        "voice_id": "<string>",
        "latex_read": True,
        "text_normalization": True
    },
    "aigc_watermark": True,
    "language_boost": "<string>",
    "stream_options": { "exclude_aggregated_audio": True },
    "timber_weights": [
        {
            "weight": 123,
            "voice_id": "<string>"
        }
    ],
    "subtitle_enable": True,
    "continuous_sound": True,
    "pronunciation_dict": { "tone": ["<string>"] }
}
headers = {
    "Content-Type": "<content-type>",
    "Authorization": "<authorization>"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
  body: JSON.stringify({
    text: '<string>',
    stream: true,
    voice_modify: {pitch: 123, timbre: 123, intensity: 123, sound_effects: '<string>'},
    audio_setting: {
      format: '<string>',
      bitrate: 123,
      channel: 123,
      force_cbr: true,
      sample_rate: 123
    },
    output_format: '<string>',
    voice_setting: {
      vol: 123,
      pitch: 123,
      speed: 123,
      emotion: '<string>',
      voice_id: '<string>',
      latex_read: true,
      text_normalization: true
    },
    aigc_watermark: true,
    language_boost: '<string>',
    stream_options: {exclude_aggregated_audio: true},
    timber_weights: [{weight: 123, voice_id: '<string>'}],
    subtitle_enable: true,
    continuous_sound: true,
    pronunciation_dict: {tone: ['<string>']}
  })
};

fetch('https://api.highwayapi.ai/v3/minimax-speech-2.8-turbo', 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.highwayapi.ai/v3/minimax-speech-2.8-turbo",
  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([
    'text' => '<string>',
    'stream' => true,
    'voice_modify' => [
        'pitch' => 123,
        'timbre' => 123,
        'intensity' => 123,
        'sound_effects' => '<string>'
    ],
    'audio_setting' => [
        'format' => '<string>',
        'bitrate' => 123,
        'channel' => 123,
        'force_cbr' => true,
        'sample_rate' => 123
    ],
    'output_format' => '<string>',
    'voice_setting' => [
        'vol' => 123,
        'pitch' => 123,
        'speed' => 123,
        'emotion' => '<string>',
        'voice_id' => '<string>',
        'latex_read' => true,
        'text_normalization' => true
    ],
    'aigc_watermark' => true,
    'language_boost' => '<string>',
    'stream_options' => [
        'exclude_aggregated_audio' => true
    ],
    'timber_weights' => [
        [
                'weight' => 123,
                'voice_id' => '<string>'
        ]
    ],
    'subtitle_enable' => true,
    'continuous_sound' => true,
    'pronunciation_dict' => [
        'tone' => [
                '<string>'
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <authorization>",
    "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.highwayapi.ai/v3/minimax-speech-2.8-turbo"

	payload := strings.NewReader("{\n  \"text\": \"<string>\",\n  \"stream\": true,\n  \"voice_modify\": {\n    \"pitch\": 123,\n    \"timbre\": 123,\n    \"intensity\": 123,\n    \"sound_effects\": \"<string>\"\n  },\n  \"audio_setting\": {\n    \"format\": \"<string>\",\n    \"bitrate\": 123,\n    \"channel\": 123,\n    \"force_cbr\": true,\n    \"sample_rate\": 123\n  },\n  \"output_format\": \"<string>\",\n  \"voice_setting\": {\n    \"vol\": 123,\n    \"pitch\": 123,\n    \"speed\": 123,\n    \"emotion\": \"<string>\",\n    \"voice_id\": \"<string>\",\n    \"latex_read\": true,\n    \"text_normalization\": true\n  },\n  \"aigc_watermark\": true,\n  \"language_boost\": \"<string>\",\n  \"stream_options\": {\n    \"exclude_aggregated_audio\": true\n  },\n  \"timber_weights\": [\n    {\n      \"weight\": 123,\n      \"voice_id\": \"<string>\"\n    }\n  ],\n  \"subtitle_enable\": true,\n  \"continuous_sound\": true,\n  \"pronunciation_dict\": {\n    \"tone\": [\n      \"<string>\"\n    ]\n  }\n}")

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

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

	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.highwayapi.ai/v3/minimax-speech-2.8-turbo")
  .header("Content-Type", "<content-type>")
  .header("Authorization", "<authorization>")
  .body("{\n  \"text\": \"<string>\",\n  \"stream\": true,\n  \"voice_modify\": {\n    \"pitch\": 123,\n    \"timbre\": 123,\n    \"intensity\": 123,\n    \"sound_effects\": \"<string>\"\n  },\n  \"audio_setting\": {\n    \"format\": \"<string>\",\n    \"bitrate\": 123,\n    \"channel\": 123,\n    \"force_cbr\": true,\n    \"sample_rate\": 123\n  },\n  \"output_format\": \"<string>\",\n  \"voice_setting\": {\n    \"vol\": 123,\n    \"pitch\": 123,\n    \"speed\": 123,\n    \"emotion\": \"<string>\",\n    \"voice_id\": \"<string>\",\n    \"latex_read\": true,\n    \"text_normalization\": true\n  },\n  \"aigc_watermark\": true,\n  \"language_boost\": \"<string>\",\n  \"stream_options\": {\n    \"exclude_aggregated_audio\": true\n  },\n  \"timber_weights\": [\n    {\n      \"weight\": 123,\n      \"voice_id\": \"<string>\"\n    }\n  ],\n  \"subtitle_enable\": true,\n  \"continuous_sound\": true,\n  \"pronunciation_dict\": {\n    \"tone\": [\n      \"<string>\"\n    ]\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.highwayapi.ai/v3/minimax-speech-2.8-turbo")

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"] = '<authorization>'
request.body = "{\n  \"text\": \"<string>\",\n  \"stream\": true,\n  \"voice_modify\": {\n    \"pitch\": 123,\n    \"timbre\": 123,\n    \"intensity\": 123,\n    \"sound_effects\": \"<string>\"\n  },\n  \"audio_setting\": {\n    \"format\": \"<string>\",\n    \"bitrate\": 123,\n    \"channel\": 123,\n    \"force_cbr\": true,\n    \"sample_rate\": 123\n  },\n  \"output_format\": \"<string>\",\n  \"voice_setting\": {\n    \"vol\": 123,\n    \"pitch\": 123,\n    \"speed\": 123,\n    \"emotion\": \"<string>\",\n    \"voice_id\": \"<string>\",\n    \"latex_read\": true,\n    \"text_normalization\": true\n  },\n  \"aigc_watermark\": true,\n  \"language_boost\": \"<string>\",\n  \"stream_options\": {\n    \"exclude_aggregated_audio\": true\n  },\n  \"timber_weights\": [\n    {\n      \"weight\": 123,\n      \"voice_id\": \"<string>\"\n    }\n  ],\n  \"subtitle_enable\": true,\n  \"continuous_sound\": true,\n  \"pronunciation_dict\": {\n    \"tone\": [\n      \"<string>\"\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "data": {},
  "trace_id": "<string>",
  "base_resp": {},
  "extra_info": {}
}
将文本转换为语音,支持多种音色、情绪控制、语速调节等功能。文本长度限制小于 10000 字符,若文本长度大于 3000 字符,推荐使用流式输出。

请求头

Content-Type
string
必填
枚举值: application/json
Authorization
string
必填
Bearer 身份验证格式: Bearer {{API 密钥}}。

请求体

text
string
必填
需要合成语音的文本,长度限制小于 10000 字符,若文本长度大于 3000 字符,推荐使用流式输出。支持段落切换(换行符)、停顿控制(&lt;#x#&gt;标记)、语气词标签(如(laughs)、(coughs)等,仅 speech-2.8-hd/turbo 支持)
stream
boolean
默认值:false
控制是否流式输出。默认 false,即不开启流式
voice_modify
object
audio_setting
object
output_format
string
默认值:"hex"
控制输出结果形式的参数,可选值范围为 url、hex,默认值为 hex。该参数仅在非流式场景生效,流式场景仅支持返回 hex 形式。返回的 url 有效期为 24 小时可选值:url, hex
voice_setting
object
aigc_watermark
boolean
默认值:false
控制在合成音频的末尾添加音频节奏标识,默认值为 false。该参数仅对非流式合成生效
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
stream_options
object
timber_weights
object[]
混合音色设置,最多支持 4 种音色混合
subtitle_enable
boolean
默认值:false
控制是否开启字幕服务,默认值为 false。此参数仅在非流式输出场景下有效,且仅对 speech-2.6-hd, speech-2.6-turbo, speech-02-turbo, speech-02-hd, speech-01-turbo, speech-01-hd 模型有效
continuous_sound
boolean
默认值:false
启用该参数,使得子句衔接处更自然,仅支持 speech-2.8-hd 和 speech-2.8-turbo 模型
pronunciation_dict
object

响应信息

data
object
返回的合成数据对象,可能为 null,需进行非空判断
trace_id
string
本次会话的 id,用于在咨询/反馈时帮助定位问题
base_resp
object
本次请求的状态码和详情
extra_info
object
音频的附加信息