Music Generation
Music generation is asynchronous. Submit the creative brief once, receive a task id immediately, then poll for the finished tracks and cover assets.
Endpoint
http
POST https://api.cheapaiapi.com/v1m/task/music-generationRequest Fields
modelstringrequiredMusic model such as music-2.5+ or music-2.5.ideastringCreative direction or style prompt. Required if lyrics is empty.lyricsstringLyrics content. Required if idea is empty.titlestringOptional song title.nintegerNumber of tracks to generate. Usually 1 to 3.instrumentalbooleanCreate instrumental output only. Lyrics should be empty when true.receive_urlstringOptional webhook endpoint for completion.Example Request
bash
curl -X POST "https://api.cheapaiapi.com/v1m/task/music-generation" \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"title": "Night Drive",
"model": "music-2.5+",
"generation_type": 1,
"idea": "Dreamy synthwave with a steady driving pulse",
"lyrics": "",
"n": 1,
"rewrite_idea_switch": false,
"instrumental": true
}'Result Pattern
json
{
"success": true,
"task_id": "uuid_task_id",
"ec_remain_credits": 123456
}After submission, use the common task endpoint to check status:
http
GET https://api.cheapaiapi.com/v1/task/{task_id}Completed Task Example
json
{
"id": "uuid_task_id",
"status": "done",
"credit_cost": 1200,
"metadata": {
"music_result": {
"data": [
{
"audio_url": "https://example.com/music_track_1.mp3",
"cover_url": "https://example.com/cover_1.jpg",
"title": "Night Drive",
"duration": 180000,
"music_id": "abc123"
}
]
}
},
"type": "minimax_music"
}Good Input Rules
- Provide either
ideaorlyrics. At least one should be present. - When
instrumentalis true, keeplyricsempty. - Use
ncarefully because more outputs means more credits consumed. - For production apps, surface the track count and instrumental toggle before submit so the user understands the cost impact.
Tips For Better UX
- Split the form into two modes: idea-first and lyrics-first.
- Preview the chosen model and whether the request is instrumental before final submit.
- After task creation, move the user into task tracking and show partial status immediately.
- When the result is done, surface both
audio_urlandcover_urltogether as one playable result card.