> ## 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 Style API 對接說明

> Suno Music Generation 集成指南 - XHuoAPI

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

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

這裡我們輸入的 `prompt` 是 `A song for Christmas`。

```python theme={null}
import requests

url = "https://api.xhuoapi.ai/v1/suno/style"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "prompt": "A song for Christmas"
}

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

結果如下：

```json theme={null}
{
  "success": true,
  "task_id": "8e887548-7185-48a9-b7cb-e51754f7b87b",
  "trace_id": "ac4ec363-4245-400b-9643-0b6fed8c6b20",
  "data": {
    "upsampled_tags": "Bright, festive bells and crisp acoustic guitar open, with sleigh bells and warm upright piano filling the verse. Lush strings sweep in for the pre-chorus, leading to a soaring full-band chorus enhanced by brass accents. The bridge softens with glockenspiel, then returns to a jubilant finale."
  }
}
```

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