Skip to main content

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-xxxxxxxxxxxxxxxx
string
Alternatively, use X-API-Key: sk-xxxxxxxxxxxxxxxx

Submit a generation request

POST /v1beta/interactions Depending on the background field, requests run in either synchronous or asynchronous mode.

Synchronous generation (default)

When background 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.
Successful response:
output_audio.data is Base64-encoded audio. mime_type is usually audio/mpeg.

Asynchronous generation

With background: true, Gravitex creates a local async task and returns the task ID immediately. Then poll the query task result endpoint.
Submission response:
The returned 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-preview
string
required
Music description, arrangement requirements, or lyrics. Google style uses a plain string
boolean
true uses the Gravitex local async task; synchronous by default
boolean
Compatible with Google Interactions requests. true is recommended for async requests
object
Audio response format configuration, pass {"type": "audio"}; subject to the current channel model configuration
string
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
Example:

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:
Do not retry the exact same prompt indefinitely. Modify the prompt and avoid artist voices, copyrighted lyrics, or restricted content.

Audio handling example

Notes

  1. lyria-3-pro-preview outputs music audio, not text chat results.
  2. Do not force generic text model parameters such as top_p or temperature into Lyria requests. Available parameters follow the channel configuration and official model docs.
  3. Async requests must poll with the returned Gravitex task_xxx ID.
  4. Generated audio contains Googleโ€™s audio watermarking mechanism; see official model policies for details.