查询 Suno 人声分离任务的状态和结果。
curl --request GET \
--url https://api.crun.ai/api/v1/client/job/TaskInfo \
--header 'x-api-key: <api-key>'import requests
url = "https://api.crun.ai/api/v1/client/job/TaskInfo"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.crun.ai/api/v1/client/job/TaskInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/TaskInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/TaskInfo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.crun.ai/api/v1/client/job/TaskInfo")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/TaskInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "running",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"credits": 10,
"create_at": 1768900378,
"result": null,
"duration_s": null,
"complete_at": null,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "success",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"create_at": 1768900378,
"result": {
"code": 200,
"message": "generation success",
"media_info": {
"origin_url": "https://example.com/origin.mp3",
"vocal_url": "https://example.com/vocal.mp3",
"instrumental_url": "https://example.com/instrumental.mp3"
}
},
"credits": 10,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "success",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "instrumental"
}
},
"create_at": 1768900378,
"result": {
"code": 200,
"message": "generation success",
"media_info": {
"origin_url": "https://example.com/origin.mp3",
"vocal_url": "https://example.com/vocal.mp3",
"backing_vocals_url": "https://example.com/backing_vocals.mp3",
"drums_url": "https://example.com/drums.mp3",
"bass_url": "https://example.com/bass.mp3",
"guitar_url": "https://example.com/guitar.mp3",
"keyboard_url": "https://example.com/keyboard.mp3",
"percussion_url": "https://example.com/percussion.mp3",
"strings_url": "https://example.com/strings.mp3",
"synth_url": "https://example.com/synth.mp3",
"fx_url": "https://example.com/fx.mp3",
"brass_url": "https://example.com/brass.mp3",
"woodwinds_url": "https://example.com/woodwinds.mp3"
}
},
"credits": 50,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "failed",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"create_at": 1768900378,
"result": {
"code": 501,
"message": "generation failed"
},
"credits": 0,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
Suno任务
Suno 人声分离任务信息
查询 Suno 人声分离任务的状态和结果。
GET
/
api
/
v1
/
client
/
job
/
TaskInfo
查询 Suno 人声分离任务的状态和结果。
curl --request GET \
--url https://api.crun.ai/api/v1/client/job/TaskInfo \
--header 'x-api-key: <api-key>'import requests
url = "https://api.crun.ai/api/v1/client/job/TaskInfo"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.crun.ai/api/v1/client/job/TaskInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/TaskInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/TaskInfo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.crun.ai/api/v1/client/job/TaskInfo")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/TaskInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "running",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"credits": 10,
"create_at": 1768900378,
"result": null,
"duration_s": null,
"complete_at": null,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "success",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"create_at": 1768900378,
"result": {
"code": 200,
"message": "generation success",
"media_info": {
"origin_url": "https://example.com/origin.mp3",
"vocal_url": "https://example.com/vocal.mp3",
"instrumental_url": "https://example.com/instrumental.mp3"
}
},
"credits": 10,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "success",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "instrumental"
}
},
"create_at": 1768900378,
"result": {
"code": 200,
"message": "generation success",
"media_info": {
"origin_url": "https://example.com/origin.mp3",
"vocal_url": "https://example.com/vocal.mp3",
"backing_vocals_url": "https://example.com/backing_vocals.mp3",
"drums_url": "https://example.com/drums.mp3",
"bass_url": "https://example.com/bass.mp3",
"guitar_url": "https://example.com/guitar.mp3",
"keyboard_url": "https://example.com/keyboard.mp3",
"percussion_url": "https://example.com/percussion.mp3",
"strings_url": "https://example.com/strings.mp3",
"synth_url": "https://example.com/synth.mp3",
"fx_url": "https://example.com/fx.mp3",
"brass_url": "https://example.com/brass.mp3",
"woodwinds_url": "https://example.com/woodwinds.mp3"
}
},
"credits": 50,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "failed",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"create_at": 1768900378,
"result": {
"code": 501,
"message": "generation failed"
},
"credits": 0,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
API 接口
GET https://api.crun.ai/api/v1/client/job/TaskInfo
此接口用于查询通过
它与通用任务查询使用相同的接口、参数和任务状态枚举,但任务结果中不包含
/api/v1/client/job/CreateTask API 创建的 Suno 人声分离任务的执行状态,并获取任务结果。它与通用任务查询使用相同的接口、参数和任务状态枚举,但任务结果中不包含
media_urls 或 suno_data。
相反,它会返回一个 media_info 对象,其中包含根据不同分离模式而变化的音频分轨 URL。查询参数
创建任务时返回的唯一任务标识符。示例:
task_12345678请求示例
curl -X GET "https://api.crun.ai/api/v1/client/job/TaskInfo?task_id=task_12345678" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json"
import requests
API_KEY = "YOUR_API_KEY"
headers = {
"X-API-KEY": API_KEY,
"Content-Type": "application/json"
}
params = {
"task_id": "task_12345678",
}
GET_TASK_STATUS_URL = "https://api.crun.ai/api/v1/client/job/TaskInfo"
response = requests.get(GET_TASK_STATUS_URL, params=params, headers=headers)
print(response.json())
const API_KEY = "YOUR_API_KEY";
const taskId = "task_12345678";
const url = new URL("https://api.crun.ai/api/v1/client/job/TaskInfo");
url.searchParams.append("task_id", taskId);
fetch(url.toString(), {
method: "GET",
headers: {
"X-API-KEY": API_KEY,
"Content-Type": "application/json",
},
})
.then(res => res.json())
.then(data => {
console.log(data);
})
.catch(err => {
console.error("请求失败:", err);
});
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "running",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"credits": 10,
"create_at": 1768900378,
"result": null,
"duration_s": null,
"complete_at": null,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "success",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"create_at": 1768900378,
"result": {
"code": 200,
"message": "generation success",
"media_info": {
"origin_url": "https://example.com/origin.mp3",
"vocal_url": "https://example.com/vocal.mp3",
"instrumental_url": "https://example.com/instrumental.mp3"
}
},
"credits": 10,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "success",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "instrumental"
}
},
"create_at": 1768900378,
"result": {
"code": 200,
"message": "generation success",
"media_info": {
"origin_url": "https://example.com/origin.mp3",
"vocal_url": "https://example.com/vocal.mp3",
"backing_vocals_url": "https://example.com/backing_vocals.mp3",
"drums_url": "https://example.com/drums.mp3",
"bass_url": "https://example.com/bass.mp3",
"guitar_url": "https://example.com/guitar.mp3",
"keyboard_url": "https://example.com/keyboard.mp3",
"percussion_url": "https://example.com/percussion.mp3",
"strings_url": "https://example.com/strings.mp3",
"synth_url": "https://example.com/synth.mp3",
"fx_url": "https://example.com/fx.mp3",
"brass_url": "https://example.com/brass.mp3",
"woodwinds_url": "https://example.com/woodwinds.mp3"
}
},
"credits": 50,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
{
"code": 200,
"message": "success",
"data": {
"task_id": "d6956973-2f17-43d4-8514-af6cc3a2f55d",
"provider": "Suno",
"model_version": "suno-vocal-separation",
"status": "failed",
"param": {
"model": "suno/vocal-separatio",
"callback_url": null,
"input": {
"task_id": "task_12345678",
"suno_id": "suno_abc123",
"mode": "vocal"
}
},
"create_at": 1768900378,
"result": {
"code": 501,
"message": "generation failed"
},
"credits": 0,
"duration_s": 137,
"complete_at": 1768900515,
"source": "api"
}
}
响应格式
响应状态码。200 表示请求已成功处理(无论任务执行结果如何,只要任务被找到并返回)。
响应消息。通常为
"success"。包含所有任务信息的任务数据对象。
显示 data 属性
显示 data 属性
任务的唯一标识符。
模型提供方名称。示例:
Suno创建任务时使用的具体模型版本。
任务消耗的积分,任务状态是
pending 或 running 时表示预扣积分,任务状态是 success 或 failed 时表示实际消耗积分。任务创建时的 Unix 时间戳(秒)。
任务完成时的 Unix 时间戳(秒)。
如果任务尚未完成,则为
null。任务执行耗时,单位为秒。如果任务尚未完成,则为 null。
任务创建来源。
Media Info 对象
原始音频 URL。
主人声音频 URL。
伴奏部分音频 URL(仅人声模式)。
和声音频 URL(仅乐器分轨模式)。
鼓组部分音频 URL(仅乐器分轨模式)。
贝斯部分音频 URL(仅乐器分轨模式)。
吉他部分音频 URL(仅乐器分轨模式)。
键盘部分音频 URL(仅乐器分轨模式)。
打击乐部分音频 URL(仅乐器分轨模式)。
弦乐部分音频 URL(仅乐器分轨模式)。
合成器部分音频 URL(仅乐器分轨模式)。
音效部分音频 URL(仅乐器分轨模式)。
铜管部分音频 URL(仅乐器分轨模式)。
木管部分音频 URL(仅乐器分轨模式)。
任务状态枚举
| 状态 | 描述 | 操作 |
|---|---|---|
pending | 任务正在队列中等待处理 | 继续轮询 |
running | 任务正在处理中 | 继续轮询 |
success | 任务已成功完成 | 访问 result.media_info 获取分轨 URL |
failed | 任务失败 | 访问 result 对象查看错误码和错误消息。 |
获取任务结果最佳实践
推荐轮询间隔
推荐轮询间隔
- 轮询间隔:使用 15 到 30 秒的轮询间隔
- 动态调整间隔:对于长时间运行的音频处理任务,可以考虑动态增加轮询间隔
- 延迟首次轮询:在首次检查状态前至少等待一个轮询间隔,以减少不必要的请求
- 最大轮询时长:15-20 分钟后停止轮询并进行排查
过于频繁的轮询可能会触发请求频率限制。生产环境建议使用回调。
使用回调替代轮询
使用回调替代轮询
对于生产应用,我们强烈建议在创建任务时使用
callback_url 参数:- 无需轮询:你的服务器会自动接收通知
- 降低 API 成本:避免持续轮询请求
- 更好的性能:任务完成后立即通知
- 降低延迟:完成与通知之间没有轮询等待延迟
推荐方式
处理已完成任务
处理已完成任务
当
status 为 success 时:- 从响应中的
result字段获取任务结果 - 从
result.media_info中提取分轨 URL - 将音频文件下载到你自己的存储中
- 将结果元数据持久化到你的存储或数据库中
重要:生成的媒体 URL 通常会在 14 天后被永久删除
常见错误码
| Code | 描述 | 解决方案 |
|---|---|---|
401 | 未授权 - API Key 无效或缺失 | 检查你的 API Key |
404 | 任务未找到 | 确认 task_id 是否正确 |
429 | 超出请求频率限制 | 降低请求频率 |
500 | 内部服务器错误 | 几分钟后重试 |
501 | 生成失败 | 查看 result 对象以获取错误码和错误消息。 |
速率限制
- 最大查询频率:每个账户每秒最多 15 次请求
- 推荐间隔:每次轮询间隔 15-30 秒
相关资源
人声分离
创建人声分离任务
Suno 快速开始
了解如何调用 Suno 模型
授权
所有 API 都需要通过 API Key 进行身份验证。
获取 API Key:
- 访问 API Key 管理页面 获取你的 API Key
使用方式: 添加到请求头:
x-api-key: YOUR_API_KEY
注意:
- 请妥善保管你的 API Key,不要与他人共享
- 如果你怀疑 API Key 已泄露,请立即在管理页面中重置
查询参数
用于获取任务结果的任务 ID。
Required string length:
36示例:
"task_1234567"
响应
任务信息获取成功,或任务未找到。
响应状态码
- 200:成功 - 请求已成功处理
- 401:未授权 - 身份验证凭证缺失或无效
- 402:积分不足 - 账户没有足够的积分执行该操作
- 404:未找到 - 请求的资源或接口不存在
- 422:验证错误 - 请求参数未通过验证检查
- 429:请求频率受限 - 已超过该资源的请求限制
- 455:服务不可用 - 系统当前正在维护
- 500:服务器错误 - 处理请求时发生意外错误
- 501:生成失败 - 内容生成任务失败
- 505:功能已禁用 - 请求的功能当前已被禁用
响应消息
任务记录和结果信息。
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I
