Suno-API / README.md
AI-APIs's picture
Create README.md
75374fb verified
|
Raw
History Blame Contribute Delete
3.52 kB
---
language:
- en
license: other
pipeline_tag: text-to-audio
tags:
- suno
- text-to-audio
- music-generation
inference: false
---
# Suno API
**Model Page:** [Suno API](https://apiframe.ai/models/suno)
Community model card for calling Suno through a REST API.
Suno has no official public API. This repo documents the `suno` model as exposed by Apiframe: text-to-music on the current V4–V5.5 line, two tracks per job, custom or auto lyrics, and follow-up actions (extend, cover, add vocals, stems).
This repository does not host weights. Suno is a closed model. Inference runs remotely.
<img src="https://apiframe.ai/models-examples/suno-cover-finish-line.webp" alt="Sample output" width="280" />
## Model description
| | |
|---|---|
| Architecture | Suno (default `V4_5PLUS`; pin `V4`, `V4_5`, `V5`, or `V5_5`) |
| Task | text-to-music; lyrics-to-music |
| Output | 2 tracks (`audioUrl`, `imageUrl`, `title`, `duration`) |
| Typical latency | ~110s |
## How to use
```bash
pip install requests
```
```python
import os
import time
import requests
API = "https://api.apiframe.ai/v2"
headers = {
"X-API-Key": os.environ["APIFRAME_API_KEY"],
"Content-Type": "application/json",
}
job = requests.post(
f"{API}/music/generate",
headers=headers,
json={
"model": "suno",
"prompt": "upbeat electronic track with synth arpeggios and driving bass",
"sunoParams": {
"model_version": "V4_5PLUS",
"style": "electronic, synthwave",
},
},
).json()
while True:
result = requests.get(f"{API}/jobs/{job['jobId']}", headers=headers).json()
if result["status"] in ("COMPLETED", "FAILED"):
break
time.sleep(2)
print(result.get("result"))
```
`result["tracks"]` is a list of 2 songs. Pass `webhookUrl` on the generate call if you do not want to poll.
With `custom_mode: false` (default), `prompt` is a description (max 500 characters). With `custom_mode: true`, `prompt` is lyrics (max 5,000 characters). Set `auto_lyrics: true` to keep a long prompt as a description and let Suno write the lyrics.
### Custom lyrics
```python
import os
import requests
headers = {
"X-API-Key": os.environ["APIFRAME_API_KEY"],
"Content-Type": "application/json",
}
requests.post(
"https://api.apiframe.ai/v2/music/generate",
headers=headers,
json={
"model": "suno",
"prompt": "[Verse 1]\nWalking through the city lights\nNeon glow on rainy nights\n\n[Chorus]\nWe are the dreamers, we are the stars",
"sunoParams": {
"custom_mode": True,
"title": "City Dreamers",
"style": "pop, indie",
"vocal_gender": "f",
},
},
)
```
### Follow-up actions
```python
import os
import requests
headers = {
"X-API-Key": os.environ["APIFRAME_API_KEY"],
"Content-Type": "application/json",
}
requests.post(
"https://api.apiframe.ai/v2/music/suno/action",
headers=headers,
json={
"parentJobId": "JOB_ID",
"action": "extend", # cover | add_vocals | stems
"index": 1, # 1-2
},
)
```
## Limitations
- Closed model. No weights, fine-tuning, or local inference.
- Not an official Suno endpoint. Requires an Apiframe API key (`X-API-Key`).
- Commercial use follows Suno's terms.
- Generated media is retained on the CDN for 90 days.
## License
Outputs are subject to Suno's terms. This card is documentation only. Apiframe is not affiliated with, endorsed by, or sponsored by Suno, Inc.