Skip to main content
  1. Supports 100+ system voices and custom cloned voices.
  2. Supports adjustment of pitch, speech rate, volume, bitrate, sample rate, and output format.
  3. Supports returning parameters such as audio duration and audio size.
  4. Supports timestamp (subtitles) return, accurate to the sentence level.
  5. Supports two input methods for text to be synthesized: direct string input and uploading a text file via file_id.
  6. Supports detection of invalid characters: if invalid characters do not exceed 10% (including 10%), audio will be generated normally and the proportion of invalid characters will be returned; if invalid characters exceed 10%, the interface will not return a result (error code will be returned), please check and submit the request again. [Invalid characters definition: ASCII control characters in ASCII code (excluding tabs (\t) and newlines (\n))].
Applicable scenario: Speech generation for long texts, such as entire books.

Models

modelDescription
speech-2.5-hd-previewThe brand new HD model. Ultimate Similarity, Ultra-High Quality
speech-2.5-turbo-previewThe brand new Turbo model. Ultimate Value, 40 Languages
speech-02-hdSuperior rhythm and stability, with outstanding performance in replication similarity and sound quality.
speech-02-turboSuperior rhythm and stability, with enhanced multilingual capabilities and excellent performance.
speech-01-hdRich Voices, Expressive Emotions, Authentic Languages
speech-01-turboExcellent performance and low latency

Supported Languages

MiniMax’s speech synthesis models offer outstanding multilingual capabilities, with full support for 40 widely used languages worldwide. Our goal is to break down language barriers and build a truly universal AI model. Currently supported languages include:
Support Languages                                                     
1. Chinese15. Turkish28. Malay
2. Cantonese16. Dutch29. Persian
3. English17. Ukrainian30. Slovak
4. Spanish18. Thai31. Swedish
5. French19. Polish32. Croatian
6. Russian20. Romanian33. Filipino
7. German21. Greek34. Hungarian
8. Portuguese22. Czech35. Norwegian
9. Arabic23. Finnish36. Slovenian
10. Italian24. Hindi37. Catalan
11. Japanese25. Bulgarian38. Nynorsk
12. Korean26. Danish39. Tamil
13. Indonesian27. Hebrew40. Afrikaans
14. Vietnamese

Usage Workflow

  1. File Input (Optional):
    If you are using a file as input, first call the File Upload API to upload the text and obtain a file_id.
    If you are passing raw text as input, you can skip this step.
  2. Create a Speech Generation Task:
    Call the Create Speech Generation Task to create a task and retrieve a task_id.
  3. Check Task Status:
    Use the Query Speech Generation Task Status with the task_id to check the task progress.
  4. Retrieve the Audio File:
    Once the task is complete, the returned file_id can be used with the File Retrieve API to download the audio result.
    Note: The download URL is valid for 9 hours (32,400 seconds) from the time it is generated. After expiration, the file becomes unavailable and the generated audio will be lost. Please make sure to download the file in time.

Use Case

Get file_id

Python
"""
This example demonstrates how to obtain the `file_id` for the text to be synthesized.
Note: Make sure to set your API key in the environment variable `MINIMAX_API_KEY` before running.
"""
import requests
import os

api_key = os.environ.get("MINIMAX_API_KEY")
url = "https://api.minimax.io/v1/files/upload"

payload = {'purpose': 't2a_async_input'}
files=[
('file',('21622420008680404.zip',open('/Users/minimax/Downloads/21622420008680404.zip','rb'),'application/zip'))
]
headers = {
'authority': 'api.minimax.io',
'Authorization': f'Bearer {api_key}'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

Create Speech Generation Task

Python
"""
This example demonstrates how to create a speech synthesis task.
If using a file as input, replace <text_file_id> with the file_id of the text file.
If using raw text as input, set the "text" field instead.
Note: Make sure to set your API key in the environment variable MINIMAX_API_KEY.
"""
import requests
import json
import os

api_key = os.environ.get("MINIMAX_API_KEY")
url = "https://api.minimax.io/v1/t2a_async_v2"

payload = json.dumps({
"model": "speech-2.5-hd-preview",
"text_file_id": <text_file_id>, # file as input

# "text":"A gentle breeze sweeps across the soft grass, carrying a fresh fragrance along with the songs of birds — omg it’s so beautiful.", # text as input

"language_boost": "auto",
"voice_setting": {
"voice_id": "English_expressive_narrator",
"speed": 1,
"vol": 10,
"pitch": 1
},
"pronunciation_dict": {
"tone": [
"omg/oh my god"
]
},
"audio_setting": {
"audio_sample_rate": 32000,
"bitrate": 128000,
"format": "mp3",
"channel": 2
},
"voice_modify":{
"pitch":0,
"intensity":0,
"timbre":0,
"sound_effects":"spacious_echo"
}
})
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Query of Generation Status

Python
"""
This example is used to check the progress of a speech synthesis task.
Note: Make sure to set your API key in the environment variable MINIMAX_API_KEY, and the task ID to be queried in the environment variable TASK_ID.
"""
import requests
import json
import os

task_id = os.environ.get("TASK_ID")
api_key = os.environ.get("MINIMAX_API_KEY")
url = f"https://api.minimax.io/v1/query/t2a_async_query_v2?task_id={task_id}"

payload = {}
headers = {
'Authorization': f'Bearer {api_key}',
'content-type': 'application/json',
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Retrieve the Download URL of the Audio File

Python
"""
This example is used to download a speech synthesis file.
Note: Make sure to set your API key in the environment variable MINIMAX_API_KEY, and the file ID to be downloaded in the environment variable FILE_ID.
"""
import requests
import os

api_key = os.environ.get("MINIMAX_API_KEY")
file_id = os.environ.get("FILE_ID")

url = f"https://api.minimax.io/v1/files/retrieve_content?file_id={file_id}"

payload = {}
headers = {
'content-type': 'application/json',
'Authorization': f'Bearer {api_key}'
}

response = requests.request("GET", url, headers=headers, data=payload)

with open(<output_filename>, 'wb') as f:
f.write(response.content)