MiniMax Music 3.0 API: Python Wrapper for Text-to-Music Generation
August 19, 2026 · View on GitHub
A clean, standalone Python SDK for MiniMax Music 3.0, delivered via muapi.ai. Generate a fully arranged, mixed song — or its instrumental twin — from a style prompt and a set of lyrics in a single API call.
Related Projects
- awesome-minimax-music-3-prompts — curated prompt library, lyrics-formatting guide, and prompt engineering tips
- minimax-music-3-comfyui — native ComfyUI custom nodes for MiniMax Music 3.0
- Seedance-2.5-API — Python wrapper for Seedance 2.5 video generation
- MiniMax-H3-API — Python SDK for MiniMax's H3 video model
- Open-Generative-AI — open-source studio for running generative image, video, and audio workflows
- Generative-Media-Skills — agent-ready skills for building generative-media pipelines
- muapi-cli — CLI and MCP access to MuAPI generation tasks
- suno-api — sibling Python SDK for Suno music, audio, and voice workflows
🚀 Why Use MiniMax Music 3.0 API?
MiniMax Music 3.0 generates a complete song — not a loop, not a stem — in one request.
- Full song generation: Verse/chorus structure, instrumentation, and a mixed/mastered vocal (or instrumental) track from a single call.
- Structured lyrics input: Control line breaks, pauses, and instrumental sections with a small, explicit formatting syntax.
- Vocal or instrumental: Toggle
is_instrumentalto render the identical arrangement with or without vocals — useful for karaoke tracks or sync deliverables. - Configurable audio quality: Choose
bitrateandsample_rateto match your delivery pipeline. - Developer-first: Simple Python SDK, fast turnaround via MuAPI's infrastructure, no per-provider account setup.
🌟 Key Features
- ✅ Text-to-Music: Generate a complete song from a style description and lyrics.
- ✅ Lyrics formatting: Single newline for a new line, double newline for a pause,
##to mark an instrumental section. - ✅ Instrumental toggle:
is_instrumental=Truerenders the same arrangement without vocals. - ✅ Bitrate control:
60000,32000,64000,128000, or256000(default256000). - ✅ Sample rate control:
16000,24000,32000, or44100Hz (default44100). - ✅ Blocking helper:
generate_and_wait()submits and polls in one call, returning the final audio URL.
🛠 Installation
Via Pip (Recommended)
pip install minimax-music-3-api
From Source
git clone https://github.com/SamurAIGPT/minimax-music-3-api.git
cd minimax-music-3-api
pip install -r requirements.txt
Configuration
Create a .env file in the root directory and add your MuAPI API key:
MUAPI_API_KEY=your_muapi_api_key_here
💻 Quick Start (Python)
from minimax_music_3_api import MiniMaxMusic3API
api = MiniMaxMusic3API()
# 1. Generate a song
print("Generating song with MiniMax Music 3.0...")
submission = api.generate(
prompt="an upbeat synth-pop anthem with driving drums and a soaring chorus",
lyrics="[Verse]\nWalking through the city lights\n\n##\n[Chorus]\nWe are shining, we are free",
)
# 2. Wait for completion
result = api.wait_for_completion(submission["request_id"])
audio_url = api.extract_audio_url(result)
print(f"Success! Listen to your song here: {audio_url}")
# ...or do both in one call:
audio_url = api.generate_and_wait(
prompt="an upbeat synth-pop anthem with driving drums and a soaring chorus",
lyrics="[Verse]\nWalking through the city lights\n\n##\n[Chorus]\nWe are shining, we are free",
)
📡 API Reference
Base URL: https://api.muapi.ai/api/v1
Endpoint: POST /minimax-music-3.0
curl --location --request POST "https://api.muapi.ai/api/v1/minimax-music-3.0" \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"prompt": "an upbeat synth-pop anthem with driving drums and a soaring chorus",
"lyrics": "[Verse]\nWalking through the city lights\n\n##\n[Chorus]\nWe are shining, we are free",
"is_instrumental": false,
"bitrate": 256000,
"sample_rate": 44100
}'
Lyrics formatting rules
| Syntax | Effect |
|---|---|
\n (single newline) | New line within a section |
\n\n (double newline) | Pause / section break |
## | Marks a point where instrumental accompaniment should be layered in |
Parameters
| Parameter | Type | Options | Default | Required | Description |
|---|---|---|---|---|---|
prompt | string | — | — | Yes | Style, mood, tempo, and instrumentation description |
lyrics | string | 10–3000 chars | — | Yes | Song lyrics using the formatting rules above |
is_instrumental | boolean | true / false | false | No | Render an instrumental-only version of the same arrangement |
bitrate | int | 60000 32000 64000 128000 256000 | 256000 | No | Output audio bitrate |
sample_rate | int | 16000 24000 32000 44100 | 44100 | No | Output sample rate (Hz) |
Polling for results
import time
import requests
def wait_for_result(request_id, api_key, poll_interval=5, timeout=300):
start = time.time()
while time.time() - start < timeout:
result = requests.get(
"https://api.muapi.ai/api/v1/predictions/{}/result".format(request_id),
headers={"Authorization": "Bearer {}".format(api_key)},
).json()
if result["status"] == "completed":
return result
if result["status"] == "failed":
raise RuntimeError(result.get("error", "Generation failed"))
time.sleep(poll_interval)
raise TimeoutError("Generation timed out")
Response
{
"status": "completed",
"output": {
"audio": "https://cdn.muapi.ai/output/minimax-music-3.0/abc123.mp3"
}
}
🎤 Vocal + Instrumental Pair Example
Generate a matching instrumental track for the same song by resubmitting with is_instrumental=True:
from minimax_music_3_api import MiniMaxMusic3API
api = MiniMaxMusic3API()
prompt = "warm acoustic folk ballad, fingerpicked guitar, gentle upright bass, intimate vocal"
lyrics = "[Verse]\nWe walked the road where the pines grow tall\n\n##\n[Chorus]\nHome isn't a place, it's a feeling we made"
vocal_url = api.generate_and_wait(prompt=prompt, lyrics=lyrics, is_instrumental=False)
instrumental_url = api.generate_and_wait(prompt=prompt, lyrics=lyrics, is_instrumental=True)
print(f"Vocal: {vocal_url}")
print(f"Instrumental: {instrumental_url}")
See examples/basic_usage.py and examples/instrumental_example.py for runnable scripts.
📖 Documentation & Guides
For prompt engineering, lyrics-formatting tips, and a curated song-prompt library, see awesome-minimax-music-3-prompts.
| Method | Parameters | Description |
|---|---|---|
generate | prompt, lyrics, is_instrumental, bitrate, sample_rate | Submit a MiniMax Music 3.0 generation request. |
generate_instrumental | prompt, lyrics, bitrate, sample_rate | Convenience wrapper for generate(..., is_instrumental=True). |
generate_and_wait | same as generate plus poll_interval, timeout | Submit and block until the audio URL is ready. |
get_result | request_id | Check the status/result of a submitted request. |
wait_for_completion | request_id, poll_interval, timeout | Blocking helper that polls until the task completes or fails. |
extract_audio_url | result | Static helper to pull the hosted audio URL out of a completed result. |
🔗 Official Resources
- Playground: muapi.ai/playground/minimax-music-3.0
- Model page: muapi.ai/minimax-music-3.0
- API Provider: MuAPI.ai
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Keywords: MiniMax Music 3.0, text-to-music API, AI music generator, AI song generator, lyrics-to-song API, MuAPI, Python music SDK, AI audio generation, generative music API, AI music composition, text-to-audio API.