On this page
Use a speech model and a voice ID with the speech endpoint. A MiniMax text-generation model, a Hailuo app subscription, and a speech API entitlement are separate configuration questions.
We checked the official synchronous speech reference on November 1, 2026. The Python example has not been sent to a live account, and we have not assessed pronunciation or voice quality. It follows the reference’s nonstreaming, hex-audio response path.
Start with a script you can proofread
Use a short original narration without ambiguous names:
Welcome to Cedar Workshop. Bring your questions, and we will build a simple prototype together.
This keeps the first request focused on authentication, response handling, and audio playback. Add abbreviations, dates, and specialist terms only after that path works.
Verify speech API access and billing in the international MiniMax console. The reference uses https://api.minimax.io; it also links to endpoint-specific guidance. Match your account and deployment requirements before sending text.
Request and save one MP3
This example uses Python’s standard library, so it needs no third-party SDK. Save as minimax_narration.py and run with Python 3:
import getpass
import json
from pathlib import Path
import urllib.request
payload = {
"model": "speech-2.8-hd",
"text": ("Welcome to Cedar Workshop. Bring your questions, "
"and we will build a simple prototype together."),
"stream": False,
"output_format": "hex",
"voice_setting": {
"voice_id": "English_expressive_narrator",
"speed": 1, "vol": 1, "pitch": 0,
},
"audio_setting": {
"sample_rate": 32000, "bitrate": 128000,
"format": "mp3", "channel": 1,
},
}
key = getpass.getpass("MiniMax speech API key: ")
request = urllib.request.Request(
"https://api.minimax.io/v1/t2a_v2",
data=json.dumps(payload).encode(),
headers={"Authorization": f"Bearer {key}",
"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(request, timeout=90) as response:
result = json.load(response)
if result.get("base_resp", {}).get("status_code") != 0:
raise SystemExit("Speech request rejected; inspect redacted status details.")
hex_audio = result.get("data", {}).get("audio")
if not isinstance(hex_audio, str) or not hex_audio:
raise SystemExit("No audio payload received.")
audio = bytes.fromhex(hex_audio)
if not audio:
raise SystemExit("Decoded audio is empty.")
Path("cedar-narration.mp3").write_bytes(audio)
print("Saved cedar-narration.mp3; listen before using it.")
The model and voice identifiers follow the checked reference. If your account rejects one, verify its current availability rather than substituting a chat model. An HTTP success alone is insufficient: the script checks the provider’s application-level status too.
Listen against the text
Play the full file. Check omitted words, extra words, pauses, pronunciation, clipping, and the ending. A nonempty MP3 proves only that bytes were received and saved.
For a pronunciation test, add one controlled term at a time. Keep a written pronunciation target and review the result before trying provider-specific pronunciation controls. Do not change voice, speed, and wording simultaneously if you want to understand a failure.
Keep the service boundaries clear
This is a synchronous request with the full text submitted at once. Streaming playback and long-form asynchronous jobs use different response handling. Do not feed their chunks or URLs into this hex-decoding code without following those references.
Record model, voice, text revision, date, and billed usage from your own console. We supply no cost estimate or claim of commercial rights here; check current speech-service terms for your intended use.
For a local alternative with more setup responsibility, see the CosyVoice trial guide.
Sources & references
Written by Modelrovia Editorial. Our standards distinguish official claims from observed results.
How we research and test →

