跳转到主要内容
Send a POST request to https://api.qhaigc.net/v1/music/generations to create a music generation task. You can operate in two modes: standard mode, where you describe the music you want and the model writes its own lyrics, or custom mode, where you supply your own lyrics and style tags. The endpoint returns a task_id immediately — use GET /v1/music/query to check progress and retrieve the audio URL once generation is complete.
Music generation is asynchronous. The initial response only contains a task_id and a PENDING status. Poll GET /v1/music/query every 5–10 seconds until status is "SUCCESS".

Request

POST https://api.qhaigc.net/v1/music/generations

Parameters

prompt
string
必填
In standard mode (custom_mode: false): a description of the music style, mood, or theme. In custom mode (custom_mode: true): the song lyrics to use.
model
string
The music generation model. Options are "suno-v4.5-plus" (default, supports layered vocals and instruments) or "suno-v5" (latest, highest quality).
custom_mode
boolean
Set to true to enable custom mode, which lets you provide your own lyrics in prompt and specify style and title. Defaults to false.
style
string
The musical style or genre (for example, "pop upbeat electronic" or "jazz ballad"). Required when custom_mode is true.
title
string
The song title. Required when custom_mode is true.
instrumental
boolean
Set to true to generate an instrumental track with no vocals. Defaults to false.
vocal_gender
string
The gender of the vocalist. Use "m" for male or "f" for female. Only applies when instrumental is false.

Response

code
string
"success" when the task was accepted.
data
object
The task object.

Example response

{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "750ced71bcdde0f6b7677c967722b888",
    "action": "GENERATIONS",
    "status": "PENDING",
    "fail_reason": "",
    "submit_time": 1773486571,
    "start_time": 0,
    "finish_time": 0,
    "progress": "0%",
    "data": []
  }
}

Code examples

import requests

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

# Standard mode: describe the music and let the model write lyrics
data = {
    "prompt": "A bright and upbeat J-Pop song about spring",
    "model": "suno-v4.5-plus",
    "custom_mode": False,
    "vocal_gender": "f"
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
task_id = result["data"]["task_id"]
print(f"Task submitted. ID: {task_id}")

Models

ModelDescription
suno-v4.5-plusDefault model. Supports layered vocals and instruments.
suno-v5Latest model. Highest audio quality and creative range.
  • GET /v1/music/query — Poll the task status and retrieve audio URLs when generation is complete