Skip to content

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-hd
  • speech-2.8-turbo
  • speech-2.6-hd
  • speech-2.6-turbo
  • speech-02-hd
  • speech-02-turbo

Calling Method

API Endpoint

text
https://api.exchangetoken.ai

Authentication

MiniMax T2A uses the following authentication header:

text
x-key: YOUR_API_KEY

Content Type

text
Content-Type: application/json

Request Path

text
POST /v1/t2a_v2

Core Request Fields

FieldTypeRequiredDescription
modelstringYesTTS model name
textstringYesInput text, recommended within 10000 characters
streambooleanNoWhether to return streaming audio chunks
voice_settingobjectYesVoice configuration, must include voice_id
audio_settingobjectNoAudio encoding settings
language_booststringNoLanguage hint, for example auto, English, Chinese
pronunciation_dictobjectNoCustom pronunciation mapping
voice_modifyobjectNoPitch, intensity, timbre, and sound effects
subtitle_enablebooleanNoWhether subtitle output is enabled
subtitle_typestringNosentence, word, or word_streaming
output_formatstringNoNon-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

FieldTypeRequiredDescription
voice_idstringYesTarget voice ID
speednumberNoRange 0.5 to 2
volnumberNoRange (0, 10]
pitchintegerNoRange -12 to 12
emotionstringNoEmotion style

audio_setting

FieldTypeRequiredDescription
sample_rateintegerNo8000, 16000, 22050, 24000, 32000, 44100
bitrateintegerNo32000, 64000, 128000, 256000
formatstringNomp3, pcm, flac, wav, pcmu_raw, pcmu_wav, opus
channelintegerNo1 for mono, 2 for stereo

Response Fields

FieldDescription
data.audioGenerated audio content
data.status1 means generating, 2 means completed
extra_info.usage_charactersBillable character count for this synthesis
trace_idRequest trace ID
base_resp.status_codeRequest status code, 0 means success

Error Response Format

json
{
  "base_resp": {
    "status_code": 1004,
    "status_msg": "authentication failed"
  }
}

Common meanings:

  • 0: success
  • 1002: rate limit exceeded
  • 1004: authentication failed
  • 1039: TPM rate limit exceeded
  • 1042: invalid characters exceed the limit
  • 2013: 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_format supports hex and url.
  • In streaming mode, audio is returned as chunked hex data.
  • trace_id should be kept for troubleshooting.