Music Generation
curl --request POST \
--url https://api.example.com/api/v2/generate \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"duration": 123
}
'import requests
url = "https://api.example.com/api/v2/generate"
payload = {
"model": "<string>",
"prompt": "<string>",
"duration": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>', duration: 123})
};
fetch('https://api.example.com/api/v2/generate', 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.example.com/api/v2/generate",
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>',
'duration' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.example.com/api/v2/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.example.com/api/v2/generate")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123\n}"
response = http.request(request)
puts response.read_bodyGenerations (results)
Music Generation
Generate music with MusicGen (Replicate) and ElevenLabs Music
POST
/
api
/
v2
/
generate
Music Generation
curl --request POST \
--url https://api.example.com/api/v2/generate \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"duration": 123
}
'import requests
url = "https://api.example.com/api/v2/generate"
payload = {
"model": "<string>",
"prompt": "<string>",
"duration": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', prompt: '<string>', duration: 123})
};
fetch('https://api.example.com/api/v2/generate', 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.example.com/api/v2/generate",
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>',
'duration' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.example.com/api/v2/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.example.com/api/v2/generate")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"duration\": 123\n}"
response = http.request(request)
puts response.read_bodyModels
| Slug | Provider | Tier | Cost |
|---|---|---|---|
musicgen | Replicate | Starter | 9 tkn |
elevenlabs-music | ElevenLabs | Basic+ | 58 tkn |
Request
string
required
Authorization: Bearer nb_YOUR_API_KEYstring
required
musicgen or elevenlabs-musicstring
required
Text description of the music — genre, mood, instruments, tempo.Example:
"Upbeat electronic dance track with synthesizers, 128 BPM, energetic"integer
default:"30"
Duration in seconds. Range:
15–120.Response
{
"id": "gen_01j9x2abc123",
"status": "completed",
"type": "audio",
"model": "elevenlabs-music",
"output_url": "https://cdn.elumenta.ru/audio/gen_01j9x2abc123.mp3",
"duration_seconds": 30,
"tokens_used": 58,
"created_at": "2026-03-01T12:00:00Z"
}
Code Examples
import requests
response = requests.post(
"https://elumenta.ru/api/v2/generate",
headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
json={
"model": "musicgen",
"prompt": "Calm lo-fi hip hop, vinyl crackle, piano, 80 BPM, for studying",
"duration": 30
}
)
print(response.json()["output_url"])
import requests
response = requests.post(
"https://elumenta.ru/api/v2/generate",
headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
json={
"model": "elevenlabs-music",
"prompt": "Epic cinematic orchestral score, rising tension, full strings and brass",
"duration": 60
}
)
print(response.json()["output_url"])
const response = await fetch("https://elumenta.ru/api/v2/generate", {
method: "POST",
headers: {
"Authorization": "Bearer nb_YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "elevenlabs-music",
prompt: "Upbeat jazz with piano and double bass, 120 BPM, swing feel",
duration: 45
})
});
const result = await response.json();
console.log(result.output_url);
Prompt Tips
| Goal | Prompt example |
|---|---|
| Background | "Soft ambient background music, minimal, piano and pads" |
| Workout | "High energy rock, electric guitar riff, 140 BPM, motivational" |
| Cinematic | "Epic orchestral film score, rising tension, full strings and brass" |
| Lo-fi | "Lo-fi hip hop, vinyl crackle, Rhodes piano, 75 BPM, relaxing" |
| Corporate | "Uplifting corporate background music, light piano, positive, professional" |
⌘I

