Skip to main content
POST
/
v2
/
MusicAI
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",
    "music_style": "Lo-fi",
    "lyrics": "It's a brand new day",
    "make_instrumental": False,
    "vocal_only": False,
    "voice_id": "e1cb7380-e3db-433a-b186-a996d7545986",
    "title": "My Generated Track",
    "gender": "female",
    "generate_album_cover": False,
    "model": "v7-pro",
    "webhook_url": "https://example.com/my-webhook"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
curl --request POST \
--url https://api.musicgpt.com/api/public/v2/MusicAI \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"music_style": "<string>",
"lyrics": "<string>",
"make_instrumental": false,
"vocal_only": false,
"title": "<string>",
"gender": "<string>",
"voice_id": "<string>",
"generate_album_cover": false,
"webhook_url": "<string>"
}
'
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
music_style: '<string>',
lyrics: '<string>',
make_instrumental: false,
vocal_only: false,
title: '<string>',
gender: '<string>',
voice_id: '<string>',
generate_album_cover: false,
webhook_url: '<string>'
})
};

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' => '<string>',
'music_style' => '<string>',
'lyrics' => '<string>',
'make_instrumental' => false,
'vocal_only' => false,
'title' => '<string>',
'gender' => '<string>',
'voice_id' => '<string>',
'generate_album_cover' => false,
'webhook_url' => '<string>'
]),
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\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"<string>\",\n \"gender\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": false,\n \"webhook_url\": \"<string>\"\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\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"<string>\",\n \"gender\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": false,\n \"webhook_url\": \"<string>\"\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\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"title\": \"<string>\",\n \"gender\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"generate_album_cover\": false,\n \"webhook_url\": \"<string>\"\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"
}
Music AI v2 is our most advanced music generation model yet, faster generation, higher-quality audio, sharper prompt understanding, and more creative control than any version before it.

Choose your model

v6

Studio-quality tracks in seconds, reliable, fast, and built for everyday creation.

v6-pro

Everything in v6, now with real-time streaming so listeners hear the track as it’s composed.

v7

Our best-sounding model yet, richer detail, more texture, state-of-the-art quality.

v7-pro

The full power of v7 with real-time streaming and advanced creative controls. Our flagship.
New here? Reach for v7-pro for the best quality, or drop to v6 for the fastest, most economical generations.

Model comparison

ModelAudio qualityStreamingBest for
v6Very good-Fast, dependable everyday tracks
v6-proVery goodReal-timeLive, as-it-generates playback
v7Best-in-class-Highest-quality final renders
v7-proBest-in-classReal-timeProduction apps that want everything
Pass your choice with the 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.

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 (pro models)
  • Asynchronous webhook support for clean integration
Every request returns two distinct versions of the track, so you always have a creative option to choose from.

Endpoint

POST /v2/MusicAI
This is the primary endpoint for initiating music generation.

Sample Output

Listen to a real sample output: Prompt: a song about greenery, nature and forest. Download Audio

Try 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

ParameterTypeRequiredDefaultDescription
promptStringOptional-A natural language prompt for music generation
titleStringOptional-Title of the generated music
music_styleStringOptional-Musical style or genre (e.g., Rock, Pop, Lo-fi)
lyricsStringOptional""Custom lyrics to use in the song
make_instrumentalBooleanOptionalfalseIf true, generate instrumental-only audio
vocal_onlyBooleanOptionalfalseIf true, generate vocals without instruments
voice_idStringOptional""Apply voice model for vocal rendering
generate_album_coverBooleanOptionalfalseIf true, generate an album cover for the generated audio
modelStringOptional”v6”Allowed values: v6, v6-pro, v7, v7-pro
webhook_urlStringOptional""URL to receive generated results via webhook
genderStringOptional""Allowed values: male, female, neutral.
content-type: application/json

Generation Modes

Custom Mode

Provide both lyrics and music_style to craft a fully personalized song.

Prompt Mode

Supply only a prompt and let the system generate everything: lyrics, style, vocals, and more.
make_instrumental, vocal_only, and Music AI generation with custom voice_id are 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
  • 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": "song about a football match between Man City and Arsenal",
    "music_style": "Pop",
    "model": "v7-pro",
    "webhook_url": "https://abcd.requestcatcher.com/",
    "lyrics": "",
    "voice_id": "Drake"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Sample Response

{
  "success": true,
  "message": "Message published to queue",
  "task_id": "8e058b85-6c22-41cc-a6ed-1e91ed73e34b",
  "conversion_id_1": "2872d9a6-4abe-4a8f-a04f-5540c4ef0a1a",
  "conversion_id_2": "dda98922-d5e9-4fc9-accd-4fc1f0729234",
  "eta": 76,
  "credit_estimate": 0.99
}

Webhook Sample Payload

{
  "success": true,
  "conversion_type": "Music AI",
  "task_id": "8e058b85-6c22-41cc-a6ed-1e91ed73e34b",
  "conversion_id": "2872d9a6-4abe-4a8f-a04f-5540c4ef0a1a",
  "conversion_path": "https://lalals.s3.amazonaws.com/conversions/2872d9a6-4abe-4a8f-a04f-5540c4ef0a1a.mp3",
  "conversion_path_wav": "https://lalals.s3.amazonaws.com/conversions/2872d9a6-4abe-4a8f-a04f-5540c4ef0a1a.wav",
  "conversion_duration": 213.99,
  "is_flagged": false,
  "reason": "",
  "lyrics": "...",
  "lyrics_timestamped": "[ ... ]",
  "title": "Contradiction"
}
Note: Each conversion_id corresponds to a different variation of the track.

Payload and Request Formation

Authorizations

Authorization
string
header
required

Body

application/json
prompt
string

A natural language prompt for music generation. Keep it under 280 characters for guaranteed results, but detailed—the clearer and more descriptive it is, the better the outcome.

music_style
string

Style of music to generate (e.g., Rock, Pop)

lyrics
string

Custom lyrics for the generated music

make_instrumental
boolean
default:false

Whether to make the music instrumental

vocal_only
boolean
default:false

Whether to generate only vocals of output audio

title
string

Title of the generated music track

gender
string

Gender of the voice model

voice_id
string

Voice model to convert generated audio

generate_album_cover
boolean
default:false

Whether to generate an album cover for the generated audio

model
enum<string>

Model version to use for generation

Available options:
v6,
v6-pro,
v7,
v7-pro
webhook_url
string

URL for callback upon completion

Response

Successful response

success
boolean
message
string
task_id
string
conversion_id_1
string
conversion_id_2
string
eta
integer