What is Lyria 2 API?
Lyria 2 is Google's advanced music generation model capable of creating high-quality, diverse musical compositions from text.
Technical Specifications
- Supported inputs: Audio, Text
- Output: Audio
Performance Benchmarks
[embed]
Lyria 2 API Pricing
- Pricing on request
Where to Use Lyria 2
Audio generation
Create speech, sound effects, or music from prompts.
Soundtrack generation for short-form video is documented as a use case for Lyria 2, with the model used to create music for brief video content.
Music AI Sandbox experiments for composers is another documented use case, with Lyria 2 described as powering Music AI Sandbox features for creative exploration.
Royalty-tracked Dream Track covers in YouTube Shorts are also listed, indicating Lyria 2 is used for creating music experiences inside YouTube Shorts.
Prototyping film, game, and ad scores is documented as a use case, with Lyria 2 presented as suitable for score prototyping across those media contexts.
import requests, time headers = {"Authorization": "Bearer " + AIMLAPI_KEY} job = requests.post( "https://api.aimlapi.com/v2/generate/audio", headers=headers, json={ "model": "google/lyria2", "prompt": "Upbeat lofi background music" }, ).json() gid = job["generation_id"] while True: res = requests.get(f"https://api.aimlapi.com/v2/generate/audio?generation_id={gid}", headers=headers).json() if res.get("status") in ("completed", "error", "failed"): break time.sleep(3) print(res)
const headers = { Authorization: `Bearer ${process.env.AIMLAPI_KEY}`, "Content-Type": "application/json", }; const job = await (await fetch("https://api.aimlapi.com/v2/generate/audio", { method: "POST", headers, body: JSON.stringify({ "model": "google/lyria2", "prompt": "Upbeat lofi background music" }), })).json(); let res; do { await new Promise((r) => setTimeout(r, 3000)); res = await (await fetch(`https://api.aimlapi.com/v2/generate/audio?generation_id=${job.generation_id}`, { headers })).json(); } while (!["completed", "error", "failed"].includes(res.status)); console.log(res);
# submit the job — the response contains "generation_id" curl -X POST https://api.aimlapi.com/v2/generate/audio \ -H "Authorization: Bearer $AIMLAPI_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"google/lyria2","prompt":"Upbeat lofi background music"}' # then poll for the result until it is ready curl "https://api.aimlapi.com/v2/generate/audio?generation_id={generation_id}" -H "Authorization: Bearer $AIMLAPI_KEY"
OpenAI-compatible — swap the base URL and it works with your existing SDK.
| Type | Price |
|---|---|
| Output | |
| Model | Input | Output | Context | Best for |
|---|---|---|---|---|
Lyria 2 This page | Audio generation | |||
| Speech synthesis | ||||
| Speech synthesis | ||||
| Speech synthesis | ||||
| Speech synthesis |
Lyria 2 takes audio, text as input and returns audio.
Lyria 2 is priced at $0.013 / gen.
Lyria 2 is billed per generation — a fixed charge per output rather than by prompt length.
Lyria 2 was built by Google.
Use google/lyria2 as the model id on AI/ML API.
Yes. Lyria 2 is served through AI/ML API, so the same key and endpoint format used for other models applies.