Skip to main content

Generate an Audio

Overview​

  • High-Quality Music Generation: Create music tracks based on descriptive prompts.
  • Flexible Integration: Compatible with various programming languages and frameworks.

Consumption​

2 audio files will be generated for each request, consuming a total of 157 500 UmamiAI Tokens.

API Reference​

Generate audio using Suno AI.​

Generates audio based on a text prompt using Suno AI, useful for creating audio content or responses.

path=/generate method=post

Request

JavaScript

const response = await fetch('https://api.umamiai.xyz/v1/generate', {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY"
},
body: JSON.stringify({
"prompt": "text",
"make_instrumental": false,
"wait_audio": false
}),
});
const data = await response.json();

Python

import requests

response = requests.post(
"https://api.umamiai.xyz/v1/generate",
headers={"Content-Type":"application/json","Authorization": "Bearer YOUR_UMAMIAI_API_KEY"},
json={"prompt":"text","make_instrumental":false,"wait_audio":false}
)
data = response.json()

Curl

curl -L \
-X POST \
-H 'Authorization: Bearer YOUR_UMAMIAI_API_KEY' \
-H 'Content-Type: application/json' \
'https://api.umamiai.xyz/v1/generate' \
-d '{"prompt":"text","make_instrumental":false,"wait_audio":false}'

Response

[
{
"image_url": "https://example.com",
"audio_url": "https://example.com",
"video_url": "https://example.com"
}
]

Examples​

JavaScript

const axios = require('axios');

const url = 'https://api.umamiai.xyz/v1/generate';
const headers = {
'Authorization': 'Bearer YOUR_UMAMIAI_API_KEY',
'Content-Type': 'application/json'
};
const payload = {
'prompt': 'Create a relaxing ambient music track',
'make_instrumental': true,
'wait_audio': true
};

axios.post(url, payload, { headers: headers, responseType: 'arraybuffer' })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});

Python

import requests

url = `https://api.umamiai.xyz/v1/generate`
headers = {
`Authorization`: `Bearer YOUR_UMAMIAI_API_KEY`,
`Content-Type`: `application/json`
}
payload = {
`prompt`: `Create a relaxing ambient music track`,
`make_instrumental`: True,
`wait_audio`: True
}
response = requests.post(url, json=payload, headers=headers)
print(response.content)