> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Suno 自訂歌手風格 API 對接說明

> Suno Music Generation 集成指南 - XHuoAPI

SUNO 允許我們對已經生成後的歌曲設定歌手風格，然後根據它進行二次創作，本文檔講解相關 API 的對接方法。

該 API 只有三個輸入參數，首先 `audio_id`，它是一個已經在官方生成成功後的歌曲ID，其次 `name` 、`description` 它是對歌手風格的一種名稱和描述。

這裡我們輸入的 `audio_id` 是 `https://cdn.xhuoapi.ai/2qhzs3.png`，這個可以參考[Suno Audios Generation API](https://api.xhuoapi.ai/documents/4da95d9d-7722-4a72-857d-bf6be86036e9) 來進行自訂歌曲生成，最後可以得到`audio_id`。

```bash theme={null}
curl -X POST 'https://api.xhuoapi.ai/v1/suno/persona' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "name": "test",
  "audio_id": "81745564-60e7-4ad4-85a9-6f42f0f4f3b3",
  "description": "test"
}'
```

結果如下：

```
{
  "success": true,
  "task_id": "8e808558-f056-456f-91d6-b97fd94eb3be",
  "data": {
    "persona_id": "dae4ae5d-2b51-4af1-b286-1a4473ef4dba"
  }
}
```

可以看到，`data` 的 `persona_id` 欄位就是生成後的歌手風格 ID。

有了歌手風格 ID 之後，我們便可以使用 [Suno Audios Generation API](https://api.xhuoapi.ai/documents/4da95d9d-7722-4a72-857d-bf6be86036e9) 來進行自訂歌曲生成了，比如說 `action` 傳入 `artist_consistency`，同時 `audio_id` 傳入上傳的歌曲 ID，還需要上傳參數 `persona_id`，這個值是上面返回的歌手風格 ID，就可以根據參考的歌手風格生成新的歌曲了。
