MiniMax T2A API
Model Introduction
Exchange Token provides MiniMax text-to-speech through the native endpoint below:
POST /v1/t2a_v2
Use this endpoint when you want to convert text into audio with MiniMax-compatible request and response formats.
Supported Models
speech-2.8-hdspeech-2.8-turbospeech-2.6-hdspeech-2.6-turbospeech-02-hdspeech-02-turbo
Calling Method
API Endpoint
text
https://api.exchangetoken.aiAuthentication
MiniMax T2A uses the following authentication header:
text
x-key: YOUR_API_KEYContent Type
text
Content-Type: application/jsonRequest Path
text
POST /v1/t2a_v2Core Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | TTS model name |
text | string | Yes | Input text, recommended within 10000 characters |
stream | boolean | No | Whether to return streaming audio chunks |
voice_setting | object | Yes | Voice configuration, must include voice_id |
audio_setting | object | No | Audio encoding settings |
language_boost | string | No | Language hint, for example auto, English, Chinese |
pronunciation_dict | object | No | Custom pronunciation mapping |
voice_modify | object | No | Pitch, intensity, timbre, and sound effects |
subtitle_enable | boolean | No | Whether subtitle output is enabled |
subtitle_type | string | No | sentence, word, or word_streaming |
output_format | string | No | Non-streaming supports hex and url; streaming returns hex chunks |
Non-Streaming Example
bash
curl -X POST "https://api.exchangetoken.ai/v1/t2a_v2" \
-H "x-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-2.8-hd",
"text": "Welcome to Exchange Token. This is a MiniMax text to speech demo.",
"stream": false,
"language_boost": "auto",
"output_format": "hex",
"voice_setting": {
"voice_id": "English_Graceful_Lady",
"speed": 1,
"vol": 1,
"pitch": 0
},
"audio_setting": {
"sample_rate": 32000,
"bitrate": 128000,
"format": "mp3",
"channel": 1
}
}'Non-Streaming Response Example
json
{
"data": {
"audio": "<hex encoded audio>",
"status": 2
},
"extra_info": {
"audio_length": 11124,
"audio_sample_rate": 32000,
"audio_size": 179926,
"bitrate": 128000,
"word_count": 163,
"invisible_character_ratio": 0,
"usage_characters": 163,
"audio_format": "mp3",
"audio_channel": 1
},
"trace_id": "01b8bf9bb7433cc75c18eee6cfa8fe21",
"base_resp": {
"status_code": 0,
"status_msg": "success"
}
}Streaming Example
bash
curl -N -X POST "https://api.exchangetoken.ai/v1/t2a_v2" \
-H "x-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "speech-2.8-turbo",
"text": "This request returns audio chunks in streaming mode.",
"stream": true,
"output_format": "hex",
"voice_setting": {
"voice_id": "English_Insightful_Speaker",
"speed": 1,
"vol": 1,
"pitch": 0
},
"audio_setting": {
"sample_rate": 32000,
"bitrate": 128000,
"format": "mp3",
"channel": 1
}
}'When stream=true, the server returns multiple chunks. Intermediate chunks usually carry data.status = 1, and the final chunk carries data.status = 2.
Streaming Chunk Example
json
{
"data": {
"audio": "<hex encoded audio chunk>",
"status": 1
},
"trace_id": "01b8bf9bb7433cc75c18eee6cfa8fe21",
"base_resp": {
"status_code": 0,
"status_msg": ""
}
}Voice and Audio Settings
voice_setting
| Field | Type | Required | Description |
|---|---|---|---|
voice_id | string | Yes | Target voice ID |
speed | number | No | Range 0.5 to 2 |
vol | number | No | Range (0, 10] |
pitch | integer | No | Range -12 to 12 |
emotion | string | No | Emotion style |
audio_setting
| Field | Type | Required | Description |
|---|---|---|---|
sample_rate | integer | No | 8000, 16000, 22050, 24000, 32000, 44100 |
bitrate | integer | No | 32000, 64000, 128000, 256000 |
format | string | No | mp3, pcm, flac, wav, pcmu_raw, pcmu_wav, opus |
channel | integer | No | 1 for mono, 2 for stereo |
Response Fields
| Field | Description |
|---|---|
data.audio | Generated audio content |
data.status | 1 means generating, 2 means completed |
extra_info.usage_characters | Billable character count for this synthesis |
trace_id | Request trace ID |
base_resp.status_code | Request status code, 0 means success |
Error Response Format
json
{
"base_resp": {
"status_code": 1004,
"status_msg": "authentication failed"
}
}Common meanings:
0: success1002: rate limit exceeded1004: authentication failed1039: TPM rate limit exceeded1042: invalid characters exceed the limit2013: invalid input parameters
Notes
- For long text, streaming mode is recommended to reduce waiting time for the first audio chunk.
- In non-streaming mode,
output_formatsupportshexandurl. - In streaming mode, audio is returned as chunked
hexdata. trace_idshould be kept for troubleshooting.
