Suno V6 通用约定与任务查询
curl --request GET \
--url https://api.apimart.ai/v1/music/tasks/{task_id} \
--header 'Authorization: <authorization>'import requests
url = "https://api.apimart.ai/v1/music/tasks/{task_id}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.apimart.ai/v1/music/tasks/{task_id}', 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.apimart.ai/v1/music/tasks/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$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.apimart.ai/v1/music/tasks/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.apimart.ai/v1/music/tasks/{task_id}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apimart.ai/v1/music/tasks/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "completed",
"progress": 100,
"created": 1789041600,
"cost": 0.12,
"credits_cost": 1.2,
"result": {
"music": [
{
"audio_id": "example-track-id",
"status": "complete",
"title": "沿着灯光",
"lyrics": "[Verse]\n晚风吹过熟悉街道",
"tags": "pop, acoustic",
"display_tags": "Pop, Acoustic",
"negative_tags": "harsh vocals",
"style_weight": 0.7,
"weirdness_constraint": 0,
"audio_weight": 0.4,
"duration": 119.8,
"audio_url": "https://example.com/result.mp3",
"image_url": "https://example.com/cover.jpg",
"image_large_url": "https://example.com/cover-large.jpg"
}
]
}
}
}
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "failed",
"progress": 0,
"cost": 0,
"credits_cost": 0,
"error": {
"message": "任务失败原因",
"type": "task_failed",
"code": "task_failed",
"param": ""
}
}
}
Suno
Suno V6 通用约定与任务查询
Suno V6 的版本选择、自定义模型、异步任务生命周期、源音轨引用和结果结构
GET
/
v1
/
music
/
tasks
/
{task_id}
Suno V6 通用约定与任务查询
curl --request GET \
--url https://api.apimart.ai/v1/music/tasks/{task_id} \
--header 'Authorization: <authorization>'import requests
url = "https://api.apimart.ai/v1/music/tasks/{task_id}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.apimart.ai/v1/music/tasks/{task_id}', 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.apimart.ai/v1/music/tasks/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$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.apimart.ai/v1/music/tasks/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.apimart.ai/v1/music/tasks/{task_id}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apimart.ai/v1/music/tasks/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "completed",
"progress": 100,
"created": 1789041600,
"cost": 0.12,
"credits_cost": 1.2,
"result": {
"music": [
{
"audio_id": "example-track-id",
"status": "complete",
"title": "沿着灯光",
"lyrics": "[Verse]\n晚风吹过熟悉街道",
"tags": "pop, acoustic",
"display_tags": "Pop, Acoustic",
"negative_tags": "harsh vocals",
"style_weight": 0.7,
"weirdness_constraint": 0,
"audio_weight": 0.4,
"duration": 119.8,
"audio_url": "https://example.com/result.mp3",
"image_url": "https://example.com/cover.jpg",
"image_large_url": "https://example.com/cover-large.jpg"
}
]
}
}
}
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "failed",
"progress": 0,
"cost": 0,
"credits_cost": 0,
"error": {
"message": "任务失败原因",
"type": "task_failed",
"code": "task_failed",
"param": ""
}
}
}
所有 Suno 生成、编辑和工具接口都采用异步任务:提交操作后取得
task_id,再通过本页接口查询结果。认证
string
必填
使用 Bearer Token 认证:
Authorization: Bearer <你的 API Key>。V6 版本与模型选择
公共模型只支持以下版本:v6v6-wildv6-mini
version,或提供创建模型任务返回的 custom_model_id。支持版本的编辑操作省略 version 时默认使用 v6。公共 version 与 custom_model_id 不能同时发送。
custom: true 表示自定义歌词模式,custom_model_id 表示使用已训练的自定义模型,两者不是同一个概念。使用自定义歌词模式不会自动切换到自定义模型价格档。通用 V6 生成选项
仅在具体端点列出时发送以下字段:| 字段 | 说明 |
|---|---|
variety | 风格变化程度:off / normal / high / extra / max |
max_mode | Max 模式,默认 false;支持时按普通售价的 2 倍计费 |
audio_format | 输出格式:mp3 / m4a / wav |
duration / duration_s | 目标生成时长,10–360 秒整数,仅指定生成操作支持 |
max_mode: false。variety 与 Max 模式相互独立,选择 variety: "max" 不会自动开启 Max 计费。
文本与权重限制
| 内容 | 字段 | 限制 |
|---|---|---|
| 灵感描述 | prompt(主生成)/ gpt_description(操作接口) | 不超过 3000 个字符 |
| 歌词 | prompt(自定义模式) | 不超过 5000 个字符 |
| 风格 | style(主生成)/ tags(操作接口) | 不超过 1000 个字符 |
| 标题 | title | 不超过 80 个字符 |
| 权重 | style_weight / weirdness / audio_weight | 0–1;数值 0 有效 |
weirdness;weirdness_constraint 是兼容别名。主生成仍使用 weirdness_constraint。文本长度按 Unicode 字符数计算。
引用源音轨
基于已有作品的操作使用:task_id:产出源音轨的 APIMart 任务 ID。audio_index:源任务查询响应的data.result.music[]中的原始位置,从 1 开始,默认1。
新请求统一使用
task_id + audio_index 引用源音轨,不能用 audio_id、music_id 或 audio_url 替代。无法解析源任务或索引越界时会返回 400。提交响应
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01M24YMN4EV04M84R5QYM77R1E"
}
]
}
data[0].task_id 读取任务 ID。submitted 只表示任务已受理,不表示已有最终音频或其它产物。
查询任务
GET /v1/music/tasks/{task_id}
可附加 ?language=zh 获取适用的失败信息翻译。该参数不会改变歌曲或歌词语言。
string
必填
提交接口返回的任务 ID。
data.status 为 completed 或 failed。页面刷新后可继续使用同一个任务 ID 查询;不要因网络超时自动重发收费的 POST 请求。
查询响应
integer
响应状态码。
object
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "completed",
"progress": 100,
"created": 1789041600,
"cost": 0.12,
"credits_cost": 1.2,
"result": {
"music": [
{
"audio_id": "example-track-id",
"status": "complete",
"title": "沿着灯光",
"lyrics": "[Verse]\n晚风吹过熟悉街道",
"tags": "pop, acoustic",
"display_tags": "Pop, Acoustic",
"negative_tags": "harsh vocals",
"style_weight": 0.7,
"weirdness_constraint": 0,
"audio_weight": 0.4,
"duration": 119.8,
"audio_url": "https://example.com/result.mp3",
"image_url": "https://example.com/cover.jpg",
"image_large_url": "https://example.com/cover-large.jpg"
}
]
}
}
}
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "failed",
"progress": 0,
"cost": 0,
"credits_cost": 0,
"error": {
"message": "任务失败原因",
"type": "task_failed",
"code": "task_failed",
"param": ""
}
}
}
结果处理
- 音乐类结果通常位于
data.result.music[],但下载、歌词、MIDI、Persona 和自定义模型等操作有各自的结果结构。 duration是实际时长,允许小数;输入目标时长不保证与成品完全相同。- 权重返回值
0是有效值,不能因为 JavaScript falsy 判断而隐藏。 audio_url不保证使用.mp3后缀,请按接口返回的实际 URL 播放或下载。status="unknown"时保留任务 ID 并允许手动刷新,不要自动创建新任务。
AbortController 只能停止浏览器请求和轮询,不会取消服务器任务。当前接口没有取消已提交 Suno 任务的端点。