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 フィールドが、プロンプトに基づいて最適化されたスタイルパラメータです。