curl --request POST \
--url https://api.musicgpt.com/api/public/v2/MusicAI \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A happy, upbeat song about summer",
"music_style": "<string>",
"negative_tags": "<string>",
"lyrics": "<string>",
"make_instrumental": false,
"vocal_only": false,
"title": "My Generated Track",
"gender": "",
"voice_id": "",
"generate_album_cover": false,
"lyrics_timestamps": false,
"model": "v7",
"webhook_url": "https://example.com/my-webhook"
}
'import requests
url = "https://api.musicgpt.com/api/public/v2/MusicAI"
payload = {
"prompt": "A happy, upbeat song about summer",
"music_style": "<string>",
"negative_tags": "<string>",
"lyrics": "<string>",
"make_instrumental": False,
"vocal_only": False,
"title": "My Generated Track",
"gender": "",
"voice_id": "",
"generate_album_cover": False,
"lyrics_timestamps": False,
"model": "v7",
"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: 'A happy, upbeat song about summer',
music_style: '<string>',
negative_tags: '<string>',
lyrics: '<string>',
make_instrumental: false,
vocal_only: false,
title: 'My Generated Track',
gender: '',
voice_id: '',
generate_album_cover: false,
lyrics_timestamps: false,
model: 'v7',
webhook_url: 'https://example.com/my-webhook'
})
};
fetch('https://api.musicgpt.com/api/public/v2/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/v2/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' => 'A happy, upbeat song about summer',
'music_style' => '<string>',
'negative_tags' => '<string>',
'lyrics' => '<string>',
'make_instrumental' => false,
'vocal_only' => false,
'title' => 'My Generated Track',
'gender' => '',
'voice_id' => '',
'generate_album_cover' => false,
'lyrics_timestamps' => false,
'model' => 'v7',
'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/v2/MusicAI"
payload := strings.NewReader("{\n \"prompt\": \"A happy, upbeat song about summer\",\n \"music_style\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"My Generated Track\",\n \"gender\": \"\",\n \"voice_id\": \"\",\n \"generate_album_cover\": false,\n \"lyrics_timestamps\": false,\n \"model\": \"v7\",\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/v2/MusicAI")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A happy, upbeat song about summer\",\n \"music_style\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"My Generated Track\",\n \"gender\": \"\",\n \"voice_id\": \"\",\n \"generate_album_cover\": false,\n \"lyrics_timestamps\": false,\n \"model\": \"v7\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v2/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\": \"A happy, upbeat song about summer\",\n \"music_style\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"My Generated Track\",\n \"gender\": \"\",\n \"voice_id\": \"\",\n \"generate_album_cover\": false,\n \"lyrics_timestamps\": false,\n \"model\": \"v7\",\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": "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
}{
"success": false,
"error_code": "INSUFFICIENT_CREDITS",
"message": ""
}{
"success": false,
"error_code": "UNPROCESSABLE_CONTENT",
"message": ""
}{
"success": false,
"error_code": "INTERNAL_SERVER_ERROR",
"message": ""
}Music AI V2
Create music powered by AI using just a prompt, lyrics, or a defined music style.
curl --request POST \
--url https://api.musicgpt.com/api/public/v2/MusicAI \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A happy, upbeat song about summer",
"music_style": "<string>",
"negative_tags": "<string>",
"lyrics": "<string>",
"make_instrumental": false,
"vocal_only": false,
"title": "My Generated Track",
"gender": "",
"voice_id": "",
"generate_album_cover": false,
"lyrics_timestamps": false,
"model": "v7",
"webhook_url": "https://example.com/my-webhook"
}
'import requests
url = "https://api.musicgpt.com/api/public/v2/MusicAI"
payload = {
"prompt": "A happy, upbeat song about summer",
"music_style": "<string>",
"negative_tags": "<string>",
"lyrics": "<string>",
"make_instrumental": False,
"vocal_only": False,
"title": "My Generated Track",
"gender": "",
"voice_id": "",
"generate_album_cover": False,
"lyrics_timestamps": False,
"model": "v7",
"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: 'A happy, upbeat song about summer',
music_style: '<string>',
negative_tags: '<string>',
lyrics: '<string>',
make_instrumental: false,
vocal_only: false,
title: 'My Generated Track',
gender: '',
voice_id: '',
generate_album_cover: false,
lyrics_timestamps: false,
model: 'v7',
webhook_url: 'https://example.com/my-webhook'
})
};
fetch('https://api.musicgpt.com/api/public/v2/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/v2/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' => 'A happy, upbeat song about summer',
'music_style' => '<string>',
'negative_tags' => '<string>',
'lyrics' => '<string>',
'make_instrumental' => false,
'vocal_only' => false,
'title' => 'My Generated Track',
'gender' => '',
'voice_id' => '',
'generate_album_cover' => false,
'lyrics_timestamps' => false,
'model' => 'v7',
'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/v2/MusicAI"
payload := strings.NewReader("{\n \"prompt\": \"A happy, upbeat song about summer\",\n \"music_style\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"My Generated Track\",\n \"gender\": \"\",\n \"voice_id\": \"\",\n \"generate_album_cover\": false,\n \"lyrics_timestamps\": false,\n \"model\": \"v7\",\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/v2/MusicAI")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A happy, upbeat song about summer\",\n \"music_style\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"My Generated Track\",\n \"gender\": \"\",\n \"voice_id\": \"\",\n \"generate_album_cover\": false,\n \"lyrics_timestamps\": false,\n \"model\": \"v7\",\n \"webhook_url\": \"https://example.com/my-webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v2/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\": \"A happy, upbeat song about summer\",\n \"music_style\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"My Generated Track\",\n \"gender\": \"\",\n \"voice_id\": \"\",\n \"generate_album_cover\": false,\n \"lyrics_timestamps\": false,\n \"model\": \"v7\",\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": "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
}{
"success": false,
"error_code": "INSUFFICIENT_CREDITS",
"message": ""
}{
"success": false,
"error_code": "UNPROCESSABLE_CONTENT",
"message": ""
}{
"success": false,
"error_code": "INTERNAL_SERVER_ERROR",
"message": ""
}Choose your model
v6
v6-pro
v7
v7-pro
Model comparison
| Model | Audio quality | Streaming | Best for |
|---|---|---|---|
v6 | Very good | - | Fast, dependable everyday tracks |
v6-pro | Very good | Real-time | Live, as-it-generates playback |
v7 | Best-in-class | - | Highest-quality final renders |
v7-pro | Best-in-class | Real-time | Production apps that want everything |
model parameter (v6, v6-pro, v7, or v7-pro). Streaming is available on the pro models for paid users. Per-model rates are listed on the Pricing page.
voice_id or set vocal_only to true, the request will always use the v6 model, regardless of the value passed in the model parameter.Key features
- 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 full tracks, instrumental-only, or vocal-only versions
- View the live streaming of the song as it generates (
promodels) - Asynchronous webhook support for clean integration
Endpoint
POST /v2/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) |
negative_tags | String | Optional | "" | Tags or themes you want to avoid in the song (e.g., “sad”, “slow”) |
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 |
generate_album_cover | Boolean | Optional | false | If true, generate an album cover for the generated audio |
lyrics_timestamps | Boolean | Optional | false | If true, generates lyric timestamps for the output track |
model | String | Optional | ”v6” | Allowed values: v6, v6-pro, v7, v7-pro |
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 your ownlyrics and use prompt to describe the genre, vibe, instrumentation, and context. See the Prompt Guideline.
Prompt Mode
Supply only aprompt and let the system generate everything: lyrics, style, vocals, and more.
Webhook Delivery
Once the generation is complete, webhooks will be triggered to deliver the following:Standard Requests (non-instrumental):
- 2 (webhook) x Music conversion details (one per version)
- 2 (webhook) x Lyrics with timestamp data
- 2 (webhook) x Streaming URL
- 1 (webhook) x Album cover image
Instrumental-only Requests:
- 2 (webhook) x Music conversion details (one per version)
- 2 (webhook) x Streaming URL
- 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/v2/MusicAI"
headers = {
"Authorization": "<API_KEY>",
"Content-Type": "application/json"
}
payload = {
"prompt": "Create a relaxing lo-fi song for studying",
"lyrics": "It's a brand new day",
"negative_tags" : "sad",
"make_instrumental": False,
"vocal_only": False,
"title": "My Generated Track",
"gender": "female",
"generate_album_cover": True,
"lyrics_timestamps": True,
"model": "v7-pro",
"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",
"subtype": "audio_streaming",
"task_id": "80659560-54e7-5e59-a0a0-86320e92701b",
"conversion_id": "10cfbe38-572a-5218-8981-5aa9a73aa8a5",
"streaming_url": "https://cdn1.musicgpt.com/streams/22e4efb8-c8e7-42d7-a2f1-b094a9a92d24/index.m3u8"
}
{
"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
A natural language prompt for music generation. Keep it under 1000 characters. Be clear and descriptive for better results.
"A happy, upbeat song about summer"
Style of music to generate (e.g., Rock, Pop)
Tags or themes you want to avoid in the song (e.g., sad, slow)
Custom lyrics for the generated music
Whether to make the music instrumental
Whether to generate only vocals of output audio
Title of the generated music track
"My Generated Track"
Gender of the voice model
""
Voice model to convert generated audio
""
Whether to generate an album cover for the generated audio
Whether to generate timestamps for the lyrics
Model version to use for generation
v6, v6-pro, v7, v7-pro "v7"
URL for callback upon completion
"https://example.com/my-webhook"