Skip to main content
google avatar

Lyria 2 API

google/lyria2

Generate ~30 seconds of high-fidelity instrumental music from a text prompt, as a 48kHz WAV file.

0.1

Model Input

Input

The text prompt describing the music you want to generate. Name the genre, mood, key instruments, and tempo for the closest result.

A description of what to exclude from the generated audio (e.g. 'vocals, distortion').

Additional Settings

Customize your input with more control.

A seed for deterministic generation. Leave empty for a random result.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Loading
Generated in 37.923 seconds
Logs (1 lines)

Model Example Requests

Examples

Lyria 2 API

Lyria 2 is a music AI model by google. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at $0.1 per audio clip.

POST https://queue.modelrunner.run/google/lyria2

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/google/lyria2 \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "seed": null,
    "prompt": "Cinematic orchestral trailer cue — soaring strings, bold brass stabs, deep timpani hits, building to a triumphant climax",
    "negative_prompt": "low quality",
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/google/lyria2/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/google/lyria2/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("google/lyria2", {
  input: {
    "seed": null,
    "prompt": "Cinematic orchestral trailer cue — soaring strings, bold brass stabs, deep timpani hits, building to a triumphant climax",
    "negative_prompt": "low quality"
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/google/lyria2",
    headers=headers,
    json={
      "seed": null,
      "prompt": "Cinematic orchestral trailer cue — soaring strings, bold brass stabs, deep timpani hits, building to a triumphant climax",
      "negative_prompt": "low quality"
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
promptstringyesThe text prompt describing the music you want to generate. Name the genre, mood, key instruments, and tempo for the closest result.
negative_promptstringnoA description of what to exclude from the generated audio (e.g. 'vocals, distortion'). Default: "low quality".
seedintegernoA seed for deterministic generation. Leave empty for a random result. Default: null.

Machine-readable: OpenAPI schema · llms.txt

Use Lyria 2 from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Lyria 2 becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint google/lyria2.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run google/lyria2 on ModelRunner to generate music”. MCP setup guide.

Model Details

Model Details

Lyria 2 is Google DeepMind's music generation model. Describe the music you want in a single text `prompt` — genre, mood, instrumentation, tempo — and it returns roughly 30 seconds of high-fidelity instrumental audio as a 48kHz WAV file. It is built for fast, prompt-driven scoring and ideation: the better you describe the style and the parts you want to hear, the closer the result lands.

## Best for - Short instrumental beds and soundtracks for video, ads, games, and presentations - Quickly auditioning a musical idea or style from a plain-language description - Background music in a specific genre or mood (e.g. "upbeat lo-fi hip hop with mellow keys", "tense cinematic strings") - Royalty-light placeholder tracks while prototyping

## Choose another model when - You need a full-length song or control over the exact duration — use a music model with a duration input - You need sung vocals or lyrics — Lyria 2 produces instrumental music only - You want speech or narration from text — use a text-to-speech model - You want sound effects or foley rather than music — use a sound-effects model

## Tips - Write the prompt like a music brief: name the genre, mood, key instruments, and tempo ("slow ambient pad with soft piano, 70 bpm, reflective") - Use `negative_prompt` to steer away from unwanted traits (e.g. "vocals, distortion, low quality"); it defaults to "low quality" - Set `seed` to an integer to reproduce a result you liked, or leave it unset for a fresh take each run

## Limitations - Output length is fixed at roughly 30 seconds; there is no duration control - Instrumental only — it will not generate vocals or lyrics

To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("google/lyria2", { input: { prompt: "Upbeat jazz piano trio with walking bass and light brushed drums", negative_prompt: "vocals, low quality", }, }); ```