Gemini Music Generation (Lyria)
Text-to-music inside ComfyUI, if you can stand the API tax
- audio
Music generation is where the local-vs-API gap is still enormous. The open side of ComfyUI has ACE-Step as its answer to Suno, and it's fine - but Lyria, Google's music model, is a genuinely different class of thing, and this node puts it directly in the graph. Type "lofi hip-hop, warm tape hiss, 90 BPM, Rhodes piano" and get back an actual audio tensor you can preview, save, or sync to video. No model weights, no VRAM, no local install - just the API.
You'll reach for it when the music matters and your local setup can't produce it: a backing track for a video render, an original score snippet for a project, mood-setting audio to pair with a Veo clip or a local img2vid. The two Lyria models are lyria-3-clip-preview (shorter clips, faster) and lyria-3-pro-preview (higher quality). Both are preview IDs, which should tell you something about how fast this space moves.
How it works
Unlike most of the pack, this node doesn't go through the Gemini SDK client for the actual generation. Lyria uses a different endpoint - models/{model}:predict on the raw generativelanguage API - so the node builds the request by hand: your prompt goes into instances, the negative prompt, seed, and sample count into parameters, and the key travels as the x-goog-api-key header (deliberately not in the URL, the code comments note, so it doesn't leak into error logs). The response comes back as base64 audio, which is decoded, run through soundfile into a float waveform, and returned as a standard ComfyUI AUDIO dict.
Inputs and outputs that matter
prompt- the whole game. Genre, mood, instruments, tempo. Lyria responds well to specific musical language.model-lyria-3-clip-previeworlyria-3-pro-preview. Clip is the default and the cheaper iteration loop.negative_prompt- things to steer away from ("no vocals", "no drums").sample_count- 1 to 4 candidate clips per call. Fire four variants in one request instead of four requests.seed- 0 means random; set it for reproducibility.
The single output is audio (AUDIO). Wire it into any audio-saving or preview node in ComfyUI - the pack's own Kling Raw File Saver can grab it as a file, or use the standard audio save nodes.
How to install it
Pack-level install from ComfyUI-API-Toolkit:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt
or "API Toolkit" in ComfyUI Manager. The Gemini service needs google-genai>=0.8.0 plus soundfile and scipy (they're in the requirements file). Need a Gemini API key.
Common issues
The predictable pain points: Lyria previews come and go. If you get a 404 on a model ID, Google has rotated it - check the pack's Gemini List Available Models node for the current ID and use custom_model to override. And watch for the "returned no audio" error, which usually means the prompt got flagged or the request was malformed.
Bigger-picture, this is a paid per-call model, and the pack re-runs every API node on each queue - so every accidental Queue is another music generation bill. It's also a closed Google product, so the content filter applies to your lyrics and themes. And fair warning: "sample_count 4" is four generations of cost in one call. Budget it like the video nodes, not like a local sampler.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| model | COMBO | lyria-3-clip-preview | 2 options: lyria-3-pro-preview, lyria-3-clip-preview |
| prompt | STRING | Describe the music (genre, mood, instruments, tempo). | |
| custom_modelopt | STRING | — | |
| negative_promptopt | STRING | — | |
| seedopt | INT | 00–2147483647 | — |
| sample_countopt | INT | 11–4 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |