tools.lyria_music module

Generate high-quality music using Google Lyria 3 via the Gemini API.

Supports both the Clip model (30-second clips) and the Pro model (full-length songs with verses, choruses, and bridges). Features: - Text-to-music generation with full prompt engineering support - Multimodal generation from up to 10 reference images (Pro) - Custom lyrics with structural tags ([Verse], [Chorus], [Bridge], …) - Timestamp-based structure control for precise arrangements - WAV or MP3 output (WAV available on Pro model only) - Generated lyrics/song structure returned alongside the audio file

async tools.lyria_music.run(prompt, model='lyria-3-clip-preview', output_format='mp3', image_urls=None, ctx=None)[source]

Generate music with Google Lyria 3 and send the audio to the channel.

Parameters:
  • prompt (str) – Music description / lyrics / structure for the model.

  • model (str) – ‘lyria-3-clip-preview’ (30 s) or ‘lyria-3-pro-preview’ (full song).

  • output_format (str) – ‘mp3’ (default) or ‘wav’ (Pro only).

  • image_urls (list[str] | None) – Optional list of image URLs for image-to-music generation.

  • ctx (ToolContext | None) – Tool execution context providing platform adapter and Redis.

Returns:

JSON result with success status, filename, lyrics, and file URL.

Return type:

str