Suno Tasks API 的对接和使用
Suno Tasks API 可以通过任务 ID 查询歌曲生成、音频导出等 Suno 请求的执行情况。
¶ 申请流程
到 orchats 控制台 获取有任务查询权限的 API Key。示例使用环境变量 API_KEY。
请使用提交任务时的应用身份查询。查询不消耗 Credits。
如果你尚未登录或注册,会自动跳转到登录页面邀请你注册和登录,完成后会自动返回当前页面。
通用应用的 API Key 可用于账号已开放的服务;专用应用的 Key 按该应用的服务范围使用。请检查 Key 的权限、有效期和限额,并确认应用余额足以支付本次请求。可用试用额度以账号显示为准,余额不足时点击「充值」按钮即可。
📘 完整文档:Suno Audios Generation API →
¶ 请求示例
以 Suno Audios Generation API 的异步歌曲任务为例。提交后保存返回的 task_id。
以下是一次实测歌曲任务,任务 ID 为 c409f30d-4b2f-4ad9-8ae7-f394e367713d。请在代码里换成自己的任务 ID。
¶ 任务示例
用上面的任务 ID 提交 retrieve 查询。完成时间出现在 finished_at。本次任务的 response.success 为 true,response.data 里是 Room for One More Chair 和 Always Room for More 两首候选。
¶ 设置请求头和请求体
Request Headers 包括:
accept:指定接收 JSON 格式的响应结果,这里填写为application/json。authorization:调用 API 的密钥,申请之后可以直接下拉选择。
Request Body 包括:
id:上传的任务ID。action:对任务的操作方式。
请求体如下。
{
"action": "retrieve",
"id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d"
}
¶ 代码示例
调试页右侧可以生成对应的调用代码,下面分别给出 cURL 与 Python 示例。
¶ CURL
curl -sS -X POST 'https://api.orchats.repoingest.com/suno/tasks' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"action": "retrieve",
"id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d"
}'
¶ Python
import os
import requests
url = "https://api.orchats.repoingest.com/suno/tasks"
headers = {
"accept": "application/json",
"authorization": f"Bearer {os.environ['API_KEY']}",
"content-type": "application/json",
}
payload = {
"action": "retrieve",
"id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d",
}
response = requests.post(url, json=payload, headers=headers, timeout=180)
print(response.text)
¶ 响应示例
请求成功后,API 将返回此处歌曲任务的详情信息。例如:
{
"id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d",
"type": "audios",
"created_at": 1796115741.863,
"started_at": 1796115741.863,
"finished_at": 1796115800.404,
"elapsed": 58.541,
"request": {
"action": "generate",
"model": "chirp-v6",
"prompt": "A song for Christmas"
},
"trace_id": "f9ff7920-2b74-4c69-867b-183cd41166fa",
"response": {
"success": true,
"task_id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d",
"trace_id": "f9ff7920-2b74-4c69-867b-183cd41166fa",
"data": [
{
"id": "15b56d7a-1ad1-4dc6-bc74-79b102caceeb",
"title": "Room for One More Chair",
"lyric": "[Verse 1]\nThe kettle sings, the window steams\nA paper chain hangs slightly crooked\nYou set the old tin on the shelf\nAnd laugh at how the years have kept it",
"audio_url": "https://cdn.acedata2.cloud/suno/15b56d7a-1ad1-4dc6-bc74-79b102caceeb.mp3",
"created_at": "2026-12-01T09:02:22.466Z",
"model": "chirp-v6",
"state": "succeeded",
"prompt": "A song for Christmas",
"style": "Cinematic Christmas pop with film-score scale, a steady four-on-the-floor pulse, driving syncopated percussion, and a repeating cello ostinato. Begin with intimate piano and close, warm lead vocals; build through layered strings, brass swells, and wordless choir accents into a wide, uplifting final chorus. Polished, spacious mix with clear vocal focus and dynamic section lifts.",
"duration": 231.96
},
{
"id": "555bf85a-907c-4573-b6f3-e816c04aabb9",
"title": "Always Room for More",
"lyric": "[Intro]\n[Wordless vocals]\nOh—ah, oh—ah\n[Verse 1]\nSnow gathers softly on the windowpane",
"audio_url": "https://cdn.acedata2.cloud/suno/555bf85a-907c-4573-b6f3-e816c04aabb9.mp3",
"created_at": "2026-12-01T09:02:22.466Z",
"model": "chirp-v6",
"state": "succeeded",
"prompt": "A song for Christmas",
"style": "Cinematic Christmas pop with marathon-film scale, syncopated rhythmic drive, cello ostinato, four-on-the-floor pulse, and wordless vocal drops. Begin with a restrained cello figure and distant wordless voices; build into a broad, uplifting chorus with layered strings, punchy percussion, and a clear lead vocal. Use a brief countdown-style dropout before the final chorus, then finish with a full, resolved orchestral-pop ending. Polished, spacious mix with strong low-end and crisp rhythmic detail.",
"duration": 231.2
}
],
"cost": {
"amount": 0.504,
"currency": "credit",
"list_amount": 0.56
}
}
}
返回结果一共有多个字段,request 字段就是发起任务时的 request body,同时response 字段是任务完成后返回的response body。字段介绍如下。
id,生成此歌曲任务的 ID,用于唯一标识此次歌曲生成任务。request,查询歌曲任务中的请求信息。response,任务完成时返回的结果。新生成歌曲的response.data[].image_url是原始封面 URL,提供高清封面时可从image_large_url读取。历史任务返回当时保存的链接。created_at,任务创建时间,Unix 时间戳(秒,浮点)。started_at,任务开始执行时间,Unix 时间戳(秒,浮点)。finished_at,任务完成时间,Unix 时间戳(秒)。任务未完成时缺失或为空。elapsed,任务执行耗时,单位为秒。任务完成后提供。
HTTP 200 表示查询成功。先等 finished_at 有值,再读取 response.success。任务成功后取 response.data,失败时检查 response.error。
¶ 批量查询操作
批量查询多个任务时,将 action 设置为 retrieve_batch。
Request Body 包括:
ids:上传的任务ID数组。action:对任务的操作方式。
请求体如下。
{
"action": "retrieve_batch",
"ids": [
"c409f30d-4b2f-4ad9-8ae7-f394e367713d",
"1a01d321-6780-4d8e-8612-02a0fad33102"
]
}
¶ 代码示例
可用 cURL 或 Python 提交同一个请求体。
¶ CURL
curl -sS -X POST 'https://api.orchats.repoingest.com/suno/tasks' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"action": "retrieve_batch",
"ids": [
"c409f30d-4b2f-4ad9-8ae7-f394e367713d",
"1a01d321-6780-4d8e-8612-02a0fad33102"
]
}'
¶ Python
import os
import requests
url = "https://api.orchats.repoingest.com/suno/tasks"
headers = {
"accept": "application/json",
"authorization": f"Bearer {os.environ['API_KEY']}",
"content-type": "application/json",
}
payload = {
"action": "retrieve_batch",
"ids": ["c409f30d-4b2f-4ad9-8ae7-f394e367713d", "1a01d321-6780-4d8e-8612-02a0fad33102"],
}
response = requests.post(url, json=payload, headers=headers, timeout=180)
print(response.text)
¶ 响应示例
请求成功后,API 将返回此次所有批量歌曲任务的具体详情信息。例如:
{
"items": [
{
"id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d",
"type": "audios",
"created_at": 1796115741.863,
"started_at": 1796115741.863,
"finished_at": 1796115800.404,
"elapsed": 58.541,
"request": {
"action": "generate",
"model": "chirp-v6",
"prompt": "A song for Christmas"
},
"trace_id": "f9ff7920-2b74-4c69-867b-183cd41166fa",
"response": {
"success": true,
"task_id": "c409f30d-4b2f-4ad9-8ae7-f394e367713d",
"trace_id": "f9ff7920-2b74-4c69-867b-183cd41166fa",
"data": [
{
"id": "15b56d7a-1ad1-4dc6-bc74-79b102caceeb",
"title": "Room for One More Chair",
"lyric": "[Verse 1]\nThe kettle sings, the window steams\nA paper chain hangs slightly crooked\nYou set the old tin on the shelf\nAnd laugh at how the years have kept it",
"audio_url": "https://cdn.acedata2.cloud/suno/15b56d7a-1ad1-4dc6-bc74-79b102caceeb.mp3",
"created_at": "2026-12-01T09:02:22.466Z",
"model": "chirp-v6",
"state": "succeeded",
"prompt": "A song for Christmas",
"style": "Cinematic Christmas pop with film-score scale, a steady four-on-the-floor pulse, driving syncopated percussion, and a repeating cello ostinato. Begin with intimate piano and close, warm lead vocals; build through layered strings, brass swells, and wordless choir accents into a wide, uplifting final chorus. Polished, spacious mix with clear vocal focus and dynamic section lifts.",
"duration": 231.96
},
{
"id": "555bf85a-907c-4573-b6f3-e816c04aabb9",
"title": "Always Room for More",
"lyric": "[Intro]\n[Wordless vocals]\nOh—ah, oh—ah\n[Verse 1]\nSnow gathers softly on the windowpane",
"audio_url": "https://cdn.acedata2.cloud/suno/555bf85a-907c-4573-b6f3-e816c04aabb9.mp3",
"created_at": "2026-12-01T09:02:22.466Z",
"model": "chirp-v6",
"state": "succeeded",
"prompt": "A song for Christmas",
"style": "Cinematic Christmas pop with marathon-film scale, syncopated rhythmic drive, cello ostinato, four-on-the-floor pulse, and wordless vocal drops. Begin with a restrained cello figure and distant wordless voices; build into a broad, uplifting chorus with layered strings, punchy percussion, and a clear lead vocal. Use a brief countdown-style dropout before the final chorus, then finish with a full, resolved orchestral-pop ending. Polished, spacious mix with strong low-end and crisp rhythmic detail.",
"duration": 231.2
}
],
"cost": {
"amount": 0.504,
"currency": "credit",
"list_amount": 0.56
}
}
},
{
"id": "1a01d321-6780-4d8e-8612-02a0fad33102",
"type": "audios",
"created_at": 1796115741.902,
"started_at": 1796115741.902,
"finished_at": 1796115778.27,
"elapsed": 36.368,
"request": {
"action": "generate",
"model": "chirp-v6",
"title": "Window Lights",
"style": "Soft acoustic folk, fingerpicked guitar and brushed drums",
"lyric": "[Verse]\nWindow lights across the bay\nGuide the boats that drift away\n[Chorus]\nBring the morning home to me\nFold the stars into the sea",
"custom": true,
"duration": 90,
"async": true
},
"trace_id": "ffddaa23-a3dd-44de-aa4e-58a6e3f1ca2c",
"response": {
"success": true,
"task_id": "1a01d321-6780-4d8e-8612-02a0fad33102",
"trace_id": "ffddaa23-a3dd-44de-aa4e-58a6e3f1ca2c",
"data": [
{
"id": "8603c0f3-a396-455c-b945-fb48e65bf014",
"title": "Window Lights",
"lyric": "[Verse]\nWindow lights across the bay\nGuide the boats that drift away\n[Chorus]\nBring the morning home to me\nFold the stars into the sea",
"audio_url": "https://cdn.acedata2.cloud/suno/8603c0f3-a396-455c-b945-fb48e65bf014.mp3",
"created_at": "2026-12-01T09:02:22.389Z",
"model": "chirp-v6",
"state": "succeeded",
"style": "Soft acoustic folk, fingerpicked guitar and brushed drums",
"duration": 89.48
},
{
"id": "50487a72-bc9c-4511-93d7-e2949dfb00c0",
"title": "Window Lights",
"lyric": "[Verse]\nWindow lights across the bay\nGuide the boats that drift away\n[Chorus]\nBring the morning home to me\nFold the stars into the sea",
"audio_url": "https://cdn.acedata2.cloud/suno/50487a72-bc9c-4511-93d7-e2949dfb00c0.mp3",
"created_at": "2026-12-01T09:02:22.389Z",
"model": "chirp-v6",
"state": "succeeded",
"style": "Soft acoustic folk, fingerpicked guitar and brushed drums",
"duration": 89.56
}
],
"cost": {
"amount": 0.504,
"currency": "credit",
"list_amount": 0.56
}
}
}
],
"count": 2
}
返回结果一共有多个字段,其中items是包含了批量歌曲任务的具体详情信息,每个歌曲任务的具体信息与上文的字段一样,字段信息如下。
items,批量歌曲任务的所有具体详情信息。它是一个数组,每个数组的元素和上文查询单个任务的返回结果格式是一样的。count,此处批量查询歌曲任务的个数。
¶ 错误处理
在调用 API 时,如果遇到错误,API 会返回相应的错误代码和信息。例如:
400 token_mismatched:核对任务 ID 和应用归属。400 api_not_implemented:检查查询操作和参数。401 invalid_token:检查 API Key 是否有效。429 too_many_requests:按Retry-After(如有)或退避策略放慢轮询。500 api_error:保留trace_id,并在网络恢复后查询同一个任务。
¶ 错误响应示例
{
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}
¶ 任务本身失败
查询仍可返回 HTTP 200。下面是一次重制任务失败后的查询结果。
{
"id": "add2ba31-609e-48ca-9933-5711a88067fe",
"finished_at": 1796063763.654,
"response": {
"success": false,
"task_id": "add2ba31-609e-48ca-9933-5711a88067fe",
"trace_id": "47579d6e-185f-462e-83d2-6c827675e58d",
"error": {
"code": "timeout",
"message": "timeout while waiting for audio generation"
}
}
}
任务失败详情位于 response.error。重试前检查可选的 retryable 字段。 歌曲生成的重试规则
通过本文档,您已经了解了如何使用 Suno Tasks API 进行查询单个或批量歌曲任务的所有具体详情信息。希望本文档能帮助您更好地对接和使用该 API。如有任何问题,请随时联系我们的技术支持团队。