Suno Style API 串接說明

SUNO 允許我們輸入提示詞來生成增強歌曲的風格。本文文件講解相關 API 的串接方法。

Suno 官網可在 Advanced → Styles 點擊魔杖,由 My Taste 協助改寫目前的風格描述。圖中是官網實際改寫後的例子。orchats API 接收 prompt,回傳 data.upsampled_tags。 Suno My Taste 說明

Suno 官網點擊 Styles 魔杖後改寫的曲風描述

該 API 只有一個輸入參數,就是 prompt,它是需要優化的風格提示詞。

這裡輸入的 prompt 是 acoustic folk, fingerpicked guitar, brushed drums。

import os

import requests

url = "https://api.orchats.repoingest.com/suno/style"
headers = {
    "accept": "application/json",
    "authorization": f"Bearer {os.environ['API_KEY']}",
    "content-type": "application/json",
}
payload = {
    "prompt": "acoustic folk, fingerpicked guitar, brushed drums",
}

response = requests.post(url, json=payload, headers=headers, timeout=180)
print(response.text)

結果如下:

{
  "success": true,
  "task_id": "be3ab4c2-e924-4350-b114-8228652ee4ee",
  "trace_id": "00b37d5d-b072-439d-9848-c4391678f290",
  "data": {
    "upsampled_tags": "Acoustic folk at a brisk, bright tempo: intricate fingerpicked steel-string guitar leads with open-chord voicings, joined by brushed snare, soft kick, and tambourine on the backbeat. Upright bass adds a buoyant pulse; close, understated vocals sit against warm harmonies, with subtle room reverb and a lively, bittersweet lift."
  }
}

可以看到,data 的 upsampled_tags 欄位就是根據提示詞優化後的風格參數。