Gemini TTS API
Gemini TTS in a node — direct your voice in plain English
- config_options
- proxy_options
- AUDIO
- STRING
Text-to-speech is usually a wall of sliders and a handful of voices that all sound like they're reading the news. Gemini's TTS does something else: you write the line you want spoken, and you direct the delivery in the same text box. "Say in a spooky whisper: By the pricking of my thumbs…" - that's literally the tooltip's own example, and it works. This node puts that engine inside ComfyUI as a cloud call. If you're building narration, voiceovers, or a read-aloud pass over your own scripts, it's the easiest way to get genuinely expressive speech without running anything locally.
How it works
The node sends your text to {base_url}/{model}:generateContent with responseModalities: ["AUDIO"] and a speechConfig that names the prebuilt voice. The response comes back as raw PCM audio (audio/L16;codec=pcm;rate=24000), which the node decodes into ComfyUI's standard audio dict - a waveform tensor plus sample rate. On the other side you get a real AUDIO output that plugs straight into Save Audio, Preview Audio, or the video tools.
The style control isn't a separate parameter. It lives in the text: the model parses natural-language direction out of what you write, so tone, accent, and pace become part of the script rather than a settings panel.
Inputs and outputs
The useful set:
- text - multiline. The line to speak, with any delivery direction written inline. This is the whole ballgame for this node.
- voiceName - a combo of 30 prebuilt voices (Zephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede…), defaulting to Zephyr. They're Google's standard Gemini TTS voices, named after moons and satellites, and they're cheap to sample - try a few before committing.
- model - combo from the
gemini-ttssection of config.json, defaultgemini-2.5-flash-preview-tts. The example config also listsgemini-2.5-pro-preview-ttsand a couple of newer models.
Outputs: AUDIO (the spoken result, ready to wire anywhere audio flows) and STRING (the now-familiar JSON status blob with token usage or the error reason). There's also a seed input, and the same caveat as the image node applies: it's accepted in the UI but never sent to the API, so it won't reproduce results.
Installing it
It's one of several nodes in the same pack, so you install once and use them all:
cd ComfyUI/custom_nodes
git clone https://github.com/ycyy/ComfyUI-YCYY-API
(Or search "ComfyUI-YCYY-API" in ComfyUI Manager.) Then copy config.json.example to config.json and put your Google API key in the gemini-tts section. No models, no GPU, no extra dependencies - restart and look under YCYY/API.
Where it bites
- It's a preview model. "gemini-2.5-flash-preview-tts" is not a stable, permanent name. When Google churns the lineup, the config's
modelslist is where you add the replacement - that's the first thing to check on a sudden 404. - Watch the STRING output. Failures return an empty/None audio plus a JSON error in the second output, not an exception.
- You pay per character. TTS is metered, and a long narration adds up fast. People do use Gemini TTS for real narration projects (versus the pricier ElevenLabs), but chunk long scripts and keep an eye on the bill. Free-tier keys also 429 quickly.
- Raw PCM, brittle-ish. The node hand-decodes
audio/L16. If Google changes the response mime type, this breaks until the pack updates - another reason to keep it current.
One practical tip: since this outputs the same AUDIO format the pack's STT node consumes, you can chain TTS → STT to verify a voiceover round-trips cleanly, all inside one graph.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | The text to convert to speech.You can control style, tone, accent, and pace using natural language prompts.For example:Say in an spooky whisper:"By the pricking of my thumbs...Something wicked this way comes" | |
| model | COMBO | gemini-2.5-flash-preview-tts | 1 options: gemini-2.5-flash-preview-tts |
| voiceName | COMBO | Zephyr | The voice to use for speech synthesis |
| seed | INT | 00–18446744073709550000 | — |
| config_optionsopt | * | Optional configuration override from YCYY Gemini TTS Config Options | |
| proxy_optionsopt | * | Optional proxy configuration override from YCYY Proxy Config Options |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| AUDIO | AUDIO | — |
| STRING | STRING | — |