Music Generation
Lyria 3 Clip
Generate 30-second music clips with Google Lyria 3 Clip.
POST /v2/music/generate — model: "lyria-3-clip"
Generate 30-second high-quality music clips from text descriptions using Google Lyria 3 Clip. Supports lyrics, instrumental tracks, genre/BPM/key specification, and multi-language vocals — all controlled through the prompt.
See Music Generation overview for common request fields, response format, and error codes.
Parameters
Lyria 3 Clip is mostly prompt-driven — genre, instruments, BPM, key, mood, lyrics, and structure are specified in the prompt field. The optional lyriaParams object lets you supply visual inspiration:
| Field | Type | Description |
|---|---|---|
lyriaParams.reference_images | string[] | Up to 10 image URLs to use as visual inspiration for the composition |
Code examples
Text-to-music
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": "A 30-second lofi hip hop beat with dusty vinyl crackle, mellow Rhodes piano chords, a slow boom-bap drum pattern at 85 BPM, and a jazzy upright bass line. Instrumental only.",
"model": "lyria-3-clip"
}'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": "A 30-second lofi hip hop beat with dusty vinyl crackle, mellow Rhodes piano chords, a slow boom-bap drum pattern at 85 BPM, and a jazzy upright bass line. Instrumental only.",
"model": "lyria-3-clip",
},
)
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: "A 30-second lofi hip hop beat with dusty vinyl crackle, mellow Rhodes piano chords, a slow boom-bap drum pattern at 85 BPM, and a jazzy upright bass line. Instrumental only.",
model: "lyria-3-clip",
}),
});
console.log(await response.json());body := `{
"prompt": "A 30-second lofi hip hop beat with dusty vinyl crackle, mellow Rhodes piano chords, a slow boom-bap drum pattern at 85 BPM, and a jazzy upright bass line. Instrumental only.",
"model": "lyria-3-clip"
}`
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
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": "Create a dreamy indie pop song with the following lyrics:\n\n[Verse]\nWalking through the neon glow,\ncity lights reflect below,\nevery shadow tells a story,\nevery corner, fading glory.\n\n[Chorus]\nWe are the echoes in the night,\nburning brighter than the light.",
"model": "lyria-3-clip"
}'Image-inspired generation
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": "Compose a 30-second ambient piece that captures the feeling of these images.",
"model": "lyria-3-clip",
"lyriaParams": {
"reference_images": [
"https://example.com/foggy-mountain.jpg",
"https://example.com/quiet-forest.jpg"
]
}
}'Prompting tips
- Genre: Specify a genre or blend (e.g., "lo-fi hip hop", "jazz fusion", "cinematic orchestral").
- Instruments: Name specific instruments (e.g., "Fender Rhodes piano", "slide guitar", "TR-808 drum machine").
- BPM: Set the tempo (e.g., "120 BPM", "slow tempo around 70 BPM").
- Key/Scale: Specify a musical key (e.g., "in G major", "D minor").
- Mood: Use descriptive adjectives (e.g., "nostalgic", "aggressive", "ethereal", "dreamy").
- Instrumental: Include "Instrumental only, no vocals" for background music.
- Lyrics: Provide custom lyrics using
[Verse],[Chorus],[Bridge]section tags.
Try it
POST
/v2/music/generateTry it