ToAPIsToAPIs
Suno 音樂

音樂生成

Suno 音樂生成,支援靈感模式與自訂歌詞模式,可選 Max 高品質檔

POST
/v1/music/generations/generation
  • 根據文字描述或自訂歌詞生成完整歌曲(每次返回 2 個候選)
  • 異步任務管理,透過任務 ID 查詢結果
  • custom 決定 prompt 的語義:自訂歌詞模式 vs 靈感描述模式

Authorizations

Authorizationstring請求頭必填

使用 Bearer Token 認證,取得 API Key:API Key 管理頁面

Body

modelstring請求體必填

固定為 "suno"

customboolean請求體

模式開關,預設 false

  • false:靈感模式,gpt_description(或 prompt)描述想要的音樂
  • true:自訂歌詞模式,prompt 作為歌詞文字,title/style/negative_tags 生效
gpt_descriptionstring請求體

靈感模式下的音樂描述,如 "一首雨夜咖啡館的 lo-fi"。自訂模式下不用傳

promptstring請求體

自訂模式下的歌詞文字(支援 [Verse]/[Chorus] 結構標記)

titlestring請求體

歌曲標題,自訂模式生效

stylestring請求體

風格標籤,自訂模式生效,如 "dreamy synthwave, female vocal"

negative_tagsstring請求體

需要避免的元素,自訂模式生效

instrumentalboolean請求體

是否生成無人聲純音樂

versionstring請求體

Suno 引擎版本:v6 / v6-wild / v6-mini

max_modeboolean請求體

Max 高品質檔,按兩倍計費($0.10/次),需 custom 為 true

persona_idstring請求體

使用已建立的人聲角色 ID,與 custom_model_id 互斥

custom_model_idstring請求體

使用自訂訓練模型 ID,與 version、persona_id 互斥

可選調優參數

style_weight、weirdness、audio_weight、vocal_gender、auto_lyrics、variety 均為可選,不傳使用上游預設值。

Response

task_idstring

任務 ID(tsk_aud_ 前綴),用於 查詢任務狀態

statusstring

初始狀態,submitted / queued / in_progress

完成後 result.music[] 返回 2 個候選曲目,各含 audio_url、image_url(封面)、title、tags、lyrics、duration 等欄位,媒體 URL 已鏡像至本站 CDN。

請求示例

curl --request POST \
  --url https://toapis.com/v1/music/generations/generation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "suno",
    "gpt_description": "一首雨夜咖啡館的 lo-fi 爵士",
    "instrumental": false,
    "version": "v6"
  }'
import requests

resp = requests.post(
    "https://toapis.com/v1/music/generations/generation",
    headers={"Authorization": "Bearer <token>"},
    json={
        "model": "suno",
        "custom": True,
        "prompt": "[Verse]\n街燈亮起來\n風吹過月台\n[Chorus]\n我們一起走過的年代",
        "title": "月台",
        "style": "chinese pop ballad",
        "max_mode": True
    }
)
print(resp.json())
const resp = await fetch("https://toapis.com/v1/music/generations/generation", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "suno",
    gpt_description: "dreamy synthwave with female vocals",
    version: "v6-wild"
  })
});
console.log(await resp.json());