Suno MP4 API 連携ガイド

SUNO では、生成した音楽について公式が生成した MP4 リンクを取得できます。本文書では、関連 API の連携方法を説明します。

公式サイトで楽曲の ⋯ → Download → MP4 video asset を開きます。

Suno 公式サイトの Download ウィンドウで MP4 video asset が選択されている

この API の入力パラメータは audio_id のみで、これは公式が生成した楽曲 ID です。

ここで入力する audio_id は 3f8c1800-7a96-4a2b-811f-5fee716a9e32 です。ご自身が生成を完了した楽曲の ID に置き換えてください。

import os

import requests

url = "https://api.orchats.repoingest.com/suno/mp4"
headers = {
    "accept": "application/json",
    "authorization": f"Bearer {os.environ['API_KEY']}",
    "content-type": "application/json",
}
payload = {
    "audio_id": "3f8c1800-7a96-4a2b-811f-5fee716a9e32",
}

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

成功した場合、data.video_url は対応する MP4 ファイルのアドレスです。以下に、今回の実測で受け取った処理拒否の結果をそのまま残します。

{
  "success": false,
  "task_id": "f9308100-cf48-43d2-9d3c-e523ccd57311",
  "trace_id": "d0683bbb-17a3-4113-ac06-850550931b49",
  "error": {
    "code": "api_error",
    "message": "Music processing was denied. Contact support with the trace ID."
  }
}

エクスポートに失敗した場合は、trace_id と元の楽曲の audio_id を使ってサポートに問い合わせることができます。 ご覧のとおり、data の video_url フィールドがその楽曲に対応する MP4 ファイルのリンクです。