Introduction
lyria-3-pro-preview generates complete music, suitable for fuller song structures such as verses, choruses, and bridges. The output is audio.
Gravitex exposes Google Interactions-style endpoints:
Official reference:
Authentication
string
required
Bearer Token, e.g.
Bearer sk-xxxxxxxxxxxxxxxxstring
Alternatively, use
X-API-Key: sk-xxxxxxxxxxxxxxxxSubmit a generation request
POST/v1beta/interactions
Depending on the background field, requests run in either synchronous or asynchronous mode.
Synchronous generation (default)
Whenbackground is omitted, or explicitly set to background: false, the gateway waits for the upstream generation to finish and returns the result directly. No async task record is created.
output_audio.data is Base64-encoded audio. mime_type is usually audio/mpeg.
Asynchronous generation
Withbackground: true, Gravitex creates a local async task and returns the task ID immediately. Then poll the query task result endpoint.
task_xxx ID is used for subsequent queries.
Query task result
GET/v1beta/interactions/{interaction_id}
The async task is handled by the Gravitex worker, which calls the upstream service. Once generation finishes, tasks, logs, and billing are updated. Clients only need to poll this endpoint for the final result.
Request example
In progress (in_progress)
Completed (completed)
Failed (failed)
A polling interval of 2โ5 seconds is recommended. Stop polling on
completed, failed, or cancelled.Parameters
string
required
Fixed to
lyria-3-pro-previewstring
required
Music description, arrangement requirements, or lyrics. Google style uses a plain string
boolean
true uses the Gravitex local async task; synchronous by defaultboolean
Compatible with Google Interactions requests.
true is recommended for async requestsobject
Audio response format configuration, pass
{"type": "audio"}; subject to the current channel model configurationstring
Interaction ID for multi-turn linking; single-turn generation is recommended for Lyria 3
Prompting tips
Consider including the following in your prompt:- Genre: country, pop, jazz, cinematic, etc.
- Instruments: acoustic guitar, piano, drums, etc.
- Mood: warm, dreamy, energetic, etc.
- Tempo and key: e.g.
90 BPM,G major - Whether vocals or lyrics are needed
- Song structure:
[Intro],[Verse],[Chorus],[Bridge] - Duration: the Pro model accepts target duration descriptions in the prompt
Status codes and errors
Content safety block
The following error means the prompt was blocked by Googleโs safety filter โ it is not a JSON parameter error:Audio handling example
Notes
lyria-3-pro-previewoutputs music audio, not text chat results.- Do not force generic text model parameters such as
top_portemperatureinto Lyria requests. Available parameters follow the channel configuration and official model docs. - Async requests must poll with the returned Gravitex
task_xxxID. - Generated audio contains Googleโs audio watermarking mechanism; see official model policies for details.
