Create text-to-speech audio
Table of contents
December 23, 2024 (January 15, 2025)
Please configure at least one www.hailuo.ai account for this endpoint, see Setup MiniMax for details.
This endpoint creates an mp3 audio from the provided text in under 10 seconds.
- Up to 20 parallel jobs per account are supported.
- Currently, this service is offered free of charge.
Over 300 pre-built voices provided GET audio/voices supporting the following:
- Languages: English (US, UK, Australia, India), Chinese (Mandarin and Cantonese), Japanese, Korean, French, German, Spanish, Portuguese (including Brazilian), Italian, Arabic, Russian, Turkish, Dutch, Ukrainian, Vietnamese, and Indonesian.
The list is constantly updated to include more languages! - Emotions: happy, sad, angry, fearful, disgusted, surprised, neutral
- Accents: US (General), English, Indian
- Ages: Young Adult, Adult, Middle-Aged, Senior
- Genders: Male, Female
https://api.useapi.net/v1/minimax/audio/create-mp3
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"account": "Optional MiniMax www.hailuo.ai API account",
"text": "Required text",
"voice_id": "Required voice id"
}
-
account
is optional when only onewww.hailuo.ai
account configured. However, if you have multiple accounts configured, this parameter becomes required. -
text
is required. Insert<#0.5#>
to add a 0.5s pause between sentences. Adjust the duration as needed.
Maximum length: 500 characters / 30 seconds.
NOTE You can generate mp3 for text tens times longer using combination of POST audio/create-stream and WSS audio/wss. -
voice_id
is required. Use GET audio/voices to get list of all available voices. -
model
is optional.
Supported values:speech-01-hd
(default),speech-01-turbo
. -
language_boost
is optional. Use tag_name from arrayvoice_tag_language
of GET audio/config.
Default valueAuto
. -
emotion
is optional. Use value from arrayt2a_emotion
of GET audio/config.
Default valueAuto
. -
vol
is optional.
Default 1. -
speed
is optional.
Valid range: 0.5…2, default 1. -
pitch
is optional.
Valid range: -12…12, default 0. -
deepen_lighten
is optional.
Valid range: -100…100, default 0. -
stronger_softer
is optional.
Valid range: -100…100, default 0. -
nasal_crisp
is optional.
Valid range: -100…100, default 0. -
spacious_echo
is optional.
Supported values:true
,false
(default). -
lofi_telephone
is optional.
Supported values:true
,false
(default). -
robotic
is optional.
Supported values:true
,false
(default). -
auditorium_echo
is optional.
Supported values:true
,false
(default).
Responses
-
Use returned
audio_url
to download generated mp3 audio file.
Use returnedaudio_id
to retrieve full details using GET audio/audio_id
.{ "audio_id": "user:user_id-minimax:account_id-audio:audio_id", "audio_length": 0, "audio_sample_rate": 32000, "audio_size": 1234567, "bitrate": 128000, "word_count": 0, "invisible_character_ratio": 0, "usage_characters": 500, "audio_format": "mp3", "audio_channel": 1, "input_sensitive": false, "trace_id": "<trace id>", "chunks": 5123, "audio_review": 0, "user_id": 11223344556677, "audio_title": "<autogenerated title>", "audio_url": "https://cdn.hailuoai.video/...mp3", "update_time": 123456789 }
-
{ "error": "<Error message>" }
-
{ "error": "Unauthorized" }
Model
{ // TypeScript, all fields are optional
audio_id: string
audio_length: number
audio_sample_rate: number
audio_size: number
bitrate: number
word_count: number
invisible_character_ratio: number
usage_characters: number
audio_format: string
audio_channel: number
input_sensitive: boolean
trace_id: string
chunks: number
audio_review: number
user_id: number
audio_title: string
audio_url: string
update_time: number
error: string
}
Examples
-
curl -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -X POST "https://api.useapi.net/v1/minimax/audio/create-mp3" \ -d '{"text": "…", "voice_id": "…"}'
-
const text = "text"; const voice_id = "voice_id"; const apiUrl = `https://api.useapi.net/v1/minimax/audio/create-mp3`; const token = "API token"; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }; data.body = JSON.stringify({ text, voice_id }); const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", {response, result});
-
import requests text = "text" voice_id = "voice_id" apiUrl = f"https://api.useapi.net/v1/minimax/audio/create-mp3" token = "API token" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } body = { "text": f"{text}", "voice_id": f"{voice_id}" } response = requests.post(apiUrl, headers=headers, json=body) print(response, response.json())