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 生成音频。

post

使用 Suno AI 根据文本提示生成音频,有助于创建音频内容或响应。

请求体
promptstring必填
make_instrumentalboolean必填
wait_audioboolean必填
响应
post
/generate
POST /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);
  });

最后更新于