Create text-to-speech audio stream token and payload
December 23, 2024 (August 24, 2026)
Table of contents
This endpoint still works and is not going away, but it is no longer the recommended way to stream speech. POST speech/create with
streamreturns the same audio over Server-Sent Events in a single call, needs no WebSocket client, and hands you theaudioIdso the generation stays retrievable afterwards. Use it instead unless you are maintaining an existing WebSocket integration.
This endpoint creates a near real-time audio stream from the provided text.
- The first audio arrives about four seconds in.
- Concurrent generations are limited per account. This endpoint only mints a token, so it always succeeds — the limit is enforced when the generation starts on WSS speech/wss, which reports it as a MiniMax
statusInfoframe rather than an HTTP status. The ceiling depends on the MiniMax plan. A free account allows three.
600+ pre-built voices provided by GET speech/voices, tagged for filtering with tag_list:
- Languages: 40, from English, Chinese (Mandarin and Cantonese), Japanese and Korean through to Thai, Hindi, Tamil and Afrikaans
- Emotions: happy, sad, angry, fearful, disgusted, surprised, neutral, fluent
- Accents:
EN-US (General),EN-Australian,EN-British,EN-Indian,CN-Northern,CN-Southern - Ages:
Child,Young,Middle-aged,Elderly - Genders:
Male,Female
tag_list matches these strings exactly, including case. A tag it does not recognise is ignored rather than rejected, so a typo silently widens the result instead of narrowing it — Female,Middle-Aged returns the same 310 voices as Female alone, spanning every age. Check the count when you add a filter. GET speech/config returns the tags the picker UI offers, updated as MiniMax adds to them. Voices carry others besides — Documentary, Calm and Adult all match voices without appearing there.
Returned by this endpoint token and payload will be used by WebSocket WSS speech/wss.
https://api.useapi.net/v1/minimax/speech/create-stream
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API tokenis required, see Setup useapi.net for details.
Request Body
{
"account": "Optional MiniMax www.minimax.io/audio API account",
"text": "Required text",
"voice_id": "Required voice id"
}
-
accountis optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required. -
textis required, the words to speak. Max length depends on the model —5000forhd,10000forturbo. Supports inline markup for emotion, sounds and pauses — for example<#0.5#>inserts a half-second pause.
If you would rather not implement a WebSocket client, POST speech/create accepts the same text and returns either anaudioIdor a Server-Sent Events stream. -
voice_idis required. Use GET speech/voices to get list of all available voices. -
modelis optional. Default:speech-2.8-hd. See Model Comparison below for the ten models, their character ceilings and their credit ratios. -
language_boostis optional. Use tag_name from arrayvoice_tag_languageof GET speech/config.
Default valueAuto. -
emotionis optional. Use value from arrayt2a_emotionof GET speech/config.
Default valueAuto. -
volis optional.
Default 1. -
speedis optional.
Valid range: 0.5…2, default 1. -
pitchis optional.
Valid range: -12…12, default 0. -
deepen_lightenis optional.
Valid range: -100…100, default 0. -
stronger_softeris optional.
Valid range: -100…100, default 0. -
nasal_crispis optional.
Valid range: -100…100, default 0. -
spacious_echois optional.
Supported values:true,false(default). -
lofi_telephoneis optional.
Supported values:true,false(default). -
roboticis optional.
Supported values:true,false(default). -
auditorium_echois optional.
Supported values:true,false(default).
Model Comparison: Speech
| Model | Max characters | Credits per character | Status |
|---|---|---|---|
speech-2.8-hd | 5,000 | 1 | Current, and the default |
speech-2.8-turbo | 10,000 | 0.6 | Current |
speech-2.6-hd | 5,000 | 1 | Previous generation |
speech-2.6-turbo | 10,000 | 0.6 | Previous generation |
speech-2.5-hd-preview | 5,000 | 1 | Superseded by 2.6 |
speech-2.5-turbo-preview | 10,000 | 0.6 | Superseded by 2.6 |
speech-02-hd | 5,000 | 1 | Legacy |
speech-02-turbo | 10,000 | 0.6 | Legacy |
speech-01-hd | 5,000 | 1 | Legacy |
speech-01-turbo | 10,000 | 0.6 | Legacy |
Use speech-2.8-hd unless you have a reason not to. The older models stay selectable because they are still live at MiniMax, and because regenerating audio to match something made earlier needs the model that made it — not because they are worth picking for new work.
Within a generation, hd and turbo are the same model tuned differently. turbo costs 40% less per character and accepts twice the text in a single call. It is not measurably faster — on identical 990-character text the two came out level — so pick turbo for the cheaper rate and the higher ceiling, and hd when voice quality matters most.
Sending more than a model accepts returns 400 before anything is generated, so an oversized request never costs credits. The message names the model and its limit — Parameter text length (5001) exceeds 5000 characters for model speech-2.8-hd — except at the absolute 10,000 ceiling, which is checked first and reports the limit without the model.
Responses
-
Field
tokenandpayloadvalues are used by WebSocket WSS speech/wss.- The
tokencontains WebSocket authorization information and will expire in 24 hours. - The
payloadcontains a properly formed and validated payload built from user-provided input. You should send this payload over the WebSocket to generate a real-time sound stream and optionally retrieve the generated MP3 file.
{ "token": "token for WSS WebSocket endpoint", "payload": { "msg_id": "1e53d-a593-e40b9-54e20-f29c84-40ae3", "payload": { "model": "", "text": "Text for TTS generation", "voice_setting": { "speed": 1, "vol": 1, "pitch": 0, "voice_id": "123456789", "emotion": "happy" }, "audio_setting": {}, "effects": { "deepen_lighten": 0, "stronger_softer": 0, "nasal_crisp": 0, "spacious_echo": false, "lofi_telephone": false, "robotic": false, "auditorium_echo": false }, "er_weights": [], "language_boost": "German", "stream": true } } } - The
-
{ "error": "<Error message>" } -
{ "error": "Unauthorized" } -
596 Account Error
{ "error": "Your minimax account has pending error. Please address this issue at https://useapi.net/docs/api-minimax-v1/post-minimax-accounts-account before making any new API calls.", "code": 596 }
Examples
The code provided at WSS speech/wss is used on this page when you use the Try It feature.
Model
Field token and payload values are used by WebSocket WSS speech/wss.
- The
tokencontains WebSocket authorization information and will expire in 24 hours. - The
payloadcontains a properly formed and validated payload built from user-provided input. You should send this payload over the WebSocket to generate a real-time sound stream and optionally retrieve the generated MP3 file.
{ // TypeScript, all fields are optional
token: string
payload: {}
}