Dev.to AI 🤖 Ai 👁 0 📖 8 min read

How to Generate AI Music with Lyria 3 Pro via the Flow Music API

Introduction Lyria 3 Pro is Google DeepMind's text-to-music model, and the useapi.net Flow Music API runs it over plain REST on your Flow Music website subscription. Lyria 3 Pro powers Flow Music, Google Labs' generato

Introduction

Lyria 3 Pro is Google DeepMind's text-to-music model, and the useapi.net Flow Music API runs it over plain REST on your Flow Music website subscription. Lyria 3 Pro powers Flow Music, Google Labs' generator (formerly Producer AI, originally Riffusion). One prompt returns a complete, produced song — vocals, melody, and arrangement — and from there you can supply your own lyrics, force an instrumental, or edit a clip with cover, remix, extend, replace, effects, and stem-splitting.

Capabilities and parameters

Songs default to Lyria 3 Pro, and model: "lyria-3.5" selects the newer Lyria 3.5. Each call returns up to two clips (an A/B pair), each up to roughly three minutes long. The main fields on the music endpoint:

Parameter Type What it does
prompt string (required) Song description — style, mood, genre, instruments, BPM, vocal direction. 1–10,000 chars.
instrumental boolean true forces an instrumental (prepends an [Instrumental] tag). false (default) lets the model decide whether to sing.
lyrics string Your own [Verse]/[Chorus]-tagged lyrics (≤10,000 chars) — forces a vocal render of those exact words.
model lyria-3-pro \ lyria-3.5
ghostwriter standard \ pro
mode sync \ async
email string Which connected account to use. Omit it and the API load-balances across accounts with free capacity.

If you omit both instrumental and lyrics, the model decides whether to sing from your prompt alone. The endpoint also accepts replyUrl/replyRef webhooks and experimental refImage/refAudio reference hints — see the music endpoint docs for the full body.

Generation is only the first step — the music/edit endpoint reworks any existing clip with six operations:

Operation What it does
cover Restyle the whole song (a Lyria 3 Pro cover)
remix Re-sing with edited lyrics
extend Add 1–300 s of new music (default 150 s), at the end or from a chosen point
replace Regenerate a specific time section
effect Apply Trim, Fade, Gain, Reverb, Pan, or Equalizer
stems Split into four stems — drums, bass, vocals, other

The editing section below shows the request shapes for each.

Pricing

Your Flow Music website subscription pays for every song, with no per-song surcharge from useapi.net. A song costs 5 credits, which comes to about 1.3¢ on Flow Music Starter ($8 a month for 3,000 credits) and 1.1¢ on Member ($64 for 30,000), against 8¢ a song for Lyria 3 Pro on Google's Gemini API (as of October 2026). A Google AI subscription includes a Flow Music plan with its own credits, separate from the Google AI credits: Starter on Google AI Plus, Plus on Google AI Pro and Member on Google AI Ultra. Cover, remix, extend, replace, effects and stem-splitting run on the same credits, the Free plan generates a little each day from daily top-up credits, and downloads (mp3, wav, m4a, stems) cost nothing. The Flow Music API overview has the full cost calculator, and Setup Flow Music connects an account.

Generate a song in two API calls

You need a useapi.net API token and a connected Flow Music account — export the token so the curl examples below run as-is: export USEAPI_TOKEN="user:1234-...". The fastest reliable workflow is asynchronous: the create call returns a jobid immediately, then you poll until the song is ready.

First, submit the job with POST https://api.useapi.net/v1/flowmusic/music:

curl -X POST "https://api.useapi.net/v1/flowmusic/music" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "warm indie folk ballad, acoustic guitar, soft female vocals, 70 bpm, wistful and hopeful",
    "ghostwriter": "pro",
    "mode": "async"
  }'

In async mode the response returns immediately with 201 Created, a jobid, and status: "pending":

{
  "jobid": "job:aaaabbbb-cccc-4ddd-8eee-ffff99990000-user:[email protected]:flowmusic",
  "email": "[email protected]",
  "status": "pending",
  "created_at": "2026-06-01T18:40:42.412Z",
  "request": { "prompt": "warm indie folk ballad...", "mode": "async" }
}

Then poll for the result with GET https://api.useapi.net/v1/flowmusic/jobs/{jobid} (the jobid is URL-encoded in the path — it contains : and @):

curl "https://api.useapi.net/v1/flowmusic/jobs/JOBID" \
  -H "Authorization: Bearer $USEAPI_TOKEN"

When status is completed, the finished audio lives in the clips[] array — audio_url is the signed .m4a, and wav_url is the WAV file:

{
  "jobid": "job:aaaabbbb-...-bot:flowmusic",
  "status": "completed",
  "duration_ms": 132711,
  "clips": [
    {
      "clip": "user:[email protected]:a1b2c3d4-...",
      "title": "Morning Sun",
      "duration_s": 173.04,
      "lyrics": "[Verse 1]\nCity lights blur in the rain\n[Chorus]\nAnd I will wait for the morning sun",
      "audio_url": "https://storage.googleapis.com/...a1b2c3d4.m4a",
      "wav_url": "https://storage.googleapis.com/...a1b2c3d4.wav",
      "image_url": "https://storage.googleapis.com/...b2c3d4e5.jpg"
    }
  ]
}

Lyria 3 Pro typically finishes in 40–150 seconds. Result URLs are signed, so download promptly. Prefer not to poll? mode: "sync" (the default) waits for the song and returns the same completed record inline with 200 OK (a song still unfinished after 7 minutes answers 202 with its jobid to poll). The song keeps rendering if your connection drops, but on mobile, flaky networks or short-timeout platforms prefer async, so you always have the jobid. You can also pass a replyUrl to receive a webhook when the job completes. A job can come back status: "failed" (e.g. a content-moderation refusal), and the create call may return 402 (insufficient credits), 422 (prompt moderated / no audio), or 429 (all accounts busy) — see the endpoint docs for the full list.

Custom lyrics, instrumentals, and editing a song

You control the voicing entirely from the request body. Set instrumental: true for a purely instrumental track, or paste tagged lyrics to force a sung render of your exact words:

# Instrumental only
curl -X POST "https://api.useapi.net/v1/flowmusic/music" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "prompt": "energetic synthwave, driving bass, retro 80s, 120 bpm", "instrumental": true }'

# Your own lyrics → forces a vocal render of those words
curl -X POST "https://api.useapi.net/v1/flowmusic/music" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "soulful R&B, lush keys, 90 bpm",
    "lyrics": "[Verse 1]\nCity lights blur in the rain\n[Chorus]\nAnd I will wait for the morning sun"
  }'

Once you have a clip's id, the music/edit endpoint runs any of the six operations from the table above. For example, to extend a song by 30 seconds:

curl -X POST "https://api.useapi.net/v1/flowmusic/music/edit" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "extend",
    "clip": "CLIP_ID_FROM_A_PREVIOUS_GENERATION",
    "instruction": "add an instrumental outro",
    "extend_s": 30
  }'

See the editing docs for each operation's parameters.

Batch-generate with a script

Finding the right track takes many attempts, and running them by hand is tedious. The Node.js script reads a list of prompts from prompts.json, submits each one to the music endpoint in async mode, polls every job until it is done, then downloads all the resulting .m4a clips — so you can queue a batch and come back to a folder of finished songs.

You need Node.js v21 or newer. Put prompts.json and flowmusic.mjs in the same folder and run node ./flowmusic.mjs API_TOKEN EMAIL, where API_TOKEN is your useapi.net API token and EMAIL is the configured Flow Music account email you want to use. Each entry's prompt is required, and the optional instrumental, lyrics, and ghostwriter fields map straight to the music endpoint.

[
    {
        "prompt": "lo-fi hip hop, mellow piano, 80 bpm. By default the model decides whether to sing based on your prompt."
    },
    {
        "prompt": "warm indie folk ballad, acoustic guitar, soft female vocals, 70 bpm, wistful and hopeful",
        "ghostwriter": "pro"
    },
    {
        "prompt": "energetic synthwave, driving bass, retro 80s, 120 bpm",
        "instrumental": true
    },
    {
        "prompt": "soulful R&B, lush keys, 90 bpm. Provide your own [Verse]/[Chorus]-tagged lyrics to force a vocal render of those exact words. For all parameters see https://useapi.net/docs/api-flowmusic-v1/post-flowmusic-music",
        "lyrics": "[Verse 1]\nCity lights blur in the rain\n[Chorus]\nAnd I will wait for the morning sun"
    }
]

Examples

These are real songs generated with Lyria 3 Pro through the Flow Music API — each from a single text prompt, exactly as the workflow above produces them. Full prompts and curl for each are in the FlowMusic API v1 launch post.

“Euphoric Currents”, an instrumental liquid drum & bass track (instrumental: true), from FlowMusic API v1: Powered by Lyria 3 Pro:

Listen on useapi.net

“Solid Ground”, an emotional pop ballad with a soaring female vocal (model-written lyrics), from FlowMusic API v1: Powered by Lyria 3 Pro:

Listen on useapi.net

“Running on Empty”, an epic power ballad rendered from custom [Verse]/[Chorus] lyrics, from FlowMusic API v1: Powered by Lyria 3 Pro:

Listen on useapi.net

For more samples — including extend, cover, remix, studio effects, and AI-generated cover art — see the full launch post.

Related tutorials: five AI music APIs on the same six briefs, AI music with the Mureka API and AI music APIs compared.

Frequently asked questions

Is there a Lyria 3 Pro API? Through useapi.net, yes: the Flow Music API runs Lyria 3 Pro, and the newer Lyria 3.5, on your Flow Music website subscription through a standard REST endpoint, with cover, remix, extend, replace, effects and stem-splitting on top of plain generation. Google offers no public Flow Music API of its own (as of October 2026). You connect the account once at Setup Flow Music.

How much does it cost? Through useapi.net, a Lyria song costs about 0.8¢ on Flow Music Member billed yearly ($48 a month for 30,000 credits, about 6,000 songs), against 8¢ a song on Google's Gemini API (as of October 2026). You pay nothing per song on top of the Flow Music subscription, and Google AI Plus, Pro and Ultra include the Starter, Plus and Member plans. See Pricing for the monthly plans.

Is this a Suno or Udio alternative? Through useapi.net, yes. Like Suno and Udio, the Flow Music API generates full songs with vocals from a single text prompt, but it runs on Google DeepMind's Lyria models and adds cover, remix, extend and stem-splitting over REST. It also sings your own [Verse]/[Chorus] lyrics word for word, or makes an instrumental when you set instrumental: true.

Do I need a Google Cloud project or API key? Through useapi.net, no. You call the API with a useapi.net API token and connect the Google account you use at flowmusic.app once during setup. Google's own Lyria API runs through the Gemini API instead, which needs a Google Cloud project and an API key. Each useapi.net subscription connects 3 Flow Music accounts, up to 100 in total.

Can I cover, extend, or split a song into stems? Through useapi.net, yes. The music/edit endpoint takes any generated clip and runs cover, remix, extend (up to 300 seconds), replace, effect, or stems, which splits it into drums, bass, vocals and other. Each edit spends credits from the same Flow Music subscription. See Custom lyrics, instrumentals, and editing above.

Conclusion

Visit our Discord Server or Telegram Channel for any support questions and concerns.

The full runnable example is in the flowmusic-api GitHub repo.

The same calls are available as tools on the hosted Flow Music MCP server for Claude Code, Cursor and VS Code.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.