Music Generation
Udio
Text-to-music and lyrics-to-music generation using Udio.
POST /v2/music/generate — model: "udio"
Generate music tracks from text descriptions or custom lyrics using Udio.
See Music Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
udioParams.lyrics_type | string | "generate" | Generation mode: "generate" (AI writes lyrics from description), "user" (you provide lyrics), "instrumental" (no vocals) |
udioParams.title | string | — | Track title (max 80 characters) |
udioParams.style | string | — | Music style / genre hint (max 1,000 characters). Used as the style description when lyrics_type is "user" |
udioParams.negative_tags | string | — | Styles to avoid, comma-separated (max 500 characters) |
udioParams.seed | integer | — | Seed for reproducibility |
Credit cost
| Credits per generation |
|---|
| 9 |
Example result
Once the job is COMPLETED, the result object on GET /v2/jobs/:id looks like:
{
"tracks": [
{
"id": "2e7d9c1a-5f3b-4e6d-8a0c-1b4f7e2d9a5c",
"audioUrl": "https://cdn2.apiframe.ai/audio/c3d4e5f6-a7b8-9012-cdef-345678901234-0.mp3",
"imageUrl": "https://cdn2.apiframe.ai/audio/c3d4e5f6-a7b8-9012-cdef-345678901234-0.jpeg",
"title": "Midnight Frequencies",
"tags": "lo-fi, hip hop, chill",
"duration": 130.7
},
{
"id": "9a4b6e0d-1c8f-4a2e-b5d7-3f0a9c6e1b48",
"audioUrl": "https://cdn2.apiframe.ai/audio/c3d4e5f6-a7b8-9012-cdef-345678901234-1.mp3",
"imageUrl": "https://cdn2.apiframe.ai/audio/c3d4e5f6-a7b8-9012-cdef-345678901234-1.jpeg",
"title": "Midnight Frequencies",
"tags": "lo-fi, hip hop, chill",
"duration": 127.3
}
]
}Udio generates 2 tracks per request. See Result format for field details.
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": "chill lo-fi hip hop beat with jazzy piano chords and vinyl crackle",
"model": "udio",
"udioParams": {
"lyrics_type": "generate"
}
}'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": "chill lo-fi hip hop beat with jazzy piano chords and vinyl crackle",
"model": "udio",
"udioParams": {
"lyrics_type": "generate",
},
},
)
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: "chill lo-fi hip hop beat with jazzy piano chords and vinyl crackle",
model: "udio",
udioParams: {
lyrics_type: "generate",
},
}),
});
console.log(await response.json());body := `{
"prompt": "chill lo-fi hip hop beat with jazzy piano chords and vinyl crackle",
"model": "udio",
"udioParams": {"lyrics_type": "generate"}
}`
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 lyrics 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": "[Verse]\nIn the gentle evening air,\nWhispers dance without a care.\nStars ignite our dreams above,\nWrapped in warmth, we find our love.\n[Chorus]\nHold me close, never let go",
"model": "udio",
"udioParams": {
"lyrics_type": "user",
"style": "jazz, pop",
"title": "Evening Stars"
}
}'Instrumental 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": "ambient electronic soundscape with evolving pads and gentle arpeggios",
"model": "udio",
"udioParams": {
"lyrics_type": "instrumental",
"negative_tags": "vocals, singing"
}
}'Try it
POST
/v2/music/generateTry it