Generate Custom Music
curl --request POST \
--url https://api.musicgpt.com/api/public/v1/MusicAI \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"music_style": "Lo-fi",
"lyrics": "<string>",
"title": "My Generated Track",
"make_instrumental": false,
"vocal_only": false,
"gender": "female",
"voice_id": "<string>",
"generate_album_cover": true,
"webhook_url": "https://example.com/my-webhook"
}
'import requests
url = "https://api.musicgpt.com/api/public/v1/MusicAI"
payload = {
"prompt": "<string>",
"music_style": "Lo-fi",
"lyrics": "<string>",
"title": "My Generated Track",
"make_instrumental": False,
"vocal_only": False,
"gender": "female",
"voice_id": "<string>",
"generate_album_cover": True,
"webhook_url": "https://example.com/my-webhook"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
music_style: 'Lo-fi',
lyrics: '<string>',
title: 'My Generated Track',
make_instrumental: false,
vocal_only: false,
gender: 'female',
voice_id: '<string>',
generate_album_cover: true,
webhook_url: 'https://example.com/my-webhook'
})
};
fetch('https://api.musicgpt.com/api/public/v1/MusicAI', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.musicgpt.com/api/public/v1/MusicAI",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'music_style' => 'Lo-fi',
'lyrics' => '<string>',
'title' => 'My Generated Track',
'make_instrumental' => false,
'vocal_only' => false,
'gender' => 'female',
'voice_id' => '<string>',
'generate_album_cover' => true,
'webhook_url' => 'https://example.com/my-webhook'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.musicgpt.com/api/public/v1/MusicAI"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"music_style\": \"Lo-fi\",\n \"lyrics\": \"<string>\",\n \"title\": \"My Generated Track\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"gender\": \"female\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": true,\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.musicgpt.com/api/public/v1/MusicAI")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"music_style\": \"Lo-fi\",\n \"lyrics\": \"<string>\",\n \"title\": \"My Generated Track\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"gender\": \"female\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": true,\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/MusicAI")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"music_style\": \"Lo-fi\",\n \"lyrics\": \"<string>\",\n \"title\": \"My Generated Track\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"gender\": \"female\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": true,\n \"webhook_url\": \"https://example.com/my-webhook\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Message published to queue",
"task_id": "4fc2cdba-005d-4d14-a208-5fb02a2809da",
"conversion_id_1": "05092d5c-f8b1-4c96-a4a3-45bc00de6268",
"conversion_id_2": "52fcd3b6-3925-41ed-b4c6-aee17a29e40b",
"eta": 154
}{
"success": false,
"error": "Insufficient credit balance"
}{
"success": false,
"error": "Internal Server Error"
}Features
Music AI
deprecated
Create music powered by AI using just a prompt, lyrics, or a defined music style.
POST
/
v1
/
MusicAI
Generate Custom Music
curl --request POST \
--url https://api.musicgpt.com/api/public/v1/MusicAI \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"music_style": "Lo-fi",
"lyrics": "<string>",
"title": "My Generated Track",
"make_instrumental": false,
"vocal_only": false,
"gender": "female",
"voice_id": "<string>",
"generate_album_cover": true,
"webhook_url": "https://example.com/my-webhook"
}
'import requests
url = "https://api.musicgpt.com/api/public/v1/MusicAI"
payload = {
"prompt": "<string>",
"music_style": "Lo-fi",
"lyrics": "<string>",
"title": "My Generated Track",
"make_instrumental": False,
"vocal_only": False,
"gender": "female",
"voice_id": "<string>",
"generate_album_cover": True,
"webhook_url": "https://example.com/my-webhook"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
music_style: 'Lo-fi',
lyrics: '<string>',
title: 'My Generated Track',
make_instrumental: false,
vocal_only: false,
gender: 'female',
voice_id: '<string>',
generate_album_cover: true,
webhook_url: 'https://example.com/my-webhook'
})
};
fetch('https://api.musicgpt.com/api/public/v1/MusicAI', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.musicgpt.com/api/public/v1/MusicAI",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'music_style' => 'Lo-fi',
'lyrics' => '<string>',
'title' => 'My Generated Track',
'make_instrumental' => false,
'vocal_only' => false,
'gender' => 'female',
'voice_id' => '<string>',
'generate_album_cover' => true,
'webhook_url' => 'https://example.com/my-webhook'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.musicgpt.com/api/public/v1/MusicAI"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"music_style\": \"Lo-fi\",\n \"lyrics\": \"<string>\",\n \"title\": \"My Generated Track\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"gender\": \"female\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": true,\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.musicgpt.com/api/public/v1/MusicAI")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"music_style\": \"Lo-fi\",\n \"lyrics\": \"<string>\",\n \"title\": \"My Generated Track\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"gender\": \"female\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": true,\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/MusicAI")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"music_style\": \"Lo-fi\",\n \"lyrics\": \"<string>\",\n \"title\": \"My Generated Track\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"gender\": \"female\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": true,\n \"webhook_url\": \"https://example.com/my-webhook\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Message published to queue",
"task_id": "4fc2cdba-005d-4d14-a208-5fb02a2809da",
"conversion_id_1": "05092d5c-f8b1-4c96-a4a3-45bc00de6268",
"conversion_id_2": "52fcd3b6-3925-41ed-b4c6-aee17a29e40b",
"eta": 154
}{
"success": false,
"error": "Insufficient credit balance"
}{
"success": false,
"error": "Internal Server Error"
}Deprecation Notice: Music AI v1 has been deprecated. Please use Music AI v2 for the latest features, model selection (
v6, v6-pro, v7, v7-pro), improved performance, and better output quality.- Compose custom songs using your own lyrics and chosen music style
- Generate complete tracks from a single prompt, including lyrics, instrumentation, and melody
- Apply voice conversion using a custom voice model
- Output options: full tracks, instrumental-only, or vocal-only
- Asynchronous webhook support for seamless integration
Endpoint
POST /v1/MusicAI
Sample Output
Listen to a real sample output: Prompt: a song about greenery, nature and forest. Download AudioTry It Yourself
Use the MusicAI Endpoint Explorer to test your own requests using prompts, lyrics, and more.Each request returns two distinct versions of the track.
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | String | Optional | — | A natural language prompt for music generation |
title | String | Optional | — | Title of the generated music |
music_style | String | Optional | — | Musical style or genre (e.g., Rock, Pop, Lo-fi) |
lyrics | String | Optional | "" | Custom lyrics to use in the song |
make_instrumental | Boolean | Optional | false | If true, generate instrumental-only audio |
vocal_only | Boolean | Optional | false | If true, generate vocals without instruments |
voice_id | String | Optional | "" | Apply voice model for vocal rendering |
webhook_url | String | Optional | "" | URL to receive generated results via webhook |
gender | String | Optional | "" | Allowed values: male, female, neutral. |
content-type: application/json
Generation Modes
Custom Mode
Provide bothlyrics and music_style to craft a fully personalized song.
Prompt Mode
Supply only aprompt and let the system generate everything: lyrics, style, vocals, and more.
make_instrumental,vocal_only, and Music AI generation with customvoice_idare supported in both modes.
Webhook Delivery
Once the generation is complete, webhooks will be triggered to deliver the following:Standard Requests (non-instrumental):
- 2 (webhooks) x Music conversion details (one per version)
- 2 (webhooks) x Lyrics with timestamp data
- 1 (webhook ) x Album cover image
Instrumental-only Requests:
- 2 (webhook) x Music conversion details (one per version)
- 1 (webhook) x Album cover image
Webhook responses include detailed metadata including task_id, conversion_id, audio files (conversion_path), lyrics etc.
Sample Request (Python)
import requests
url = "https://api.musicgpt.com/api/public/v1/MusicAI"
headers = {
"Authorization": "<API_KEY>",
"Content-Type": "application/json"
}
payload = {
"prompt": "Create a relaxing lo-fi song for studying",
"music_style": "Lo-fi",
"lyrics": "It's a brand new day",
"make_instrumental": False,
"vocal_only": False,
"title": "My Generated Track",
"gender": "female",
"generate_album_cover": False,
"webhook_url": "https://example.com/my-webhook"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Sample Response
{
"success": true,
"message": "Message published to queue",
"task_id": "50c04348-7077-5ffd-a407-55f031db20ef",
"eta": 154,
"conversion_id_1": "5a2c6385-e2e1-5531-a530-aab3ff040a3c",
"conversion_id_2": "e3c65d75-d1fd-549c-9e63-4b303a01cd23",
"is_flagged": false,
"reason": "",
"credit_estimate": 0.06
}
Webhook Sample Payload
Music AI Webhook{
"success": true,
"conversion_type": "Music AI",
"task_id": "c287cca4-c03a-5074-b16a-b8da9d6a124c",
"conversion_id": "8725079f-bf68-5098-a6c8-6dcba44dcaa2",
"conversion_path": "https://cdn1.musicgpt.com/conversions/api/standard/8725079f-bf68-5098-a6c8-6dcba44dcaa2/8725079f-bf68-5098-a6c8-6dcba44dcaa2.mp3",
"conversion_path_wav": "https://cdn1.musicgpt.com/conversions/api/hq/8725079f-bf68-5098-a6c8-6dcba44dcaa2/8725079f-bf68-5098-a6c8-6dcba44dcaa2.wav",
"conversion_duration": 155.95,
"is_flagged": false,
"reason": "",
"lyrics": "[Verse]\nTurn up the sound\nLet the rhythm take control\nFeel every beat\nMoving through my soul\nLights are shining bright\nAnd we lose track of time\n\n[Chorus]\nMusic in the air\nDancing through the night\nEvery beat we share\nMakes everything feel right\nTurn it up again\nLet the whole world sing",
"lyrics_timestamped": "[{\"start\": 9880, \"end\": 35120, \"text\": \"[Verse]\", \"index\": 0}, {\"start\": 9880, \"end\": 10720, \"text\": \"Turn up the sound\", \"index\": 1}, {\"start\": 13720, \"end\": 15600, \"text\": \"Let the rhythm take control\", \"index\": 2}, {\"start\": 19200, \"end\": 20400, \"text\": \"Feel every beat\", \"index\": 3}, {\"start\": 23480, \"end\": 25400, \"text\": \"Moving through my soul\", \"index\": 4}, {\"start\": 29520, \"end\": 31440, \"text\": \"Lights are shining bright\", \"index\": 5}, {\"start\": 33320, \"end\": 35120, \"text\": \"And we lose track of time\", \"index\": 6}, {\"start\": 39640, \"end\": 54320, \"text\": \"[Chorus]\", \"index\": 7}, {\"start\": 39640, \"end\": 40120, \"text\": \"Music in the air\", \"index\": 8}, {\"start\": 41800, \"end\": 42560, \"text\": \"Dancing through the night\", \"index\": 9}, {\"start\": 44320, \"end\": 45280, \"text\": \"Every beat we share\", \"index\": 10}, {\"start\": 45600, \"end\": 47440, \"text\": \"Makes everything feel right\", \"index\": 11}, {\"start\": 49240, \"end\": 49920, \"text\": \"Turn it up again\", \"index\": 12}, {\"start\": 51720, \"end\": 54320, \"text\": \"Let the whole world sing\", \"index\": 13}]",
"title": "Rhythm Take Control",
"album_cover_path": "https://cdn1.musicgpt.com/img-gen-pipeline/api/c287cca4-c03a-5074-b16a-b8da9d6a124c.jpg",
"subtype": "music_ai"
}
{
"success": true,
"conversion_type": "Music AI",
"task_id": "5254c422-0fab-53f0-b5e3-36abb69dd111",
"image_paths": [
"https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111.jpg"
],
"thumbnail_paths": [
"https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111_thumb.jpg"
],
"image_path": "https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111.jpg",
"thumbnail_path": "https://cdn1.musicgpt.com/img-gen-pipeline/api/5254c422-0fab-53f0-b5e3-36abb69dd111_thumb.jpg",
"conversion_id_1": "eba76eae-9c77-5b09-9f2b-96a8bdef0f36",
"conversion_id_2": "1cf119ce-a78c-500b-ad43-4b1f598507cb",
"album_cover_generator_output": true,
"subtype": "album_cover_generation"
}
{
"success": true,
"conversion_type": "Music AI",
"task_id": "c287cca4-c03a-5074-b16a-b8da9d6a124c",
"conversion_id": "8725079f-bf68-5098-a6c8-6dcba44dcaa2",
"subtype": "lyrics_timestamped",
"lyrics_timestamped": "[{\"start\": 9880, \"end\": 35120, \"text\": \"[Verse]\", \"index\": 0}, {\"start\": 9880, \"end\": 10720, \"text\": \"Turn up the sound\", \"index\": 1}, {\"start\": 13720, \"end\": 15600, \"text\": \"Let the rhythm take control\", \"index\": 2}, {\"start\": 19200, \"end\": 20400, \"text\": \"Feel every beat\", \"index\": 3}, {\"start\": 23480, \"end\": 25400, \"text\": \"Moving through my soul\", \"index\": 4}, {\"start\": 29520, \"end\": 31440, \"text\": \"Lights are shining bright\", \"index\": 5}, {\"start\": 33320, \"end\": 35120, \"text\": \"And we lose track of time\", \"index\": 6}, {\"start\": 39640, \"end\": 54320, \"text\": \"[Chorus]\", \"index\": 7}, {\"start\": 39640, \"end\": 40120, \"text\": \"Music in the air\", \"index\": 8}, {\"start\": 41800, \"end\": 42560, \"text\": \"Dancing through the night\", \"index\": 9}, {\"start\": 44320, \"end\": 45280, \"text\": \"Every beat we share\", \"index\": 10}, {\"start\": 45600, \"end\": 47440, \"text\": \"Makes everything feel right\", \"index\": 11}, {\"start\": 49240, \"end\": 49920, \"text\": \"Turn it up again\", \"index\": 12}, {\"start\": 51720, \"end\": 54320, \"text\": \"Let the whole world sing\", \"index\": 13}]"
}
Note: Each conversion_id corresponds to a different variation of the track.
Payload and Request Formation
Authorizations
Body
application/json
A natural language prompt for music generation. Keep it under 1000 characters. Be clear and descriptive for better results.
Style of music to generate (e.g., Rock, Pop)
Example:
"Lo-fi"
Custom lyrics for the generated music
Title of the generated music track
Example:
"My Generated Track"
Whether to make the music instrumental
Whether to generate only vocals of output audio
Gender of the voice model
Example:
"female"
Voice model to convert generated audio
Whether to generate an album cover for the generated audio
URL for callback upon completion
Example:
"https://example.com/my-webhook"