Music Generation
Suno
Text-to-music and lyrics-to-music generation using Suno.
POST /v2/music/generate — model: "suno"
Generate music tracks from text descriptions or custom lyrics.
See Music Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
sunoParams.custom_mode | boolean | false | When true, the prompt is used as lyrics |
sunoParams.instrumental | boolean | false | Generate instrumental only (no vocals) |
sunoParams.model_version | string | "V4_5PLUS" | Suno model version: "V4", "V4_5", "V4_5ALL", "V4_5PLUS", "V5", "V5_5" |
sunoParams.title | string | — | Track title (max 80 characters) |
sunoParams.style | string | — | Music style description (max 1,000 characters) |
sunoParams.negative_tags | string | — | Styles to avoid (max 500 characters) |
sunoParams.vocal_gender | string | — | Vocal gender: "m" (male) or "f" (female) |
sunoParams.style_weight | number | — | Style adherence weight (0.0–1.0) |
sunoParams.weirdness_constraint | number | — | Creativity/randomness level (0.0–1.0) |
sunoParams.auto_lyrics | boolean | — | Auto-generate lyrics from the prompt (custom mode only) |
Code examples
Text-to-music (description mode)
curl -X POST https://api.apiframe.ai/v2/music/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "upbeat electronic track with synth arpeggios and driving bass",
"model": "suno",
"sunoParams": {
"model_version": "V4_5PLUS",
"style": "electronic, synthwave"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/music/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "upbeat electronic track with synth arpeggios and driving bass",
"model": "suno",
"sunoParams": {
"model_version": "V4_5PLUS",
"style": "electronic, synthwave",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/music/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "upbeat electronic track with synth arpeggios and driving bass",
model: "suno",
sunoParams: {
model_version: "V4_5PLUS",
style: "electronic, synthwave",
},
}),
});
console.log(await response.json());body := `{
"prompt": "upbeat electronic track with synth arpeggios and driving bass",
"model": "suno",
"sunoParams": {"model_version": "V4_5PLUS", "style": "electronic, synthwave"}
}`
req, _ := http.NewRequest("POST", "https://api.apiframe.ai/v2/music/generate",
strings.NewReader(body))
req.Header.Set("X-API-Key", "afk_your_api_key_here")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)Custom mode (lyrics)
curl -X POST https://api.apiframe.ai/v2/music/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "[Verse 1]\nWalking through the city lights\nNeon glow on rainy nights\n\n[Chorus]\nWe are the dreamers, we are the stars",
"model": "suno",
"sunoParams": {
"custom_mode": true,
"title": "City Dreamers",
"style": "pop, indie",
"vocal_gender": "f"
}
}'Try it
POST
/v2/music/generateTry it