cURL
curl --request POST \
--url https://api.ttapi.io/suno/v1/replace-section \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"music_id": "<string>",
"infill_start_s": 123,
"infill_end_s": 123,
"mv": "chirp-v5",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"isStorage": true,
"hookUrl": "<string>"
}
'import requests
url = "https://api.ttapi.io/suno/v1/replace-section"
payload = {
"music_id": "<string>",
"infill_start_s": 123,
"infill_end_s": 123,
"mv": "chirp-v5",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"isStorage": True,
"hookUrl": "<string>"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
music_id: '<string>',
infill_start_s: 123,
infill_end_s: 123,
mv: 'chirp-v5',
prompt: '<string>',
infill_lyrics: '<string>',
title: '<string>',
tags: 'rock, blues, hip-hop, r&b',
negative_tags: '<string>',
isStorage: true,
hookUrl: '<string>'
})
};
fetch('https://api.ttapi.io/suno/v1/replace-section', 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.ttapi.io/suno/v1/replace-section",
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([
'music_id' => '<string>',
'infill_start_s' => 123,
'infill_end_s' => 123,
'mv' => 'chirp-v5',
'prompt' => '<string>',
'infill_lyrics' => '<string>',
'title' => '<string>',
'tags' => 'rock, blues, hip-hop, r&b',
'negative_tags' => '<string>',
'isStorage' => true,
'hookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-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.ttapi.io/suno/v1/replace-section"
payload := strings.NewReader("{\n \"music_id\": \"<string>\",\n \"infill_start_s\": 123,\n \"infill_end_s\": 123,\n \"mv\": \"chirp-v5\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"isStorage\": true,\n \"hookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-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.ttapi.io/suno/v1/replace-section")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"music_id\": \"<string>\",\n \"infill_start_s\": 123,\n \"infill_end_s\": 123,\n \"mv\": \"chirp-v5\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"isStorage\": true,\n \"hookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/suno/v1/replace-section")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"music_id\": \"<string>\",\n \"infill_start_s\": 123,\n \"infill_end_s\": 123,\n \"mv\": \"chirp-v5\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"isStorage\": true,\n \"hookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "<string>",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Suno
Suno Replace Section API 文档
使用 Suno 段落替换接口对歌曲中的指定片段进行重写或替换,适合副歌重做、桥段调整和局部优化。
POST
/
suno
/
v1
/
replace-section
cURL
curl --request POST \
--url https://api.ttapi.io/suno/v1/replace-section \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"music_id": "<string>",
"infill_start_s": 123,
"infill_end_s": 123,
"mv": "chirp-v5",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"isStorage": true,
"hookUrl": "<string>"
}
'import requests
url = "https://api.ttapi.io/suno/v1/replace-section"
payload = {
"music_id": "<string>",
"infill_start_s": 123,
"infill_end_s": 123,
"mv": "chirp-v5",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"isStorage": True,
"hookUrl": "<string>"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
music_id: '<string>',
infill_start_s: 123,
infill_end_s: 123,
mv: 'chirp-v5',
prompt: '<string>',
infill_lyrics: '<string>',
title: '<string>',
tags: 'rock, blues, hip-hop, r&b',
negative_tags: '<string>',
isStorage: true,
hookUrl: '<string>'
})
};
fetch('https://api.ttapi.io/suno/v1/replace-section', 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.ttapi.io/suno/v1/replace-section",
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([
'music_id' => '<string>',
'infill_start_s' => 123,
'infill_end_s' => 123,
'mv' => 'chirp-v5',
'prompt' => '<string>',
'infill_lyrics' => '<string>',
'title' => '<string>',
'tags' => 'rock, blues, hip-hop, r&b',
'negative_tags' => '<string>',
'isStorage' => true,
'hookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-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.ttapi.io/suno/v1/replace-section"
payload := strings.NewReader("{\n \"music_id\": \"<string>\",\n \"infill_start_s\": 123,\n \"infill_end_s\": 123,\n \"mv\": \"chirp-v5\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"isStorage\": true,\n \"hookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-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.ttapi.io/suno/v1/replace-section")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"music_id\": \"<string>\",\n \"infill_start_s\": 123,\n \"infill_end_s\": 123,\n \"mv\": \"chirp-v5\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"isStorage\": true,\n \"hookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/suno/v1/replace-section")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"music_id\": \"<string>\",\n \"infill_start_s\": 123,\n \"infill_end_s\": 123,\n \"mv\": \"chirp-v5\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"isStorage\": true,\n \"hookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "<string>",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}提示:替换的歌词 要跟原来的歌词有重复的地方,最好相应的时间能对应上infill_lyrics:表示你要填充或替换进去的“最新歌词片段”。
prompt:表示上下文,需要把“新歌词”前后的原歌词拼接起来。例子:原歌词是 [Verse 1]AA [Chorus]BB [Verse 2] CC [Chorus]DD [Outro]EE,如果你想把 CC 替换为 OOinfill_lyrics 就传 OO(要替换的新歌词)。
prompt 就传 BB [Verse 2]OO[Chorus]DD (在新歌词 OO 前后,保留一部分原歌词,拼成上下文)。这样就能根据 prompt 的上下文和 infill_lyrics 的新歌词片段,生成最佳的结果。
请求体
application/json
音频ID
开始替换时间,单位:秒
结束替换时间,单位:秒
使用模型
可用选项:
chirp-v5-5, chirp-v5, chirp-v4-5+, chirp-v4-5, chirp-v4-5-all, chirp-v4, chirp-v3-5, chirp-v3-0 上下文歌词
新歌词
音乐标题
自定义模式下(custom=true)使用,最多80字符。
音乐风格
自定义模式下(custom=true)使用,最多1000字符
示例:
"rock, blues, hip-hop, r&b"
不想要生成的音乐风格
自定义模式下(custom=true)使用。
是否转存
- true:音频将进行转存,返回TTAPI CDN地址
- false:返回官方源地址
回调通知地址
最后修改于 2026年3月21日
⌘I