curl --request POST \
--url https://api.infery.ai/v1/music/generations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"operation": "generate",
"images": [
{
"data": "<string>",
"mime_type": "image/jpeg"
}
],
"response_format": "mp3",
"custom_mode": true,
"instrumental": true,
"title": "<string>",
"style": "<string>",
"lyrics": "<string>",
"negative_tags": "<string>",
"style_weight": 0.5,
"weirdness_constraint": 0.5,
"audio_weight": 0.5,
"persona_id": "<string>",
"audio_id": "<string>",
"task_id": "<string>",
"upload_url": "<string>",
"continue_at": 123,
"default_param_flag": true,
"tags": "<string>",
"sound_loop": true,
"sound_tempo": 150,
"sound_key": "<string>"
}
'import requests
url = "https://api.infery.ai/v1/music/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"operation": "generate",
"images": [
{
"data": "<string>",
"mime_type": "image/jpeg"
}
],
"response_format": "mp3",
"custom_mode": True,
"instrumental": True,
"title": "<string>",
"style": "<string>",
"lyrics": "<string>",
"negative_tags": "<string>",
"style_weight": 0.5,
"weirdness_constraint": 0.5,
"audio_weight": 0.5,
"persona_id": "<string>",
"audio_id": "<string>",
"task_id": "<string>",
"upload_url": "<string>",
"continue_at": 123,
"default_param_flag": True,
"tags": "<string>",
"sound_loop": True,
"sound_tempo": 150,
"sound_key": "<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({
model: '<string>',
prompt: '<string>',
operation: 'generate',
images: [{data: '<string>', mime_type: 'image/jpeg'}],
response_format: 'mp3',
custom_mode: true,
instrumental: true,
title: '<string>',
style: '<string>',
lyrics: '<string>',
negative_tags: '<string>',
style_weight: 0.5,
weirdness_constraint: 0.5,
audio_weight: 0.5,
persona_id: '<string>',
audio_id: '<string>',
task_id: '<string>',
upload_url: '<string>',
continue_at: 123,
default_param_flag: true,
tags: '<string>',
sound_loop: true,
sound_tempo: 150,
sound_key: '<string>'
})
};
fetch('https://api.infery.ai/v1/music/generations', 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.infery.ai/v1/music/generations",
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([
'model' => '<string>',
'prompt' => '<string>',
'operation' => 'generate',
'images' => [
[
'data' => '<string>',
'mime_type' => 'image/jpeg'
]
],
'response_format' => 'mp3',
'custom_mode' => true,
'instrumental' => true,
'title' => '<string>',
'style' => '<string>',
'lyrics' => '<string>',
'negative_tags' => '<string>',
'style_weight' => 0.5,
'weirdness_constraint' => 0.5,
'audio_weight' => 0.5,
'persona_id' => '<string>',
'audio_id' => '<string>',
'task_id' => '<string>',
'upload_url' => '<string>',
'continue_at' => 123,
'default_param_flag' => true,
'tags' => '<string>',
'sound_loop' => true,
'sound_tempo' => 150,
'sound_key' => '<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.infery.ai/v1/music/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"operation\": \"generate\",\n \"images\": [\n {\n \"data\": \"<string>\",\n \"mime_type\": \"image/jpeg\"\n }\n ],\n \"response_format\": \"mp3\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"title\": \"<string>\",\n \"style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"style_weight\": 0.5,\n \"weirdness_constraint\": 0.5,\n \"audio_weight\": 0.5,\n \"persona_id\": \"<string>\",\n \"audio_id\": \"<string>\",\n \"task_id\": \"<string>\",\n \"upload_url\": \"<string>\",\n \"continue_at\": 123,\n \"default_param_flag\": true,\n \"tags\": \"<string>\",\n \"sound_loop\": true,\n \"sound_tempo\": 150,\n \"sound_key\": \"<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.infery.ai/v1/music/generations")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"operation\": \"generate\",\n \"images\": [\n {\n \"data\": \"<string>\",\n \"mime_type\": \"image/jpeg\"\n }\n ],\n \"response_format\": \"mp3\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"title\": \"<string>\",\n \"style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"style_weight\": 0.5,\n \"weirdness_constraint\": 0.5,\n \"audio_weight\": 0.5,\n \"persona_id\": \"<string>\",\n \"audio_id\": \"<string>\",\n \"task_id\": \"<string>\",\n \"upload_url\": \"<string>\",\n \"continue_at\": 123,\n \"default_param_flag\": true,\n \"tags\": \"<string>\",\n \"sound_loop\": true,\n \"sound_tempo\": 150,\n \"sound_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infery.ai/v1/music/generations")
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 \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"operation\": \"generate\",\n \"images\": [\n {\n \"data\": \"<string>\",\n \"mime_type\": \"image/jpeg\"\n }\n ],\n \"response_format\": \"mp3\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"title\": \"<string>\",\n \"style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"style_weight\": 0.5,\n \"weirdness_constraint\": 0.5,\n \"audio_weight\": 0.5,\n \"persona_id\": \"<string>\",\n \"audio_id\": \"<string>\",\n \"task_id\": \"<string>\",\n \"upload_url\": \"<string>\",\n \"continue_at\": 123,\n \"default_param_flag\": true,\n \"tags\": \"<string>\",\n \"sound_loop\": true,\n \"sound_tempo\": 150,\n \"sound_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1713204900,
"data": [
{
"url": "https://storage.googleapis.com/.../music/...mp3?X-Goog-Signature=...",
"b64_audio": "<string>",
"content_type": "audio/mpeg",
"duration_seconds": 30,
"lyrics": "<string>"
}
],
"credits_used": 180
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model",
"job_id": "job_1hR9xTPZqK4mVLc2nJ7fY5wB"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model",
"job_id": "job_1hR9xTPZqK4mVLc2nJ7fY5wB"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model",
"job_id": "job_1hR9xTPZqK4mVLc2nJ7fY5wB"
}
}Music
Generate full songs from a prompt.
curl --request POST \
--url https://api.infery.ai/v1/music/generations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"operation": "generate",
"images": [
{
"data": "<string>",
"mime_type": "image/jpeg"
}
],
"response_format": "mp3",
"custom_mode": true,
"instrumental": true,
"title": "<string>",
"style": "<string>",
"lyrics": "<string>",
"negative_tags": "<string>",
"style_weight": 0.5,
"weirdness_constraint": 0.5,
"audio_weight": 0.5,
"persona_id": "<string>",
"audio_id": "<string>",
"task_id": "<string>",
"upload_url": "<string>",
"continue_at": 123,
"default_param_flag": true,
"tags": "<string>",
"sound_loop": true,
"sound_tempo": 150,
"sound_key": "<string>"
}
'import requests
url = "https://api.infery.ai/v1/music/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"operation": "generate",
"images": [
{
"data": "<string>",
"mime_type": "image/jpeg"
}
],
"response_format": "mp3",
"custom_mode": True,
"instrumental": True,
"title": "<string>",
"style": "<string>",
"lyrics": "<string>",
"negative_tags": "<string>",
"style_weight": 0.5,
"weirdness_constraint": 0.5,
"audio_weight": 0.5,
"persona_id": "<string>",
"audio_id": "<string>",
"task_id": "<string>",
"upload_url": "<string>",
"continue_at": 123,
"default_param_flag": True,
"tags": "<string>",
"sound_loop": True,
"sound_tempo": 150,
"sound_key": "<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({
model: '<string>',
prompt: '<string>',
operation: 'generate',
images: [{data: '<string>', mime_type: 'image/jpeg'}],
response_format: 'mp3',
custom_mode: true,
instrumental: true,
title: '<string>',
style: '<string>',
lyrics: '<string>',
negative_tags: '<string>',
style_weight: 0.5,
weirdness_constraint: 0.5,
audio_weight: 0.5,
persona_id: '<string>',
audio_id: '<string>',
task_id: '<string>',
upload_url: '<string>',
continue_at: 123,
default_param_flag: true,
tags: '<string>',
sound_loop: true,
sound_tempo: 150,
sound_key: '<string>'
})
};
fetch('https://api.infery.ai/v1/music/generations', 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.infery.ai/v1/music/generations",
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([
'model' => '<string>',
'prompt' => '<string>',
'operation' => 'generate',
'images' => [
[
'data' => '<string>',
'mime_type' => 'image/jpeg'
]
],
'response_format' => 'mp3',
'custom_mode' => true,
'instrumental' => true,
'title' => '<string>',
'style' => '<string>',
'lyrics' => '<string>',
'negative_tags' => '<string>',
'style_weight' => 0.5,
'weirdness_constraint' => 0.5,
'audio_weight' => 0.5,
'persona_id' => '<string>',
'audio_id' => '<string>',
'task_id' => '<string>',
'upload_url' => '<string>',
'continue_at' => 123,
'default_param_flag' => true,
'tags' => '<string>',
'sound_loop' => true,
'sound_tempo' => 150,
'sound_key' => '<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.infery.ai/v1/music/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"operation\": \"generate\",\n \"images\": [\n {\n \"data\": \"<string>\",\n \"mime_type\": \"image/jpeg\"\n }\n ],\n \"response_format\": \"mp3\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"title\": \"<string>\",\n \"style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"style_weight\": 0.5,\n \"weirdness_constraint\": 0.5,\n \"audio_weight\": 0.5,\n \"persona_id\": \"<string>\",\n \"audio_id\": \"<string>\",\n \"task_id\": \"<string>\",\n \"upload_url\": \"<string>\",\n \"continue_at\": 123,\n \"default_param_flag\": true,\n \"tags\": \"<string>\",\n \"sound_loop\": true,\n \"sound_tempo\": 150,\n \"sound_key\": \"<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.infery.ai/v1/music/generations")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"operation\": \"generate\",\n \"images\": [\n {\n \"data\": \"<string>\",\n \"mime_type\": \"image/jpeg\"\n }\n ],\n \"response_format\": \"mp3\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"title\": \"<string>\",\n \"style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"style_weight\": 0.5,\n \"weirdness_constraint\": 0.5,\n \"audio_weight\": 0.5,\n \"persona_id\": \"<string>\",\n \"audio_id\": \"<string>\",\n \"task_id\": \"<string>\",\n \"upload_url\": \"<string>\",\n \"continue_at\": 123,\n \"default_param_flag\": true,\n \"tags\": \"<string>\",\n \"sound_loop\": true,\n \"sound_tempo\": 150,\n \"sound_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infery.ai/v1/music/generations")
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 \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"operation\": \"generate\",\n \"images\": [\n {\n \"data\": \"<string>\",\n \"mime_type\": \"image/jpeg\"\n }\n ],\n \"response_format\": \"mp3\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"title\": \"<string>\",\n \"style\": \"<string>\",\n \"lyrics\": \"<string>\",\n \"negative_tags\": \"<string>\",\n \"style_weight\": 0.5,\n \"weirdness_constraint\": 0.5,\n \"audio_weight\": 0.5,\n \"persona_id\": \"<string>\",\n \"audio_id\": \"<string>\",\n \"task_id\": \"<string>\",\n \"upload_url\": \"<string>\",\n \"continue_at\": 123,\n \"default_param_flag\": true,\n \"tags\": \"<string>\",\n \"sound_loop\": true,\n \"sound_tempo\": 150,\n \"sound_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1713204900,
"data": [
{
"url": "https://storage.googleapis.com/.../music/...mp3?X-Goog-Signature=...",
"b64_audio": "<string>",
"content_type": "audio/mpeg",
"duration_seconds": 30,
"lyrics": "<string>"
}
],
"credits_used": 180
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model",
"job_id": "job_1hR9xTPZqK4mVLc2nJ7fY5wB"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model",
"job_id": "job_1hR9xTPZqK4mVLc2nJ7fY5wB"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model",
"job_id": "job_1hR9xTPZqK4mVLc2nJ7fY5wB"
}
}curl https://api.infery.ai/v1/music/generations \
-H "Authorization: Bearer $INFERY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "suno-v4",
"prompt": "Upbeat indie folk about a sunrise coastal drive"
}'
job_id and no status endpoint to poll — allow for a client timeout of several minutes.
The response carries a URL to the MP3 for each rendered track, plus separate stems if the model exposes them (Suno supports vocals + instrumentals):
{
"created": 1713204900,
"data": [
{
"url": "https://storage.googleapis.com/...mp3?X-Goog-Signature=...",
"content_type": "audio/mpeg",
"duration_seconds": 30
}
],
"credits_used": 180
}
?stream=true to receive SSE progress events instead of one blocking response. If rendering outruns the 5-minute wait budget the call answers 504 with a job_id in the error body; the track is still rendered and billed, and is collected from GET /v1/images/jobs/{job_id}, which serves media jobs of every modality.
Sample output
30-second clip generated withlyria-3-clip (Google Lyria).
Parameters
prompt— natural-language description (required)operation—generate(default),extend,upload_cover,upload_extend,add_instrumental,add_vocals,sounds,vocal_removal,lyricsresponse_format—mp3(default) orwav, where the model supports itcustom_mode— Suno: unlockstitle,styleandlyricsstyle— Suno: genre/style string, max 1000 charslyrics— Suno: explicit lyrics, custom mode onlyinstrumental— Suno: render without vocalsvocal_gender— Suno: exactlymorf
duration_seconds appears on each track in the response, reporting what was actually rendered.
See Music generation for the full Suno parameter set.
Supported models
Suno and Google Lyria. See Models → Music.Authorizations
API key in format: Bearer inf_***
Query Parameters
Read the generation as Server-Sent Events instead of waiting for a JSON body. A QUERY parameter, not a body field — the handler reads @Query('stream') and accepts only the strings "true" and "1", so a stream key in the BODY is ignored and the caller silently gets buffered JSON. (chat/completions made the opposite choice and takes it in the body; the two are not interchangeable.) A streaming request also never defers: it stays on the inline path, so it cannot answer 504 with a job id the way the JSON mode can.
true, 1 Body
Model ID to use for music generation
Text prompt describing the music. For Lyria 3 Clip, always produces 30s. For Lyria 3 Pro, control duration via prompt or timestamps. For Suno, max 500 chars in non-custom mode, up to 5000 in custom mode.
Suno operation type. Default = generate. Other operations require additional fields (audio_id, upload_url, etc).
generate, extend, upload_cover, upload_extend, add_instrumental, add_vocals, sounds, vocal_removal, lyrics Up to 10 base64-encoded images to inspire the music (Lyria 3 only)
Show child attributes
Show child attributes
Output format. WAV only supported by Lyria 3 Pro and Suno.
mp3, wav Suno: Enable custom mode (full control over style/title/lyrics)
Suno: Generate instrumental track only (no vocals)
Suno: Track title (custom mode, max 100 chars)
Suno: Music genre/style (custom mode, max 1000 chars)
Suno: Lyrics text (custom mode, when not instrumental)
Suno: Styles to exclude (e.g. "Heavy Metal, Upbeat Drums")
Suno: Preferred vocal gender
m, f Suno: Style adherence weight (0.0-1.0)
0 <= x <= 1Suno: Creativity/novelty constraint (0.0-1.0)
0 <= x <= 1Suno: Input audio influence weight (0.0-1.0)
0 <= x <= 1Suno: Persona ID to apply (custom mode)
Suno: Persona model type
style_persona, voice_persona Suno: Source audio ID (for extend, vocal_removal)
Suno: Task ID (vocal_removal — references original generation task)
Suno: Audio file URL (for upload_cover, upload_extend, add_instrumental, add_vocals)
Suno: Continue from this second mark (extend operations)
Suno: Use default params (extend operations)
Suno: Vocal removal type (2 stems vs up to 12 stems)
separate_vocal, split_stem Suno: Tags for add_instrumental operation
Suno sounds: Loop the generated sound
Suno sounds: BPM (1-300)
1 <= x <= 300Suno sounds: Musical key
Response
Without ?stream=true (the default) this is application/json — one result object, shown below. Audio is uploaded to private storage and returned as a signed url (7-day expiry); if the storage upload fails, the response falls back to inline b64_audio.
With ?stream=true it is text/event-stream instead: a sequence of data: <json>\n\n lines terminated by a literal data: [DONE]. OpenAPI 3.0 has no vocabulary for "repeat this, then terminate with a sentinel", so the text/event-stream schema below describes the JSON payload of a SINGLE data: line — never the whole body — which is the precedent chat/completions set.
A three-member oneOf rather than chat's single chunk schema, because music's frames are three genuinely different objects, and rather than the pipeline-run stream's bare {type: "string"}, because here the discriminant is IN the payload: progress repeats while the track renders, then exactly one terminal frame, completed or error. (The pipeline-run stream cannot be described this way — its encoder moves type out onto the SSE event: line, leaving no discriminant in the body to key a oneOf on.)
Read type before anything else. The error frame is a real failure delivered as a frame — once SSE headers are flushed the gateway cannot answer with an HTTP status, so the response is still a 200 that ends in [DONE] — and credits_used appears ONLY on the completed frame, so a client that ignores type sees a successful, empty, apparently free stream.