MiniMax Audio API Integration Guide & Examples
| Method | Path | Use |
|---|---|---|
POST | /minimax/v1/t2a_v2 | MiniMax synchronous speech synthesis (T2A V2) |
POST | /v1/t2a_v2 | MiniMax SDK alias with the same semantics |
Both the request and the response use MiniMax's official T2A V2 format (model, text, voice_setting, audio_setting, stream, and so on), so a client written against MiniMax's own documentation works as-is. model is the platform logical model name; whether a model offers this endpoint follows the protocols shown in the model marketplace, otherwise the gateway answers 400 model_protocol_not_offered. For plain binary audio, see OpenAI Audio.
bash
curl https://api.modelgo.ai/minimax/v1/t2a_v2 \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"text": "Hello from ModelGo.",
"voice_setting": { "voice_id": "female-shaonv", "speed": 1, "vol": 1, "pitch": 0 },
"audio_setting": { "sample_rate": 32000, "bitrate": 128000, "format": "mp3", "channel": 1 }
}'A successful non-stream response is MiniMax JSON. Audio lives in data.audio as a hexadecimal string (not a raw audio/mpeg body):
json
{
"base_resp": { "status_code": 0, "status_msg": "success" },
"data": { "audio": "<hex mp3 bytes>", "status": 2 },
"extra_info": { "audio_format": "mp3", "usage_characters": 22 }
}- Only numeric
base_resp.status_code0is success; a failure is also returned as MiniMax JSON, mapped to a matching HTTP error status. - With
"stream": truethe response is SSE whose events are still MiniMax JSON (incremental hex audio). - Billing uses the upstream character count (
extra_info.usage_characters), not the length oftext.