AI를 사용하여 음악과 가사를 생성합니다. 이 API는 비동기 방식으로 동작합니다. 생성 응답은 작업 ID를 반환하며, 사용 가능할 때는 우선 사용해야 하는 poll_url 도 함께 반환할 수 있습니다.
요청 본문
사용할 모델: 음악 생성의 경우 suno_music, 가사 전용의 경우 suno_lyrics입니다.
음악 설명입니다. music, lyrics, upload-cover, upload-extend 요청에는 필수이며 add-instrumental 에서는 생략할 수 있습니다.
스타일 태그 (예: “pop, upbeat, electronic”).
피할 스타일입니다. audio_operation 이 add-instrumental 인 경우 필수입니다.
생성 유형: MUSIC (기본값) 또는 LYRICS입니다.
공식 Suno 모델 버전입니다. 음악 생성에는 필수입니다(action이 생략되었거나 MUSIC인 경우). 가사 전용 요청에서는 생략하세요. 지원 값: chirp-v3-5, chirp-v4, chirp-v4-5, chirp-v4.5, chirp-v4-5plus, chirp-v4.5plus, chirp-v4-5all, chirp-v4.5all, chirp-v5, chirp-v5-5, chirp-v5.5.
true 로 설정하면 보컬 없는 연주곡을 생성합니다.
공개적으로 접근 가능한 참조 또는 업로드 오디오 URL입니다. audio_operation 없이 제공하면 upload-cover 흐름을 사용합니다.
업로드 오디오 모드: upload-cover, upload-extend, add-instrumental. upload-extend 는 continue_at 이 필요하고, add-instrumental 은 audio_url, title, tags, negative_tags 가 필요합니다.
이어 만들기 시작 시점(초)입니다. audio_operation 이 upload-extend 인 경우 필수입니다.
어댑터가 반환하는 경우의 비동기 작업 ID 별칭입니다.
사용 가능할 때 반환되는 우선 폴링 URL입니다.
작업 상태: pending, processing, completed 또는 failed입니다.
cURL
Python
JavaScript
Go
PHP
curl -X POST "https://api.tokenlab.sh/v1/music/generations" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "suno_music",
"mv": "chirp-v4",
"prompt": "An upbeat electronic dance track with heavy bass",
"title": "Night Drive",
"tags": "electronic, EDM, energetic"
}'
import requests
response = requests.post(
"https://api.tokenlab.sh/v1/music/generations" ,
headers = { "Authorization" : "Bearer sk-your-api-key" },
json = {
"model" : "suno_music" ,
"mv" : "chirp-v4" ,
"prompt" : "An upbeat electronic dance track with heavy bass" ,
"title" : "Night Drive" ,
"tags" : "electronic, EDM, energetic"
}
)
task_id = response.json()[ "id" ]
print ( f "Task ID: { task_id } " )
const response = await fetch ( 'https://api.tokenlab.sh/v1/music/generations' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-your-api-key' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
model: 'suno_music' ,
mv: 'chirp-v4' ,
prompt: 'An upbeat electronic dance track with heavy bass' ,
title: 'Night Drive' ,
tags: 'electronic, EDM, energetic'
})
});
const data = await response . json ();
console . log ( `Task ID: ${ data . id } ` );
package main
import (
" bytes "
" encoding/json "
" fmt "
" net/http "
)
func main () {
payload := map [ string ] interface {}{
"model" : "suno_music" ,
"mv" : "chirp-v4" ,
"prompt" : "An upbeat electronic dance track with heavy bass" ,
"title" : "Night Drive" ,
"tags" : "electronic, EDM, energetic" ,
}
body , _ := json . Marshal ( payload )
req , _ := http . NewRequest ( "POST" , "https://api.tokenlab.sh/v1/music/generations" , bytes . NewBuffer ( body ))
req . Header . Set ( "Authorization" , "Bearer sk-your-api-key" )
req . Header . Set ( "Content-Type" , "application/json" )
client := & http . Client {}
resp , _ := client . Do ( req )
defer resp . Body . Close ()
var result map [ string ] interface {}
json . NewDecoder ( resp . Body ). Decode ( & result )
fmt . Printf ( "Task ID: %s \n " , result [ "id" ])
}
<? php
$ch = curl_init ( 'https://api.tokenlab.sh/v1/music/generations' );
curl_setopt_array ( $ch , [
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_POST => true ,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json' ,
'Authorization: Bearer sk-your-api-key'
],
CURLOPT_POSTFIELDS => json_encode ([
'model' => 'suno_music' ,
'mv' => 'chirp-v4' ,
'prompt' => 'An upbeat electronic dance track with heavy bass' ,
'title' => 'Night Drive' ,
'tags' => 'electronic, EDM, energetic'
])
]);
$response = curl_exec ( $ch );
curl_close ( $ch );
$data = json_decode ( $response , true );
echo "Task ID: " . $data [ 'id' ];
{
"id" : "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"task_id" : "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"poll_url" : "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"status" : "pending" ,
"created" : 1706000000 ,
"model" : "suno_music"
}