Suno 音乐生成
curl --request POST \
--url https://octopusx.ai/suno/submit/{action} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "<string>",
"prompt": "<string>",
"tags": "<string>",
"title": "<string>",
"mv": "<string>",
"continue_clip_id": "<string>"
}
'import requests
url = "https://octopusx.ai/suno/submit/{action}"
payload = {
"action": "<string>",
"prompt": "<string>",
"tags": "<string>",
"title": "<string>",
"mv": "<string>",
"continue_clip_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: '<string>',
prompt: '<string>',
tags: '<string>',
title: '<string>',
mv: '<string>',
continue_clip_id: '<string>'
})
};
fetch('https://octopusx.ai/suno/submit/{action}', 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://octopusx.ai/suno/submit/{action}",
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([
'action' => '<string>',
'prompt' => '<string>',
'tags' => '<string>',
'title' => '<string>',
'mv' => '<string>',
'continue_clip_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://octopusx.ai/suno/submit/{action}"
payload := strings.NewReader("{\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"tags\": \"<string>\",\n \"title\": \"<string>\",\n \"mv\": \"<string>\",\n \"continue_clip_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://octopusx.ai/suno/submit/{action}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"tags\": \"<string>\",\n \"title\": \"<string>\",\n \"mv\": \"<string>\",\n \"continue_clip_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octopusx.ai/suno/submit/{action}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"tags\": \"<string>\",\n \"title\": \"<string>\",\n \"mv\": \"<string>\",\n \"continue_clip_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"message": "",
"data": "task-suno-abc123"
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-suno-abc123",
"status": "SUCCESS",
"progress": "100%",
"result_url": "https://.../audio/abc123.mp3"
}
}
{
"code": "task_not_exist",
"message": "task_not_exist",
"data": null
}
Suno 音乐生成
使用 /suno/* 路由提交异步音乐任务,并查询歌词或音频生成结果。
POST
https://octopusx.ai
/
suno
/
submit
/
{action}
Suno 音乐生成
curl --request POST \
--url https://octopusx.ai/suno/submit/{action} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "<string>",
"prompt": "<string>",
"tags": "<string>",
"title": "<string>",
"mv": "<string>",
"continue_clip_id": "<string>"
}
'import requests
url = "https://octopusx.ai/suno/submit/{action}"
payload = {
"action": "<string>",
"prompt": "<string>",
"tags": "<string>",
"title": "<string>",
"mv": "<string>",
"continue_clip_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: '<string>',
prompt: '<string>',
tags: '<string>',
title: '<string>',
mv: '<string>',
continue_clip_id: '<string>'
})
};
fetch('https://octopusx.ai/suno/submit/{action}', 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://octopusx.ai/suno/submit/{action}",
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([
'action' => '<string>',
'prompt' => '<string>',
'tags' => '<string>',
'title' => '<string>',
'mv' => '<string>',
'continue_clip_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://octopusx.ai/suno/submit/{action}"
payload := strings.NewReader("{\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"tags\": \"<string>\",\n \"title\": \"<string>\",\n \"mv\": \"<string>\",\n \"continue_clip_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://octopusx.ai/suno/submit/{action}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"tags\": \"<string>\",\n \"title\": \"<string>\",\n \"mv\": \"<string>\",\n \"continue_clip_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octopusx.ai/suno/submit/{action}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"tags\": \"<string>\",\n \"title\": \"<string>\",\n \"mv\": \"<string>\",\n \"continue_clip_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"message": "",
"data": "task-suno-abc123"
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-suno-abc123",
"status": "SUCCESS",
"progress": "100%",
"result_url": "https://.../audio/abc123.mp3"
}
}
{
"code": "task_not_exist",
"message": "task_not_exist",
"data": null
}
Suno 音乐生成
Suno 路由采用独立的异步任务协议,提交与查询都不走/v1/audio/*。
- 一个入口覆盖自动作曲、歌词生成和自定义歌词生曲。
- 异步处理模式,提交后返回任务 ID。
- 支持单任务查询和批量查询。
- 查询结果使用
code、message、data包装。
路由清单
| Method | Path | 说明 |
|---|---|---|
POST | /suno/submit/{action} | 提交音乐任务 |
GET | /suno/fetch/{id} | 查询单任务 |
POST | /suno/fetch | 批量查询 |
认证
Authorization: Bearer YOUR_API_KEY
Path Parameters
操作类型。常见值为
music、lyrics、custom。Body
music 模式下表示音乐描述;custom 模式下通常直接传歌词内容。风格标签,逗号分隔。
歌曲标题。
模型版本,例如
chirp-v3-5 或 chirp-v4。续写已有音乐片段时使用的 clip ID。
请求示例
curl -X POST https://octopusx.ai/suno/submit/music \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "一首关于夏夜海边的轻快流行歌曲",
"tags": "pop, summer, beach",
"title": "海边的夏夜",
"mv": "chirp-v3-5"
}'
响应示例
{
"code": "success",
"message": "",
"data": "task-suno-abc123"
}
{
"code": "success",
"message": "",
"data": {
"task_id": "task-suno-abc123",
"status": "SUCCESS",
"progress": "100%",
"result_url": "https://.../audio/abc123.mp3"
}
}
{
"code": "task_not_exist",
"message": "task_not_exist",
"data": null
}
使用场景
自动作曲
curl -X POST https://octopusx.ai/suno/submit/music \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "一首适合产品发布会开场的电子流行乐",
"tags": "electronic, upbeat"
}'
批量查询
curl -X POST https://octopusx.ai/suno/fetch \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": ["task-suno-abc123", "task-suno-def456"]
}'
相关接口
⌘I