ApiframeApiframe Docs
Music Generation

Lyria 3 Pro

Generate full-length songs with Google Lyria 3 Pro.

Use in Apiframe Studio

POST /v2/music/generatemodel: "lyria-3-pro"

Generate full-length songs (up to ~3 minutes) with structural awareness of intros, verses, choruses, and bridges using Google Lyria 3 Pro. Supports lyrics, instrumental tracks, genre/BPM/key specification, timing control, 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 Pro is mostly prompt-driven — genre, instruments, BPM, key, mood, lyrics, structure, timing, and duration are specified in the prompt field. The optional lyriaParams object lets you supply visual inspiration:

FieldTypeDescription
lyriaParams.reference_imagesstring[]Up to 10 image URLs to use as visual inspiration for the composition

You can control song length by specifying the duration in your prompt (e.g., "create a 2-minute song") or by using timestamps to define the structure.

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": "An epic cinematic orchestral piece about a journey home. Starts with a solo piano intro, builds through sweeping strings, and climaxes with a massive wall of sound.",
    "model": "lyria-3-pro"
  }'
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": "An epic cinematic orchestral piece about a journey home. Starts with a solo piano intro, builds through sweeping strings, and climaxes with a massive wall of sound.",
        "model": "lyria-3-pro",
    },
)
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: "An epic cinematic orchestral piece about a journey home. Starts with a solo piano intro, builds through sweeping strings, and climaxes with a massive wall of sound.",
    model: "lyria-3-pro",
  }),
});
console.log(await response.json());
body := `{
  "prompt": "An epic cinematic orchestral piece about a journey home. Starts with a solo piano intro, builds through sweeping strings, and climaxes with a massive wall of sound.",
  "model": "lyria-3-pro"
}`
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 with structure

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 1]\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,\nhold on tight, don'"'"'t let me go,\nwe are the echoes down below.\n\n[Verse 2]\nFootsteps lost on empty streets,\nrhythms sync to heartbeats,\nwhispers carried by the breeze,\ndancing through the autumn leaves.",
    "model": "lyria-3-pro"
  }'

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": "Write a full-length cinematic score that captures the mood of these images.",
    "model": "lyria-3-pro",
    "lyriaParams": {
      "reference_images": [
        "https://example.com/sunrise-over-ocean.jpg",
        "https://example.com/old-cathedral.jpg"
      ]
    }
  }'

Timestamp-based timing control

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": "[0:00 - 0:10] Intro: Begin with a soft lo-fi beat and muffled vinyl crackle.\n[0:10 - 0:30] Verse 1: Add a warm Fender Rhodes piano melody and gentle vocals singing about a rainy morning.\n[0:30 - 0:50] Chorus: Full band with upbeat drums and soaring synth leads. The lyrics are hopeful and uplifting.\n[0:50 - 1:00] Outro: Fade out with the piano melody alone.",
    "model": "lyria-3-pro"
  }'

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").
  • Duration: Specify length in your prompt (e.g., "create a 2-minute song") or use timestamps.
  • Structure: Use [Verse], [Chorus], [Bridge], [Intro], [Outro] tags.
  • Timing: Use timestamps like [0:00 - 0:30] to control exactly when instruments and vocals enter.
  • Instrumental: Include "Instrumental only, no vocals" for background music.
  • Language: Prompt in the language you want the lyrics in — the model adapts pronunciation.

Try it

POST/v2/music/generateTry it

On this page