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 AI/ML Tokens.
API Reference
使用 Suno AI 根据文本提示生成音频,有助于创建音频内容或响应。
请求体
promptstring必填
make_instrumentalboolean必填
wait_audioboolean必填
响应
201成功
application/json
post
/generatePOST /generate HTTP/1.1
Host: api.aimlapi.com
Content-Type: application/json
Accept: */*
Content-Length: 60
{
"prompt": "text",
"make_instrumental": true,
"wait_audio": true
}201成功
[
{
"image_url": "https://example.com",
"audio_url": "https://example.com",
"video_url": "https://example.com"
}
]Examples
const axios = require('axios');
const url = 'https://api.aimlapi.com/generate';
const headers = {
'Authorization': 'Bearer YOUR_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);
});
import requests
url = "https://api.aimlapi.com/generate"
headers = {
"Authorization": "Bearer YOUR_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)
最后更新于