分轨与添加音轨
curl --request POST \
--url https://toapis.com/v1/music/generations/stems \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"task_id": "<string>",
"audio_index": 123,
"gpt_description": "<string>",
"custom": true,
"prompt": "<string>",
"max_mode": true
}
'import requests
url = "https://toapis.com/v1/music/generations/stems"
payload = {
"model": "<string>",
"task_id": "<string>",
"audio_index": 123,
"gpt_description": "<string>",
"custom": True,
"prompt": "<string>",
"max_mode": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
task_id: '<string>',
audio_index: 123,
gpt_description: '<string>',
custom: true,
prompt: '<string>',
max_mode: true
})
};
fetch('https://toapis.com/v1/music/generations/stems', 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://toapis.com/v1/music/generations/stems",
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' => '<string>',
'task_id' => '<string>',
'audio_index' => 123,
'gpt_description' => '<string>',
'custom' => true,
'prompt' => '<string>',
'max_mode' => true
]),
CURLOPT_HTTPHEADER => [
"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://toapis.com/v1/music/generations/stems"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"task_id\": \"<string>\",\n \"audio_index\": 123,\n \"gpt_description\": \"<string>\",\n \"custom\": true,\n \"prompt\": \"<string>\",\n \"max_mode\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://toapis.com/v1/music/generations/stems")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"task_id\": \"<string>\",\n \"audio_index\": 123,\n \"gpt_description\": \"<string>\",\n \"custom\": true,\n \"prompt\": \"<string>\",\n \"max_mode\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/music/generations/stems")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"task_id\": \"<string>\",\n \"audio_index\": 123,\n \"gpt_description\": \"<string>\",\n \"custom\": true,\n \"prompt\": \"<string>\",\n \"max_mode\": true\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"status": "<string>"
}Suno 音乐
分轨与添加音轨
stems/stemsAll 分轨,addStem/addVocals/addInstrumental 添加音轨
POST
/
v1
/
music
/
generations
/
stems
分轨与添加音轨
curl --request POST \
--url https://toapis.com/v1/music/generations/stems \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"task_id": "<string>",
"audio_index": 123,
"gpt_description": "<string>",
"custom": true,
"prompt": "<string>",
"max_mode": true
}
'import requests
url = "https://toapis.com/v1/music/generations/stems"
payload = {
"model": "<string>",
"task_id": "<string>",
"audio_index": 123,
"gpt_description": "<string>",
"custom": True,
"prompt": "<string>",
"max_mode": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
task_id: '<string>',
audio_index: 123,
gpt_description: '<string>',
custom: true,
prompt: '<string>',
max_mode: true
})
};
fetch('https://toapis.com/v1/music/generations/stems', 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://toapis.com/v1/music/generations/stems",
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' => '<string>',
'task_id' => '<string>',
'audio_index' => 123,
'gpt_description' => '<string>',
'custom' => true,
'prompt' => '<string>',
'max_mode' => true
]),
CURLOPT_HTTPHEADER => [
"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://toapis.com/v1/music/generations/stems"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"task_id\": \"<string>\",\n \"audio_index\": 123,\n \"gpt_description\": \"<string>\",\n \"custom\": true,\n \"prompt\": \"<string>\",\n \"max_mode\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://toapis.com/v1/music/generations/stems")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"task_id\": \"<string>\",\n \"audio_index\": 123,\n \"gpt_description\": \"<string>\",\n \"custom\": true,\n \"prompt\": \"<string>\",\n \"max_mode\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/music/generations/stems")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"task_id\": \"<string>\",\n \"audio_index\": 123,\n \"gpt_description\": \"<string>\",\n \"custom\": true,\n \"prompt\": \"<string>\",\n \"max_mode\": true\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"status": "<string>"
}国内用户请注意: 中国大陆用户请使用
https://toapis.cn 作为接口地址(Base URL)。POST https://toapis.com/v1/music/generations/{operation}
string
必填
固定
"suno"string
必填
源任务 ID
number
源曲目序号
分轨
| operation | 说明 | 价格 |
|---|---|---|
stems | 人声 / 伴奏两条分轨 | $0.10 |
stemsAll | 全乐器分轨(每条乐器一轨) | $0.24 |
result.music[] 中每轨一个 audio_url,已镜像本站 CDN。
curl --request POST \
--url https://toapis.com/v1/music/generations/stemsAll \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"model":"suno","task_id":"tsk_aud_xxx"}'
添加音轨(各 0.05,Max0.10)
addVocals/addInstrumental/addStem 的 task_id 必须是 uploadTask 产物。| operation | 说明 |
|---|---|
addVocals | 为上传素材生成人声 |
addInstrumental | 为上传素材生成伴奏 |
addStem | 新增一条乐器轨 |
string
目标描述(custom=false 时必填)
boolean
string
custom=true 时的歌词
boolean
Max 档
curl --request POST \
--url https://toapis.com/v1/music/generations/addVocals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"model":"suno","task_id":"tsk_aud_upload_task","gpt_description":"add dreamy female vocals"}'
Response
string
新任务 ID
string
submitted