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-v6",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"variety": "normal",
"max_mode": false,
"audio_format": "mp3",
"hookUrl": "<string>",
"isStorage": true
}
'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-v6",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"variety": "normal",
"max_mode": False,
"audio_format": "mp3",
"hookUrl": "<string>",
"isStorage": True
}
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-v6',
prompt: '<string>',
infill_lyrics: '<string>',
title: '<string>',
tags: 'rock, blues, hip-hop, r&b',
negative_tags: '<string>',
variety: 'normal',
max_mode: false,
audio_format: 'mp3',
hookUrl: '<string>',
isStorage: true
})
};
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-v6',
'prompt' => '<string>',
'infill_lyrics' => '<string>',
'title' => '<string>',
'tags' => 'rock, blues, hip-hop, r&b',
'negative_tags' => '<string>',
'variety' => 'normal',
'max_mode' => false,
'audio_format' => 'mp3',
'hookUrl' => '<string>',
'isStorage' => true
]),
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-v6\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"variety\": \"normal\",\n \"max_mode\": false,\n \"audio_format\": \"mp3\",\n \"hookUrl\": \"<string>\",\n \"isStorage\": true\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-v6\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"variety\": \"normal\",\n \"max_mode\": false,\n \"audio_format\": \"mp3\",\n \"hookUrl\": \"<string>\",\n \"isStorage\": true\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-v6\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"variety\": \"normal\",\n \"max_mode\": false,\n \"audio_format\": \"mp3\",\n \"hookUrl\": \"<string>\",\n \"isStorage\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "<string>",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Замена фрагмента
Используйте Suno фрагмент замены API, чтобы переписать или перегенерировать отдельные части песни без пересоздания всего трека с нуля.
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-v6",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"variety": "normal",
"max_mode": false,
"audio_format": "mp3",
"hookUrl": "<string>",
"isStorage": true
}
'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-v6",
"prompt": "<string>",
"infill_lyrics": "<string>",
"title": "<string>",
"tags": "rock, blues, hip-hop, r&b",
"negative_tags": "<string>",
"variety": "normal",
"max_mode": False,
"audio_format": "mp3",
"hookUrl": "<string>",
"isStorage": True
}
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-v6',
prompt: '<string>',
infill_lyrics: '<string>',
title: '<string>',
tags: 'rock, blues, hip-hop, r&b',
negative_tags: '<string>',
variety: 'normal',
max_mode: false,
audio_format: 'mp3',
hookUrl: '<string>',
isStorage: true
})
};
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-v6',
'prompt' => '<string>',
'infill_lyrics' => '<string>',
'title' => '<string>',
'tags' => 'rock, blues, hip-hop, r&b',
'negative_tags' => '<string>',
'variety' => 'normal',
'max_mode' => false,
'audio_format' => 'mp3',
'hookUrl' => '<string>',
'isStorage' => true
]),
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-v6\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"variety\": \"normal\",\n \"max_mode\": false,\n \"audio_format\": \"mp3\",\n \"hookUrl\": \"<string>\",\n \"isStorage\": true\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-v6\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"variety\": \"normal\",\n \"max_mode\": false,\n \"audio_format\": \"mp3\",\n \"hookUrl\": \"<string>\",\n \"isStorage\": true\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-v6\",\n \"prompt\": \"<string>\",\n \"infill_lyrics\": \"<string>\",\n \"title\": \"<string>\",\n \"tags\": \"rock, blues, hip-hop, r&b\",\n \"negative_tags\": \"<string>\",\n \"variety\": \"normal\",\n \"max_mode\": false,\n \"audio_format\": \"mp3\",\n \"hookUrl\": \"<string>\",\n \"isStorage\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "<string>",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}- Установите infill_lyrics в OO (новый текст для вставки).
- Установите промпт в BB [Куплет 2]OO[Припев]DD (включите часть исходного текста до и после OO, чтобы сформировать контекст).
Авторизации
Вы можете получить API-ключ в панель управления TTAPI.
Тело
Идентификатор аудио
Время начала замены в секундах
Время окончания замены в секундах
Модель для использования. Доступны chirp-v6, chirp-v6-wild, chirp-v6-mini. Старые модели Suno полностью сняты с поддержки; передача старого названия сопоставляет его с chirp-v6. См. Соответствие моделей. После создания пользовательской модели можно передать chirp-custom:{model_id}. См. Создание модели. persona_id и chirp-custom нельзя использовать вместе.
chirp-v6, chirp-v6-wild, chirp-v6-mini Контекстный текст песни
Новый текст песни
Название музыки.
Используется в пользовательском режиме (custom=true). Максимальная длина: 80 символов.
Музыкальный стиль или жанр.
Используется в пользовательском режиме (custom=true). Максимальная длина: 1000 символов.
"rock, blues, hip-hop, r&b"
Музыкальные стили или жанры, которые нужно исключить из генерации.
Используется в пользовательском режиме (custom=true).
Разнообразие стиля. Управляет тем, насколько результат отличается от указанного стиля.
- off: Exact style (точный стиль)
- normal: Balanced variety (сбалансированное разнообразие)
- high: Distinct styles (заметные различия стилей)
- extra: Bold exploration (смелое исследование)
- max: Unreasonably varied (крайне разнообразно)
off, normal, high, extra, max Использовать больше вычислительных ресурсов, чтобы максимизировать согласованность на протяжении всей песни. Только в пользовательском режиме.
- false: Нет (по умолчанию)
- true: Да. При включении расход квоты удваивается
Формат аудио audioUrl после успешного завершения задачи.
mp3, m4a, wav "mp3"
URL обратного уведомления
Сохранять ли сгенерированный звук.
- true: аудио будет сохранено и будет возвращено TTAPI CDN URL.
- false: будет возвращен исходный источник URL.