同步语音合成
接口:POST /minimax/v1/t2a_v2 归属:音频接口/MINIMAX 语音合成 调用地址:Base URL https://api.allyang.cn(OpenAI 兼容前缀 https://api.allyang.cn/v1)+ 上述路径 鉴权:请求头 Authorization: Bearer <你的令牌>;令牌在控制台「令牌管理」创建 说明:下方为本接口契约。路径、字段名与枚举取值与线上接口一致;叙述文字已按本平台口径重写。价格、并发与限流等数值以控制台及实际返回为准,未确认处标注「待补」。
OpenAPI Specification
yaml
openapi: 3.0.1
info:
title: ''
description: ''
version: 1.0.0
paths:
/minimax/v1/t2a_v2:
post:
summary: 同步语音合成
description: "通过向 {{BASE_URL}}/minimaxi/v1/voice_design 发起 POST 请求,同步取得结果。"
tags:
- 音频接口/MINIMAX 语音合成
parameters:
- name: Content-Type
in: header
description: ''
required: true
example: <content-type>
schema:
type: string
- name: Authorization
in: header
description: ''
required: false
example: Bearer {{YOUR_API_KEY}}
schema:
type: string
default: Bearer {{YOUR_API_KEY}}
requestBody:
content:
application/json:
model: speech-2.6-hd
text: 今天是不是很开心呀,当然了!
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
schema:
type: object
properties:
model:
type: string
description: "请求使用的模型版本,可选:speech-2.6-hd、speech-2.6-turbo、speech-02-hd、speech-02-turbo、speech-01-hd、speech-01-turbo。"
text:
type: string
description: "待合成语音的文本。"
stream:
type: boolean
description: "是否流式输出,默认 false(即不开启流式)。"
voice_setting:
type: object
properties:
voice_id:
type: string
speed:
type: number
description: "合成音频的语速,取值越大语速越快。取值区间 [0.5,2],默认 1.0。"
vol:
type: number
description: "合成音频的音量,取值越大音量越高。取值区间 (0,10],默认 1.0。"
pitch:
type: integer
description: "合成音频的语调,取值 [-12,12],默认 0(0 即原音色输出)。"
emotion:
type: string
description: "情绪标签,取值 happy、sad、angry、fearful、disgusted、surprised、calm、fluent,对应高兴、悲伤、愤怒、害怕、厌恶、惊讶、中性、生动。通常模型会根据文本自行匹配,不必手动填。仅 speech-2.6-hd、speech-2.6-turbo、speech-02-hd、speech-02-turbo、speech-01-hd、speech-01-turbo 支持;fluent 仅限 speech-2.6-turbo、speech-2.6-hd。"
text_normalization:
type: boolean
description: "是否启用中文、英文文本规范化:开启后数字阅读场景表现更好,但延迟略有增加;默认 false。"
latex_read:
type: boolean
description: "是否朗读 latex 公式,默认 false。"
required:
- voice_id
pronunciation_dict:
type: object
properties:
tone:
type: array
items:
type: string
description: "为需要特殊标注的文字或符号定义注音/发音替换规则。中文声调用数字表示:一声 1、二声 2、三声 3、四声 4、轻声 5。示例:[“燕少飞/(yan4)(shao3)(fei1)”, “omg/oh my god”]。"
audio_setting:
type: object
properties:
sample_rate:
type: integer
description: "生成音频的采样率,可选 8000、16000、22050、24000、32000、44100,默认 32000。"
bitrate:
type: integer
description: "生成音频的比特率,可选 32000、64000、128000、256000,默认 128000;仅 mp3 格式生效。"
format:
type: string
description: "生成音频的格式,wav 仅在非流式输出下支持。可选取值:mp3、pcm、flac、wav。"
channel:
type: integer
description: "生成音频的声道数,可选 1 或 2(1 单声道、2 双声道),默认 1。"
force_cbr:
type: boolean
description: "音频恒定比特率(cbr)开关,取值 false 或 true。置 true 时以恒定比特率编码音频。注意:仅当音频走流式输出且格式为 mp3 时生效。"
subtitle_enable:
type: boolean
stream_options:
type: object
properties:
exclude_aggregated_audio:
type: string
description: "最后一个 chunk 是否带上拼接好的语音 hex 数据。默认 False,即末个 chunk 内含完整拼接结果。"
required:
- exclude_aggregated_audio
timber_weights:
type: object
properties:
' voice_id':
type: string
weight:
type: integer
description: "各音色的混合权重,须与 voice_id 同步填写。取值 [1, 100],最多混合 4 种音色;单一音色取值占比越高,合成结果与该音色越接近。"
required:
- ' voice_id'
- weight
language_boost:
type: string
description: "是否开启小语种与方言识别增强;不传时取 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。"
voice_modify:
type: object
properties:
pitch:
type: integer
description: "音高调整(低沉/明亮),范围 [-100,100]:靠近 -100 声音更低沉,靠近 100 声音更明亮。"
intensity:
type: integer
description: "强度调整(力量感/柔和),范围 [-100,100]:靠近 -100 声音更刚劲,靠近 100 声音更轻柔。"
timbre:
type: integer
description: "音色调整(磁性/清脆),范围 [-100,100]:靠近 -100 声音更浑厚,靠近 100 声音更清脆。"
sound_effects:
type: string
description: "音效设置,单次只能选一种:spacious_echo(空旷回音)、auditorium_echo(礼堂广播)、lofi_telephone(电话失真)、robotic(电音)。"
description: "声音效果器设置,支持的音频格式:非流式 mp3、wav、flac;流式 mp3。"
' subtitle_enable':
type: boolean
description: "是否开启字幕服务,默认 false。仅非流式输出场景有效,且只对 speech-2.6-hd、speech-2.6-turbo、speech-02-turbo、speech-02-hd、speech-01-turbo、speech-01-hd 生效。"
output_format:
type: string
description: "输出结果形式,可选 url 或 hex,默认 hex。仅非流式场景可改;流式场景只返回 hex。url 形式的链接有效期为 24 小时。"
aigc_watermark:
type: boolean
description: "是否在合成音频末尾加音频节奏标识,默认 False;仅非流式合成生效。"
required:
- model
- text
- voice_setting
example:
model: speech-2.6-hd
text: 今天是不是很开心呀,当然了!
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
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
audio:
type: string
description: "合成后的音频数据,采用 hex 编码,格式与请求指定的输出格式一致。"
status:
type: integer
description: "当前音频流状态:1 表示合成中,2 表示合成结束。"
subtitle_file:
type: string
description: "合成字幕的下载链接。字幕与音频对应、精确到句(每句不超过 50 字),单位为毫秒,格式为 json。"
description: "返回的合成数据对象,可能为 null,使用前需做非空判断。"
extra_info:
type: object
properties:
audio_length:
type: integer
description: "音频时长(毫秒)。"
audio_sample_rate:
type: integer
description: "音频采样率。"
audio_size:
type: integer
description: "音频文件大小(字节)。"
bitrate:
type: integer
description: "音频比特率。"
word_count:
type: integer
description: "已发音字数统计,含汉字、数字与字母,不含标点符号。"
invisible_character_ratio:
type: integer
description: "非法字符占比。占比不超过 10%(含 10%)时音频可正常生成并返回该占比数据;超过 10% 则报错。"
usage_characters:
type: integer
description: "计费字符数。"
audio_format:
type: string
description: "生成音频文件的格式,取值 mp3、pcm、flac。"
audio_channel:
type: integer
description: "生成音频声道数,1 单声道、2 双声道。"
trace_id:
type: string
base_resp:
type: object
properties:
status_code:
type: integer
description: "状态码含义:0 正常;1000 未知错误;1001 超时;1002 触发限流;1004 鉴权失败;1039 触发 TPM 限流;1042 非法字符占比超过 10%;2013 输入参数异常。"
status_msg:
type: string
description: "状态详情。"
required:
- status_code
- status_msg
headers: {}
security: []
components:
schemas: {}
securitySchemes: {}
servers: []
security: []