同步语音合成 V2
OpenAPI Specification
yaml
openapi: 3.0.1
info:
title: ''
description: ''
version: 1.0.0
paths:
/minimax/v1/t2a_v2:
post:
summary: 同步语音合成 V2
deprecated: false
description: https://platform.minimaxi.com/docs/api-reference/speech-t2a-http
operationId: textToAudioV2
tags:
- 海螺 Minimax 平台
- 语音合成
parameters:
- name: Content-Type
in: header
description: 请求体的媒介类型,必须设置为 application/json 以确保请求数据的格式为 JSON
required: true
example: ''
schema:
type: string
enum:
- application/json
default: application/json
requestBody:
content:
application/json:
schema:
type: object
properties: {}
examples:
基础非流式合成:
value:
model: speech-02-hd
text: 你好,欢迎使用语音合成服务!
voice_setting:
voice_id: moss_audio_ce44fc67-7ce3-11f0-8de5-96e35d26fb85
summary: 最简单的语音合成示例
带语气词的合成:
value:
model: speech-2.8-hd
text: 今天是不是很开心呀(laughs),当然了(breath)!
stream: false
voice_setting:
voice_id: male-qn-qingse
speed: 1
vol: 1
pitch: 0
emotion: happy
pronunciation_dict:
tone:
- 处理/(chu3)(li3)
- 危险/dangerous
audio_setting:
sample_rate: 32000
bitrate: 128000
format: mp3
channel: 1
subtitle_enable: false
summary: 使用语气词标签增强表现力
流式输出:
value:
model: speech-2.8-turbo
text: 这是一段较长的文本,使用流式输出可以边合成边播放,减少等待时间。
stream: true
stream_options:
exclude_aggregated_audio: false
voice_setting:
voice_id: English_Graceful_Lady
speed: 1.2
audio_setting:
format: mp3
force_cbr: true
summary: 流式输出可以更快地获得音频反馈
混合音色:
value:
model: speech-2.6-hd
text: 这是使用混合音色的语音合成示例。
voice_setting:
voice_id: ''
speed: 1
vol: 1
timber_weights:
- voice_id: female-chengshu
weight: 30
- voice_id: female-tianmei
weight: 70
summary: 使用多种音色混合创造独特声音
声音效果器:
value:
model: speech-2.6-hd
text: 这是带声音效果器的语音合成。
voice_setting:
voice_id: English_Persuasive_Man
voice_modify:
pitch: 20
intensity: -30
timbre: 10
sound_effects: robotic
summary: 使用声音效果器调整音色特征
responses:
'200':
description: 成功响应,返回合成的音频数据(hex 编码或 URL)以及相关统计信息
content:
application/json:
schema:
type: object
properties: {}
examples:
非流式成功响应:
summary: 非流式合成完成后的完整响应
value:
data:
audio: 2f2f2f2f504b0304...
status: 2
extra_info:
audio_length: 9900
audio_sample_rate: 32000
audio_size: 160323
bitrate: 128000
word_count: 52
invisible_character_ratio: 0
usage_characters: 26
audio_format: mp3
audio_channel: 1
trace_id: 01b8bf9bb7433cc75c18eee6cfa8fe21
base_resp:
status_code: 0
status_msg: success
带字幕的响应:
summary: 启用字幕功能后的响应
value:
data:
audio: 2f2f2f2f504b0304...
subtitle_file: https://filecdn.minimax.chat/subtitle/subtitle_123.json
status: 2
extra_info:
audio_length: 12000
audio_sample_rate: 32000
audio_size: 195000
word_count: 68
usage_characters: 68
trace_id: subtitle_example_123
base_resp:
status_code: 0
status_msg: success
headers: {}
x-apifox-name: ''
'400':
description: 请求参数错误
content:
application/json:
schema:
type: object
properties: {}
examples:
参数错误:
summary: 参数错误
value:
base_resp:
status_code: 2013
status_msg: 输入参数信息不正常:voice_id 不能为空
headers: {}
x-apifox-name: ''
'401':
description: 鉴权失败
content:
application/json:
schema:
type: object
properties: {}
examples:
鉴权失败:
summary: 鉴权失败
value:
base_resp:
status_code: 1004
status_msg: 鉴权失败,请检查 API-Key 是否正确
headers: {}
x-apifox-name: ''
'429':
description: 触发限流
content:
application/json:
schema:
type: object
properties: {}
examples:
触发限流:
summary: 触发限流
value:
base_resp:
status_code: 1002
status_msg: 触发限流,请稍后再试
headers: {}
x-apifox-name: ''
security: []
x-apifox-folder: 海螺 Minimax 平台
x-apifox-status: released
x-run-in-apifox: https://app.apifox.com/web/project/5443236/apis/api-415373651-run
components:
schemas: {}
securitySchemes:
bearer:
type: http
scheme: bearer
servers:
- url: https://www.anyapi.vip
description: 正式环境
security:
- bearer: []