跳转到主要内容
Send a GET request to https://api.qhaigc.net/v1/music/tasks/{task_id} to check the status of a music generation task you created with POST /v1/music/generate. When the task completes, the response includes two generated tracks with audio URLs, cover image URLs, and full metadata.

Request

GET https://api.qhaigc.net/v1/music/tasks/{task_id}

Parameters

task_id
string
必填
The task ID returned by POST /v1/music/generate.

Response

code
string
"success" when the request itself succeeded (regardless of task status).
data
object
The task object.

Code example — full generate and poll loop

Python
import time
import requests

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

# Step 1: Submit the generation task
generate_response = requests.post(
    f"{BASE_URL}/music/generations",
    headers=headers,
    json={
        "prompt": "A bright and upbeat J-Pop song about spring",
        "model": "suno-v4.5-plus",
        "custom_mode": False,
        "vocal_gender": "f"
    }
)
task_id = generate_response.json()["data"]["task_id"]
print(f"Task submitted: {task_id}")

# Step 2: Poll until complete
while True:
    query_response = requests.get(
        f"{BASE_URL}/music/tasks/{task_id}",
        headers=headers
    )
    task = query_response.json()["data"]
    status = task["status"]
    progress = task.get("progress", "0%")

    print(f"Status: {status} | Progress: {progress}")

    if status == "SUCCESS":
        for track in task["data"]:
            print(f"Title: {track['title']}")
            print(f"Audio URL: {track['audioUrl']}")
            print(f"Duration: {track['duration']}s")
        break
    elif status == "FAILED":
        print(f"Generation failed: {task.get('fail_reason')}")
        break

    time.sleep(10)