Generate Custom Music
curl --request POST \
--url https://api.musicgpt.com/api/public/v2/MusicAI/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"music_style": "<string>",
"lyrics": "<string>",
"title": "<string>",
"make_instrumental": false,
"vocal_only": false,
"voice_id": "<string>",
"output_length": 123,
"num_outputs": 123,
"generate_album_cover": false,
"webhook_url": "<string>"
}
'import requests
url = "https://api.musicgpt.com/api/public/v2/MusicAI/batch"
payload = {
"prompt": "<string>",
"music_style": "<string>",
"lyrics": "<string>",
"title": "<string>",
"make_instrumental": False,
"vocal_only": False,
"voice_id": "<string>",
"output_length": 123,
"num_outputs": 123,
"generate_album_cover": False,
"webhook_url": "<string>"
}
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: '<string>',
lyrics: '<string>',
title: '<string>',
make_instrumental: false,
vocal_only: false,
voice_id: '<string>',
output_length: 123,
num_outputs: 123,
generate_album_cover: false,
webhook_url: '<string>'
})
};
fetch('https://api.musicgpt.com/api/public/v2/MusicAI/batch', 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/batch",
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>',
'title' => '<string>',
'make_instrumental' => false,
'vocal_only' => false,
'voice_id' => '<string>',
'output_length' => 123,
'num_outputs' => 123,
'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/batch"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"voice_id\": \"<string>\",\n \"output_length\": 123,\n \"num_outputs\": 123,\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/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"voice_id\": \"<string>\",\n \"output_length\": 123,\n \"num_outputs\": 123,\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/batch")
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 \"title\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"voice_id\": \"<string>\",\n \"output_length\": 123,\n \"num_outputs\": 123,\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 Single Song
Create music powered by AI using just a prompt, lyrics, or a defined music style.
POST
/
v2
/
MusicAI
/
batch
Generate Custom Music
curl --request POST \
--url https://api.musicgpt.com/api/public/v2/MusicAI/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"music_style": "<string>",
"lyrics": "<string>",
"title": "<string>",
"make_instrumental": false,
"vocal_only": false,
"voice_id": "<string>",
"output_length": 123,
"num_outputs": 123,
"generate_album_cover": false,
"webhook_url": "<string>"
}
'import requests
url = "https://api.musicgpt.com/api/public/v2/MusicAI/batch"
payload = {
"prompt": "<string>",
"music_style": "<string>",
"lyrics": "<string>",
"title": "<string>",
"make_instrumental": False,
"vocal_only": False,
"voice_id": "<string>",
"output_length": 123,
"num_outputs": 123,
"generate_album_cover": False,
"webhook_url": "<string>"
}
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: '<string>',
lyrics: '<string>',
title: '<string>',
make_instrumental: false,
vocal_only: false,
voice_id: '<string>',
output_length: 123,
num_outputs: 123,
generate_album_cover: false,
webhook_url: '<string>'
})
};
fetch('https://api.musicgpt.com/api/public/v2/MusicAI/batch', 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/batch",
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>',
'title' => '<string>',
'make_instrumental' => false,
'vocal_only' => false,
'voice_id' => '<string>',
'output_length' => 123,
'num_outputs' => 123,
'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/batch"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"voice_id\": \"<string>\",\n \"output_length\": 123,\n \"num_outputs\": 123,\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/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"music_style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"voice_id\": \"<string>\",\n \"output_length\": 123,\n \"num_outputs\": 123,\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/batch")
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 \"title\": \"<string>\",\n \"make_instrumental\": false,\n \"vocal_only\": false,\n \"voice_id\": \"<string>\",\n \"output_length\": 123,\n \"num_outputs\": 123,\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"
}Authorizations
Body
application/json
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.
Style of music to generate (e.g., Rock, Pop)
Custom lyrics for the generated music
Title of the generated music track
Whether to make the music instrumental
Whether to generate only vocals of output audio
Voice model to convert generated audio
The requested output audio length of the request in seconds. This feature is purely experimental.
The number of outputs to generate (1 or 2 only).
Whether to generate an album cover for the generated audio
URL for callback upon completion
⌘I