import requests
url = "https://api.musicgpt.com/api/public/v1/image_to_song"
headers = {"Authorization": "<API_KEY>"}
data = {
"image_url": "https://mybucket.s3.amazonaws.com/image.png",
"prompt": "Generate a relaxing acoustic track inspired by this scene.",
"lyrics": "Let the colors of the sunset fill your heart.",
"make_instrumental": False,
"vocal_only": False,
"key": "C major",
"bpm": 120,
"webhook_url": "https://example.com/webhook",
"voice_id": "voice_123"
}
# Option 1: Using image URL
response = requests.post(url, headers=headers, data=data)
print(response.json())
# Option 2: Uploading a local image file
# with open("image.png", "rb") as f:
# files = {"image_file": f}
# response = requests.post(url, headers=headers, data=data, files=files)
# print(response.json())curl --request POST \
--url https://api.musicgpt.com/api/public/v1/image_to_song \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'image_file=<string>' \
--form image_url=https://mybucket.s3.amazonaws.com/image.png \
--form 'prompt=Generate a relaxing acoustic track inspired by this scene.' \
--form 'lyrics=Let the colors of the sunset fill your heart.' \
--form 'negative_tags=no heavy metal, avoid loud drums' \
--form make_instrumental=false \
--form vocal_only=false \
--form 'key=C major' \
--form bpm=0 \
--form webhook_url=https://example.com/webhook \
--form 'voice_id=<string>' \
--form 0.image_file='@example-file' \
--form 1.image_file='@example-file'const form = new FormData();
form.append('image_file', '<string>');
form.append('image_url', 'https://mybucket.s3.amazonaws.com/image.png');
form.append('prompt', 'Generate a relaxing acoustic track inspired by this scene.');
form.append('lyrics', 'Let the colors of the sunset fill your heart.');
form.append('negative_tags', 'no heavy metal, avoid loud drums');
form.append('make_instrumental', 'false');
form.append('vocal_only', 'false');
form.append('key', 'C major');
form.append('bpm', '0');
form.append('webhook_url', 'https://example.com/webhook');
form.append('voice_id', '<string>');
form.append('0.image_file', '{
"fileName": "example-file"
}');
form.append('1.image_file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.musicgpt.com/api/public/v1/image_to_song', 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/image_to_song",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$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/image_to_song"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
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/image_to_song")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/image_to_song")
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"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Message Published To Queue",
"task_id": "task_12345",
"conversion_id_1": "conv_12345",
"conversion_id_2": "conv_54321",
"eta": 300,
"credit_estimate": 150.5
}{
"success": false,
"error": "image_file or image_url is required."
}{
"success": false,
"error": "Internal Server Error"
}Image to Song
Generate a song from an image by analyzing it and creating music based on visual content. The process can optionally include custom lyrics, voice conversion, and various musical parameters.
import requests
url = "https://api.musicgpt.com/api/public/v1/image_to_song"
headers = {"Authorization": "<API_KEY>"}
data = {
"image_url": "https://mybucket.s3.amazonaws.com/image.png",
"prompt": "Generate a relaxing acoustic track inspired by this scene.",
"lyrics": "Let the colors of the sunset fill your heart.",
"make_instrumental": False,
"vocal_only": False,
"key": "C major",
"bpm": 120,
"webhook_url": "https://example.com/webhook",
"voice_id": "voice_123"
}
# Option 1: Using image URL
response = requests.post(url, headers=headers, data=data)
print(response.json())
# Option 2: Uploading a local image file
# with open("image.png", "rb") as f:
# files = {"image_file": f}
# response = requests.post(url, headers=headers, data=data, files=files)
# print(response.json())curl --request POST \
--url https://api.musicgpt.com/api/public/v1/image_to_song \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'image_file=<string>' \
--form image_url=https://mybucket.s3.amazonaws.com/image.png \
--form 'prompt=Generate a relaxing acoustic track inspired by this scene.' \
--form 'lyrics=Let the colors of the sunset fill your heart.' \
--form 'negative_tags=no heavy metal, avoid loud drums' \
--form make_instrumental=false \
--form vocal_only=false \
--form 'key=C major' \
--form bpm=0 \
--form webhook_url=https://example.com/webhook \
--form 'voice_id=<string>' \
--form 0.image_file='@example-file' \
--form 1.image_file='@example-file'const form = new FormData();
form.append('image_file', '<string>');
form.append('image_url', 'https://mybucket.s3.amazonaws.com/image.png');
form.append('prompt', 'Generate a relaxing acoustic track inspired by this scene.');
form.append('lyrics', 'Let the colors of the sunset fill your heart.');
form.append('negative_tags', 'no heavy metal, avoid loud drums');
form.append('make_instrumental', 'false');
form.append('vocal_only', 'false');
form.append('key', 'C major');
form.append('bpm', '0');
form.append('webhook_url', 'https://example.com/webhook');
form.append('voice_id', '<string>');
form.append('0.image_file', '{
"fileName": "example-file"
}');
form.append('1.image_file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.musicgpt.com/api/public/v1/image_to_song', 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/image_to_song",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$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/image_to_song"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
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/image_to_song")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/image_to_song")
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"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttps://mybucket.s3.amazonaws.com/image.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nGenerate a relaxing acoustic track inspired by this scene.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"lyrics\"\r\n\r\nLet the colors of the sunset fill your heart.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"negative_tags\"\r\n\r\nno heavy metal, avoid loud drums\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"make_instrumental\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocal_only\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\nC major\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bpm\"\r\n\r\n0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://example.com/webhook\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"voice_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.image_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Message Published To Queue",
"task_id": "task_12345",
"conversion_id_1": "conv_12345",
"conversion_id_2": "conv_54321",
"eta": 300,
"credit_estimate": 150.5
}{
"success": false,
"error": "image_file or image_url is required."
}{
"success": false,
"error": "Internal Server Error"
}Authorizations
Body
- Option 1
- Option 2
Image file to upload and analyze. Supported formats: JPEG, PNG, GIF, BMP, WEBP.
URL of the image to analyze. Either this or image_file must be provided.
"https://mybucket.s3.amazonaws.com/image.png"
Additional prompt to guide the song generation from the image.
300"Generate a relaxing acoustic track inspired by this scene."
Custom lyrics to include in the generated audio.
3000"Let the colors of the sunset fill your heart."
Tags or themes to avoid in the song.
"no heavy metal, avoid loud drums"
Generate instrumental output only. Lyrics will be ignored.
Generate vocal-only output.
Musical key for the song.
"C major"
Beats per minute for the song tempo. Defaults to 0 (auto-selected).
Optional callback URL for async processing results.
"https://example.com/webhook"
Voice ID for converting the generated audio. Cannot be used with vocal_only mode.