Starting April 29, 2025, Gemini 1.5 Pro and Gemini 1.5 Flash models are not available in projects that have no prior usage of these models, including new projects. For details, see Model versions and lifecycle.
Stay organized with collections
Save and categorize content based on your preferences.
Lyria is a new foundation model for high-quality audio
generation, capable of creating diverse soundscapes and musical pieces from text
prompts. Lyria enables users to generate high-quality
instrumental music from text prompts.
To explore this model in the console, see the Lyria model card in
the Model Garden (accessible using the Media Studio tab).
curl-XPOST\-H"Authorization: Bearer $(gcloudauthprint-access-token)"\-H"Content-Type: application/json"\https://LOCATION[-aiplatform.googleapis.com/v1/projects/](https://-aiplatform.googleapis.com/v1/projects/)PROJECT_ID/locations/LOCATION/publishers/google/models/lyria-002:predict\-d'{ "instances": [ { "prompt": "string", "negative_prompt": "string", // Optional "seed": 0 // Optional. Cannot be used with sample_count. } ], "parameters": { "sample_count": 1 // Optional. Cannot be used with seed. } }'
Use the following parameters for the Lyria model. For more
information, see the Lyria Model Garden card details.
Parameter
prompt
(in instances object)
string
Required. The text description in US English (en-us) of the audio to generate.
Example: "An energetic electronic dance track with a fast tempo."
negative_prompt
(in instances object)
string
Optional. A description of what to exclude from the generated audio.
Example: "vocals, slow tempo"
seed
(in instances object)
integer
Optional. A seed for deterministic generation. If provided, the model will attempt to produce the same audio given the same prompt and other parameters.
Cannot be used with sample_count in the same request.
Example: 12345
sample_count
(in parameters object)
integer
Optional. The number of audio samples to generate. Default is 1 if not specified and seed is not used.
Cannot be used with seed in the same request.
Example: 2
Sample request
Use the following request to generate instrumental music from a text prompt:
A successful request returns a JSON object containing the generated audio data.
Each generated audio clip is 30 seconds long and provided as a WAV audio file at
a 48kHz sample rate.
{"predictions":[{"audioContent":"BASE64_ENCODED_WAV_STRING_SAMPLE_1","mimeType":"audio/wav"}// Additional audio samples will be listed here if sample_count > 1// e.g.,//{"audioContent": "BASE64_ENCODED_WAV_STRING_SAMPLE_2",// "mimeType": "audio/wav"//}],"deployedModelId":"xxxxxxxxxxxxxxx",// Actual ID may vary based on deployment"model":"projects/PROJECT_ID/locations/LOCATION/publishers/google/models/lyria-002","modelDisplayName":"Lyria 2"}
Response element
predictions
array
An array of generated audio samples. Each object in the array represents one audio clip.
predictions[].audioContent
string
Base64-encoded string of the generated WAV audio data.
predictions[].mimeType
string
The MIME type of the audio data. For Lyria, this is "audio/wav".
deployedModelId
string
The ID of the deployed model that processed the request (if applicable for the endpoint type).
model
string
The full resource name of the model that processed the request.
modelDisplayName
string
The display name of the model.
Best practices and limitations
Refer to the Lyria Model Card for detailed best practices on
prompting, language support (US English only for prompts), generation times,
output format (WAV, 48 kHz, 30s instrumental clips), safety measures, and
deployment information.
Key points:
Detailed Prompts: Generally lead to better audio.
Specify: Genre, mood, instrumentation, tempo.
Negative Prompting: Use negative_prompt to exclude
elements.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-02 UTC."],[],[],null,["# Lyria API\n\nLyria is a new foundation model for high-quality audio\ngeneration, capable of creating diverse soundscapes and musical pieces from text\nprompts. Lyria enables users to generate high-quality\ninstrumental music from text prompts.\n\nTo explore this model in the console, see the Lyria model card in\nthe Model Garden (accessible using the Media Studio tab).\n\n[Try Lyria on Vertex AI (Vertex AI Studio)](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=music)\n\n\n[Try Lyria in a Colab](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/audio/music/getting-started/lyria2_music_generation.ipynb)\n\nSupported Models\n----------------\n\nThe Lyria API supports the following model:\n\n- `lyria-002`\n\nHTTP request\n------------\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n https://\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e[-aiplatform.googleapis.com/v1/projects/](https://-aiplatform.googleapis.com/v1/projects/)\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/publishers/google/models/lyria-002:predict \\\n -d '{\n \"instances\": [\n {\n \"prompt\": \"string\",\n \"negative_prompt\": \"string\", // Optional\n \"seed\": 0 // Optional. Cannot be used with sample_count.\n }\n ],\n \"parameters\": {\n \"sample_count\": 1 // Optional. Cannot be used with seed.\n }\n }'\n\nUse the following parameters for the Lyria model. For more\ninformation, see the Lyria Model Garden card details.\n\nSample request\n--------------\n\nUse the following request to generate instrumental music from a text prompt:\n\n### Text-to-music generation request\n\n### curl\n\n```\ncurl -X POST \\\n-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n-H \"Content-Type: application/json\" \\\nhttps://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/lyria-002:predict \\\n-d '{\n \"instances\": [\n {\n \"prompt\": \"A calm acoustic folk song with a gentle guitar melody and soft strings.\",\n \"negative_prompt\": \"drums, electric guitar\",\n \"seed\": 98765\n }\n ],\n \"parameters\": {}\n}'\n```\n\n### JSON\n\nThis example uses `seed` for reproducible output. \n\n```\n\n{\n \"instances\": [\n {\n \"prompt\": \"A calm acoustic folk song with a gentle guitar melody and soft strings.\",\n \"negative_prompt\": \"drums, electric guitar\",\n \"seed\": 98765\n }\n ],\n \"parameters\": {}\n}\n\n```\n\n### JSON with sample_count\n\nThis example uses `sample_count` to generate multiple samples.\n\nTo test a text prompt using the Lyria API, send a POST request to\nthe publisher model endpoint. The following example omits `seed` from the `instances` object and uses `sample_count` in the `parameters` object to generate multiple samples. \n\n```\n\n{\n \"instances\": [\n {\n \"prompt\": \"A calm acoustic folk song with a gentle guitar melody and soft strings.\",\n \"negative_prompt\": \"drums, electric guitar\"\n }\n ],\n \"parameters\": {\n \"sample_count\": 2\n }\n}\n\n```\n\nResponse body\n-------------\n\nA successful request returns a JSON object containing the generated audio data.\nEach generated audio clip is 30 seconds long and provided as a WAV audio file at\na 48kHz sample rate. \n\n {\n \"predictions\": [\n {\n \"audioContent\": \"BASE64_ENCODED_WAV_STRING_SAMPLE_1\",\n \"mimeType\": \"audio/wav\"\n }\n // Additional audio samples will be listed here if sample_count \u003e 1\n // e.g.,\n //{\"audioContent\": \"BASE64_ENCODED_WAV_STRING_SAMPLE_2\",\n // \"mimeType\": \"audio/wav\"\n //}\n ],\n \"deployedModelId\": \"xxxxxxxxxxxxxxx\", // Actual ID may vary based on deployment\n \"model\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/publishers/google/models/lyria-002\",\n \"modelDisplayName\": \"Lyria 2\"\n }\n\nBest practices and limitations\n------------------------------\n\nRefer to the Lyria Model Card for detailed best practices on\nprompting, language support (US English only for prompts), generation times,\noutput format (WAV, 48 kHz, 30s instrumental clips), safety measures, and\ndeployment information.\n\nKey points:\n\n- **Detailed Prompts:** Generally lead to better audio.\n- **Specify:** Genre, mood, instrumentation, tempo.\n- **Negative Prompting:** Use `negative_prompt` to exclude elements.\n- **Output:** 30-second WAV audio clips, 48 kHz, instrumental only.\n- **Safety:** Content safety filters, recitation checking, artist intent checks, and SynthID watermarking are applied.\n\nPricing\n-------\n\nLyria 2 usage is priced at $0.06 per 30 seconds of output music generated. For\nmore details, see [Vertex AI Pricing](https://cloud.google.com/vertex-ai/pricing).\n\nMore information\n----------------\n\n- Learn more about [Generative AI on Vertex AI](https://cloud.google.com/vertex-ai/docs/generative-ai/).\n- For an overview of Lyria, refer to its model card available in the Model Garden (Media Studio).\n\nWhat's next\n-----------\n\n- Try out Lyria in the [Vertex AI Studio](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=music).\n- Review the [Google Cloud Service Terms](https://cloud.google.com/terms).\n- Read the [Additional Terms for Generative AI Products](https://cloud.google.com/terms/generative-ai)."]]