API リファレンス

音楽

このエンドポイントのモデル(1)

ワークベンチで試す
POST/v1/music/generations
GET/v1/music/tasks/{task_id}
GET/v1/music/tasks/{task_id}/content

1 つのエンドポイントで Suno の曲・歌詞・32 のツール。呼び出しはすぐに task_id を返します。完了までタスクをポーリング(または webhook)し、ファイルを読み取ります。

#リクエストパラメーター

  • modelstring必須

    モデルページの音楽モデル ID:suno。

  • operationstring任意

    何をするか:music(既定)は曲を作り、lyrics は歌詞を書き、下のツールで曲を編集・延長・分析・書き出しします。

  • promptstring任意

    インスピレーションモード:曲の内容(最大 3000 文字)。カスタムモード:歌詞(最大 5000 文字)。カスタムモードのインストでは不要。lyrics の場合:歌詞の要望。

  • customboolean任意

    false(既定):インスピレーションモード。prompt は曲の説明です。true:カスタムモード。prompt は歌詞で、title・style・negative_tags・auto_lyrics・persona_id・duration・max_mode が有効になります。

  • instrumentalboolean任意

    true:ボーカルなし。

  • versionstring任意

    v6(既定)、v6-wild、v6-mini。custom_model_id を指定する場合は省略します。

  • titlestring任意

    曲名(最大 80 文字)。カスタムモード。

  • stylestring任意

    ジャンル・ムード・楽器などのスタイルタグ(最大 1000 文字)。カスタムモード。tags も使えます。

  • negative_tagsstring任意

    避けたいスタイル。カスタムモード。

  • vocal_genderstring任意

    Male(男性)または Female(女性)。

  • auto_lyricsboolean任意

    true:与えた歌詞を創造的に書き直します。カスタムモード。

  • style_weightnumber任意

    0〜1:曲がスタイルにどれだけ従うか。0 も有効な値です。

  • weirdness_constraintnumber任意

    0〜1:曲の冒険度。

  • audio_weightnumber任意

    0〜1:参照録音の影響度。

  • varietystring任意

    off・normal・high・extra・max:結果のばらつき。

  • max_modeboolean任意

    true:Max モード。高品質で料金 2 倍。カスタムモード。

  • audio_formatstring任意

    mp3, m4a or wav.

  • durationinteger任意

    目標の長さ(秒、10〜360)。カスタムモード。完成した曲は異なる場合があります。

  • persona_idstring任意

    persona ツールで作った歌手 Persona。カスタムモード。custom_model_id とは併用できません。

  • custom_model_idstring任意

    create-model で学習したモデル。version の代わりに使い、persona_id とは併用できません。

  • parametersobject任意

    ツール固有の項目(下の「ツール」参照)。例:加工する曲の task_id と audio_index。

  • webhook_urlstring任意

    タスクが終了状態になったときに呼び出される HTTPS URL。

  • webhook_secretstring任意

    設定すると、配信に X-Xiaoxiang-Signature: sha256=hex(HMAC-SHA256(body, secret)) が付きます。

曲の作り方は 2 通り

インスピレーションモード(custom false):prompt に曲を説明すると歌詞が自動で書かれます。カスタムモード(custom true):prompt に歌詞を入れ、style・title などで曲を形作ります。まずは prompt だけで始めましょう。

#作った曲を加工する

曲を加工するツールには、task_id(この API が返した、その曲を作ったタスク)と audio_index(そのタスク内での曲の位置:1 曲目は 1、2 曲目は 2)を渡します。自分の完了済み Suno タスクのみ使えます。

自分の録音から始めるには upload で取り込むか、audio_url を直接受け取る upload-cover・upload-extend を使います。add-vocals・add-instrumental・sample は取り込んだ録音のみ対応します。

#ツール

ツールは operation に、各項目は parameters に入れます。必須項目には印があります。料金は 1 曲の料金の倍数です。

Create

  • inspoInspiration references×1.36Max モード対応

    Generate a new song from 1–4 public audio references.

    audio_urls*tags

  • soundsSound effects×0.192

    Generate a sound effect from a text description.

    prompt*type

  • upsample-tagsEnhance style tags×0.08

    Expand and refine music style tags.

    tags*

  • mashupMashup×1Max モード対応

    Create a mashup from exactly two platform tasks.

    task_ids*audio_indexestags

Start from your own audio

  • uploadImport audio×0.08

    Import external audio for use in later studio operations.

    audioFilePath*

  • upload-coverCover your audio×1Max モード対応

    Upload audio and remake it in a new style in one step.

    audio_url*customtagspromptinstrumental

  • upload-extendExtend your audio×1Max モード対応

    Upload audio and continue it from a chosen second.

    audio_url*continue_at*prompttags

  • add-vocalsAdd vocals×1Max モード対応

    Layer vocals onto your uploaded instrumental or song.

    task_id*audio_indexcustomprompttags

  • add-instrumentalAdd instrumental×1Max モード対応

    Layer an instrumental onto your uploaded vocals or song.

    task_id*audio_indextags

  • sampleSample to song×1Max モード対応

    Generate a new song from an existing song or sample.

    task_id*audio_indexstart_s*end_s*instrumentaltags

Edit a song

  • extendExtend song×1Max モード対応

    Continue and extend an existing song from a specified time.

    task_id*audio_indexcontinue_at*prompttags

  • concatAssemble full song×0.08

    Assemble existing segments into a complete song.

    task_id*audio_index

  • coverStyle cover×1Max モード対応

    Rearrange an existing song in a new musical style.

    task_id*audio_indextags

  • replaceReplace section×1Max モード対応

    Regenerate the music within a specified time range.

    task_id*audio_indexstart_s*end_s*infill_lyrics

  • remove-sectionRemove section×0.16

    Remove a specified time range from a song.

    task_id*audio_indexstart_s*end_s*

  • cropCrop audio×0.16

    Keep only the specified time range.

    task_id*audio_indexstart_s*end_s*

  • fade-inFade in×0.16

    Add a fade-in effect to the beginning of a song.

    task_id*audio_indexduration_s*

  • fade-outFade out×0.16

    Add a fade-out effect to the end of a song.

    task_id*audio_indexduration_s*

  • adjust-speedAdjust speed×0.48

    Change playback speed without changing pitch.

    task_id*audio_indexspeed*keep_pitch

  • remasterRemaster×1

    Improve the clarity, loudness, and overall texture of a song.

    task_id*audio_indexvariation_category

  • add-stemAdd a stem×1Max モード対応

    Layer a new stem onto an existing song.

    task_id*audio_indextags

Stems, voices and models

  • stemsExtract a stem×2

    Extract a selected stem from a song.

    task_id*audio_indexstem_type

  • stems-allSeparate all stems×4.8

    Separate every available stem in a song.

    task_id*audio_index

  • personaCreate Persona×0.08

    Create a singer Persona from a song or Vox result.

    task_id*audio_indexname*describestyles

  • create-voiceCreate voice×0.32

    Create a reusable voice from a public audio URL.

    audio_url*

  • create-modelTrain a custom model×19.2

    Train a model on 6–24 of your own tracks, then use it as custom_model_id. Training can take about 20 minutes.

    name*audio_urls*

  • voxExtract Vox×0.08非推奨

    Deprecated: make a Persona straight from a song instead.

    task_id*audio_indexvocal_start_svocal_end_s

Export and analyse

  • downloadDownload audio×0.032

    Get a song as MP3, M4A or WAV files.

    task_id*audio_indexformats

  • generate-mp4Generate music video×0.08

    Render a song as an MP4 music video.

    task_id*audio_index

  • midiGenerate MIDI×1

    Convert a song into a MIDI result.

    task_id*audio_index

  • aligned-lyricsLyrics timeline×0.016

    Generate a line-aligned lyrics timeline.

    task_id*audio_index

  • bpmAnalyze BPM×0.016

    Analyze the tempo of a song.

    task_id*audio_index

* は必須です。ワークベンチの「ツール」では、作った曲についてこれらが自動入力されます。

#料金

曲はカタログ価格で、1 回のリクエストで 2 曲が返ります。ツールはその価格に倍数を掛けた料金で、対応ツールは max_mode で 2 倍になります。見積もりと仮押さえはこの倍数で計算され、タスクは実費で精算され、失敗したタスクは返金されます。

#結果

GET /v1/music/tasks/{task_id} はいつでも応答します。GET /v1/music/tasks/{task_id}/content はタスク完了後に1曲目の音声ファイルを返します(それまでは 400)。完了したタスクに含まれるもの:

  • url

    1 曲目の音声。

  • assets

    タスクが作ったすべてのファイル:type(audio・video・image・midi・archive・file)と url。

  • data.music

    各曲の audio_url(順番どおり)。

  • data.lyrics

    歌詞:text と title。

  • data.result

    ツール固有の結果:music[](audio_id・title・lyrics・tags・duration・audio_url・image_url)、persona_id、model_id、upsampled_tags、avg_bpm、files、videoUrl、alignment など。

  • billing

    精算後のタスクの料金。

必要なファイルはダウンロードしてください。保存期間は 3 日です。

#関連するエラー

  • 400 invalid_request操作に必要な項目がない(task_id_required・continue_at_required …)か範囲外です(style_weight_out_of_range・duration_out_of_range・max_mode_requires_custom …)。料金はかかりません。
  • 400 source_task_not_foundtask_id があなたの完了済み Suno タスクではありません。実行中の場合は source_task_not_ready です。
  • 410 media_expiredタスクのファイルは3日後に削除されました。タスク完了前に /content を読むと 400 になります。代わりにタスクをポーリングしてください。
  • 404 not_found不明なパス、不明なモデル名、または期限切れか他アカウントの task_id です。
  • 401Bearer トークンが無効か、ありません。このパスでは error.code が付きません — ステータスで判定してください。
  • 402 insufficient_user_quotaウォレット残高が事前確保の見積額に足りません。
  • 429アカウントのリクエスト頻度上限(デフォルトは毎分 500 件のモデルリクエスト)。間隔を空けて再試行し、Retry-After があればそれに従って待ってください。insufficient_user_quota を含む 429 は頻度制限ではなく 1 日の利用上限です。
  • 503 model_not_found不明なモデルか、現在そのモデルを提供できる正常なチャネルがありません。

エラーコード一覧 →

#リクエスト例

# a song: describe it
curl https://apiking.ai/v1/music/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "suno", "prompt": "a warm cinematic piano theme", "instrumental": true}'

# or write the lyrics yourself
curl https://apiking.ai/v1/music/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "suno", "custom": true, "title": "Neon Rain",
       "prompt": "[Verse]\nCity lights in the rain\n[Chorus]\nWe run till dawn",
       "style": "synthwave, female vocal"}'

# poll every 5s until completed
curl https://apiking.ai/v1/music/tasks/$TASK_ID -H "Authorization: Bearer sk-YOUR_KEY"

# a tool on the second song: extend it from 0:60
curl https://apiking.ai/v1/music/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "suno", "operation": "extend",
       "parameters": {"task_id": "'$TASK_ID'", "audio_index": 2, "continue_at": 60}}'

#レスポンス

response.json
// POST — submit accepted
{"id": "task_xxx", "task_id": "task_xxx", "object": "music.task", "model": "suno", "status": "queued"}

// GET /v1/music/tasks/{task_id}
{
  "task_id": "task_xxx",
  "object": "music.task",
  "operation": "music",
  "status": "completed",
  "progress": "100%",
  "url": "https://…/audio/task_xxx",
  "assets": [
    {"type": "audio", "url": "https://…"},
    {"type": "audio", "url": "https://…"},
    {"type": "image", "url": "https://…"}
  ],
  "data": {
    "music": [{"audio_url": "https://…"}],
    "lyrics": {"title": "Neon Rain", "text": "[Verse] …"},
    "result": {"music": [{"audio_id": "…", "title": "Neon Rain", "duration": 182.4, "audio_url": "https://…", "image_url": "https://…"}]}
  },
  "billing": {"…": "…"}
}

まだ解決しませんか?

リクエスト ID かエラーメッセージを送っていただければ、こちらで調査します。