Suno 音乐扩展
curl --request POST \
--url https://api.crun.ai/api/v1/client/job/CreateTask \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "suno/music-extend",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"suno_id": "suno_abc123",
"mode": "custom",
"model": "v5",
"continue_at": 30,
"title": "Midnight Addiction (Extended)",
"tags": "Western R&B, female vocal, dark, sensual",
"prompt": "Keep the same dark R&B mood and extend with a new bridge and outro.",
"vocal_gender": "f",
"style_weight": 0.85,
"audio_weight": 0.6,
"weirdness_constraint": 0.2,
"negative_tags": "metal, aggressive"
}
}
'import requests
url = "https://api.crun.ai/api/v1/client/job/CreateTask"
payload = {
"model": "suno/music-extend",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"suno_id": "suno_abc123",
"mode": "custom",
"model": "v5",
"continue_at": 30,
"title": "Midnight Addiction (Extended)",
"tags": "Western R&B, female vocal, dark, sensual",
"prompt": "Keep the same dark R&B mood and extend with a new bridge and outro.",
"vocal_gender": "f",
"style_weight": 0.85,
"audio_weight": 0.6,
"weirdness_constraint": 0.2,
"negative_tags": "metal, aggressive"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'suno/music-extend',
callback_url: 'https://your-domain.com/api/callback',
input: {
suno_id: 'suno_abc123',
mode: 'custom',
model: 'v5',
continue_at: 30,
title: 'Midnight Addiction (Extended)',
tags: 'Western R&B, female vocal, dark, sensual',
prompt: 'Keep the same dark R&B mood and extend with a new bridge and outro.',
vocal_gender: 'f',
style_weight: 0.85,
audio_weight: 0.6,
weirdness_constraint: 0.2,
negative_tags: 'metal, aggressive'
}
})
};
fetch('https://api.crun.ai/api/v1/client/job/CreateTask', 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/CreateTask",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'suno/music-extend',
'callback_url' => 'https://your-domain.com/api/callback',
'input' => [
'suno_id' => 'suno_abc123',
'mode' => 'custom',
'model' => 'v5',
'continue_at' => 30,
'title' => 'Midnight Addiction (Extended)',
'tags' => 'Western R&B, female vocal, dark, sensual',
'prompt' => 'Keep the same dark R&B mood and extend with a new bridge and outro.',
'vocal_gender' => 'f',
'style_weight' => 0.85,
'audio_weight' => 0.6,
'weirdness_constraint' => 0.2,
'negative_tags' => 'metal, aggressive'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/CreateTask"
payload := strings.NewReader("{\n \"model\": \"suno/music-extend\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"suno_id\": \"suno_abc123\",\n \"mode\": \"custom\",\n \"model\": \"v5\",\n \"continue_at\": 30,\n \"title\": \"Midnight Addiction (Extended)\",\n \"tags\": \"Western R&B, female vocal, dark, sensual\",\n \"prompt\": \"Keep the same dark R&B mood and extend with a new bridge and outro.\",\n \"vocal_gender\": \"f\",\n \"style_weight\": 0.85,\n \"audio_weight\": 0.6,\n \"weirdness_constraint\": 0.2,\n \"negative_tags\": \"metal, aggressive\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crun.ai/api/v1/client/job/CreateTask")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"suno/music-extend\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"suno_id\": \"suno_abc123\",\n \"mode\": \"custom\",\n \"model\": \"v5\",\n \"continue_at\": 30,\n \"title\": \"Midnight Addiction (Extended)\",\n \"tags\": \"Western R&B, female vocal, dark, sensual\",\n \"prompt\": \"Keep the same dark R&B mood and extend with a new bridge and outro.\",\n \"vocal_gender\": \"f\",\n \"style_weight\": 0.85,\n \"audio_weight\": 0.6,\n \"weirdness_constraint\": 0.2,\n \"negative_tags\": \"metal, aggressive\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/CreateTask")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"suno/music-extend\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"suno_id\": \"suno_abc123\",\n \"mode\": \"custom\",\n \"model\": \"v5\",\n \"continue_at\": 30,\n \"title\": \"Midnight Addiction (Extended)\",\n \"tags\": \"Western R&B, female vocal, dark, sensual\",\n \"prompt\": \"Keep the same dark R&B mood and extend with a new bridge and outro.\",\n \"vocal_gender\": \"f\",\n \"style_weight\": 0.85,\n \"audio_weight\": 0.6,\n \"weirdness_constraint\": 0.2,\n \"negative_tags\": \"metal, aggressive\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "task_12345678"
}
}{
"code": 422,
"message": "Missing Params or Type Error",
"errors": [
"specific error field message"
]
}API参考
Suno API:扩展音乐
基于现有的 Suno 音乐轨道创建续写内容,以扩展或修改已有音乐。
POST
/
api
/
v1
/
client
/
job
/
CreateTask
Suno 音乐扩展
curl --request POST \
--url https://api.crun.ai/api/v1/client/job/CreateTask \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "suno/music-extend",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"suno_id": "suno_abc123",
"mode": "custom",
"model": "v5",
"continue_at": 30,
"title": "Midnight Addiction (Extended)",
"tags": "Western R&B, female vocal, dark, sensual",
"prompt": "Keep the same dark R&B mood and extend with a new bridge and outro.",
"vocal_gender": "f",
"style_weight": 0.85,
"audio_weight": 0.6,
"weirdness_constraint": 0.2,
"negative_tags": "metal, aggressive"
}
}
'import requests
url = "https://api.crun.ai/api/v1/client/job/CreateTask"
payload = {
"model": "suno/music-extend",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"suno_id": "suno_abc123",
"mode": "custom",
"model": "v5",
"continue_at": 30,
"title": "Midnight Addiction (Extended)",
"tags": "Western R&B, female vocal, dark, sensual",
"prompt": "Keep the same dark R&B mood and extend with a new bridge and outro.",
"vocal_gender": "f",
"style_weight": 0.85,
"audio_weight": 0.6,
"weirdness_constraint": 0.2,
"negative_tags": "metal, aggressive"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'suno/music-extend',
callback_url: 'https://your-domain.com/api/callback',
input: {
suno_id: 'suno_abc123',
mode: 'custom',
model: 'v5',
continue_at: 30,
title: 'Midnight Addiction (Extended)',
tags: 'Western R&B, female vocal, dark, sensual',
prompt: 'Keep the same dark R&B mood and extend with a new bridge and outro.',
vocal_gender: 'f',
style_weight: 0.85,
audio_weight: 0.6,
weirdness_constraint: 0.2,
negative_tags: 'metal, aggressive'
}
})
};
fetch('https://api.crun.ai/api/v1/client/job/CreateTask', 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/CreateTask",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'suno/music-extend',
'callback_url' => 'https://your-domain.com/api/callback',
'input' => [
'suno_id' => 'suno_abc123',
'mode' => 'custom',
'model' => 'v5',
'continue_at' => 30,
'title' => 'Midnight Addiction (Extended)',
'tags' => 'Western R&B, female vocal, dark, sensual',
'prompt' => 'Keep the same dark R&B mood and extend with a new bridge and outro.',
'vocal_gender' => 'f',
'style_weight' => 0.85,
'audio_weight' => 0.6,
'weirdness_constraint' => 0.2,
'negative_tags' => 'metal, aggressive'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/CreateTask"
payload := strings.NewReader("{\n \"model\": \"suno/music-extend\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"suno_id\": \"suno_abc123\",\n \"mode\": \"custom\",\n \"model\": \"v5\",\n \"continue_at\": 30,\n \"title\": \"Midnight Addiction (Extended)\",\n \"tags\": \"Western R&B, female vocal, dark, sensual\",\n \"prompt\": \"Keep the same dark R&B mood and extend with a new bridge and outro.\",\n \"vocal_gender\": \"f\",\n \"style_weight\": 0.85,\n \"audio_weight\": 0.6,\n \"weirdness_constraint\": 0.2,\n \"negative_tags\": \"metal, aggressive\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crun.ai/api/v1/client/job/CreateTask")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"suno/music-extend\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"suno_id\": \"suno_abc123\",\n \"mode\": \"custom\",\n \"model\": \"v5\",\n \"continue_at\": 30,\n \"title\": \"Midnight Addiction (Extended)\",\n \"tags\": \"Western R&B, female vocal, dark, sensual\",\n \"prompt\": \"Keep the same dark R&B mood and extend with a new bridge and outro.\",\n \"vocal_gender\": \"f\",\n \"style_weight\": 0.85,\n \"audio_weight\": 0.6,\n \"weirdness_constraint\": 0.2,\n \"negative_tags\": \"metal, aggressive\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/CreateTask")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"suno/music-extend\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"suno_id\": \"suno_abc123\",\n \"mode\": \"custom\",\n \"model\": \"v5\",\n \"continue_at\": 30,\n \"title\": \"Midnight Addiction (Extended)\",\n \"tags\": \"Western R&B, female vocal, dark, sensual\",\n \"prompt\": \"Keep the same dark R&B mood and extend with a new bridge and outro.\",\n \"vocal_gender\": \"f\",\n \"style_weight\": 0.85,\n \"audio_weight\": 0.6,\n \"weirdness_constraint\": 0.2,\n \"negative_tags\": \"metal, aggressive\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "task_12345678"
}
}{
"code": 422,
"message": "Missing Params or Type Error",
"errors": [
"specific error field message"
]
}重要说明
- 此端点需要提供有效的
suno_id,用于引用现有的 Suno 音乐。如果你需要上传音频进行扩展,请参考:上传音频扩展。 - 支持两种扩展模式:
simple和custom - 在
simple模式下,其他可选参数将继承自原始suno_id - 在
custom模式下,必须提供continue_at、title、tags和prompt
如果你只是对现有曲目进行少量修改,建议优先使用
mode=simple。扩展音乐(Simple 模式)
使用已有歌曲的suno_id 扩展 Suno 音乐。可选参数将继承自原始歌曲。
{
"model": "suno/music-extend",
"callback_url": "",
"input": {
"suno_id": "suno_abc123",
"mode": "simple",
"model": "v5"
}
}
{
"model": "suno/music-extend",
"callback_url": "",
"input": {
"suno_id": "suno_abc123",
"mode": "simple",
"model": "v5",
"continue_at": 30
}
}
扩展音乐(Custom 模式)
自定义扩展允许你控制续写位置和生成内容。你必须指定continue_at、title、tags 和 prompt。
{
"model": "suno/music-extend",
"callback_url": "",
"input": {
"suno_id": "suno_abc123",
"mode": "custom",
"model": "v5",
"continue_at": 30,
"title": "Midnight Addiction (Extended)",
"tags": "Western R&B, female vocal, dark, sensual",
"prompt": "保持相同的暗黑 R&B 氛围,并扩展新的桥段和结尾部分。",
"vocal_gender": "f",
"style_weight": 0.85,
"audio_weight": 0.6,
"weirdness_constraint": 0.2,
"negative_tags": "metal, aggressive"
}
}
获取任务结果
提交任务后,可以使用统一查询接口检查任务进度并获取生成结果:获取 Suno 任务信息
了解如何查询 Suno 任务状态并获取生成结果
授权
所有 API 均需通过 API Key 进行身份认证。
获取 API Key:
- 访问 API Key 管理页面 获取你的 API Key
使用方式: 在请求头中添加:
x-api-key: YOUR_API_KEY
注意:
- 请妥善保管你的 API Key,不要泄露给他人
- 如果怀疑 API Key 已泄露,请立即在管理页面中重置
请求体
application/json
用于生成的模型名称。必填字段。
- 此接口必须使用
suno/music-extend
可用选项:
suno/music-extend Suno 音乐扩展的输入参数。
规则:
suno_id为必填项,且必须引用现有的 Suno 歌曲。mode=simple:其他可选字段将继承自原始suno_id。mode=custom:必须提供continue_at、title、tags和prompt。model=v4:tags最大长度为 200,prompt最大长度为 3000;其他模型:tags最大长度为 1000,prompt最大长度为 5000。
Show child attributes
Show child attributes
可选。用于接收任务完成通知的回调 URL。
- 当生成完成后,系统会向该 URL 发送任务状态和结果
- 回调数据结构与任务状态查询接口返回的
data对象一致 - 你的回调接口应支持接收包含 JSON 数据的 POST 请求
- 成功接收后需返回 HTTP 200 状态码
示例:
"https://your-domain.com/api/callback"
响应
请求成功
响应状态码
- 200:成功 - 请求已成功处理
- 401:未授权 - 缺少认证信息或认证无效
- 402:余额不足 - 账户积分不足,无法执行当前操作
- 404:未找到 - 请求的资源或接口不存在
- 422:参数验证错误 - 请求参数未通过校验
- 429:请求过于频繁 - 当前资源已超出请求限制
- 455:服务不可用 - 系统正在维护中
- 500:服务器错误 - 处理请求时发生未知错误
- 501:生成失败 - 内容生成任务失败
- 505:功能已禁用 - 当前功能暂不可用
可用选项:
200, 401, 402, 404, 422, 429, 455, 500, 501, 505 响应消息,失败时为错误描述
示例:
"success"
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I
