Skip to main content
POST
/
v1
/
music
/
generations
创建音乐生成任务
curl --request POST \
  --url https://api.qhaigc.net/v1/music/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "model": "<string>",
  "custom_mode": true,
  "style": "<string>",
  "title": "<string>",
  "instrumental": true,
  "vocal_gender": "<string>"
}
'
{
  "created": 123,
  "data": [
    {
      "id": "<string>",
      "status": "<string>"
    }
  ]
}

功能说明

通过 Suno 最新模型生成高质量的音乐。支持非自定义(根据提示词生成)和自定义模式(提供歌词、风格等)。

请求参数

名称类型必选说明
promptstring音乐描述(非自定义模式)或歌词(自定义模式)
modelstring模型型号,如 suno-v4.5-plus(默认)、suno-v5
custom_modeboolean是否启用自定义模式,默认为 false
stylestring音乐风格(自定义模式必填)
titlestring音乐标题(自定义模式必填)
instrumentalboolean是否生成纯音乐,默认为 false
vocal_genderstring人声性别,"m"(男)或 "f"(女)

调用示例

import requests

url = "https://api.qhaigc.net/v1/music/generations"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-your-api-key-here"
}

# 非自定义模式
data = {
    "prompt": "一首关于春天的轻快 J-Pop 歌曲",
    "model": "suno-v4.5-plus",
    "custom_mode": false
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

返回结果

成功创建任务后返回任务 ID。音乐生成需要几分钟时间,请使用任务 ID 进行查询。
{
  "created": 1755616949,
  "data": [
    {
      "id": "task_123456789",
      "status": "processing"
    }
  ]
}

相关接口

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
prompt
string
required
model
string
custom_mode
boolean
style
string
title
string
instrumental
boolean
vocal_gender
string

Response

200 - application/json

成功响应

created
integer
data
object[]