Nodes/ComfyUI-YCYY-API/Gemini TTS Multi API
ComfyUI Node

Gemini TTS Multi API

Two voices at once — multi-speaker TTS in a single generation

By ycyy·Created 11 months ago·Updated 3 days ago· 11
Gemini TTS Multi API
  • speaker_options
  • config_options
  • proxy_options
  • AUDIO
  • STRING
text## THE SCENE 设置场景的背景信息,包括地点、氛围和环境细节,以确定基调和氛围。 ## DIRECTOR'S NOTES 导演备注,仅定义对性能至关重要的内容,并注意不要过度指定。最常见的指令是风格、语速和口音,但模型不限于这些指令,也不要求使用这些指令。您可以随意添加自定义说明 ## TRANSCRIPT 转写内容和音频标记,转写内容是模型将要朗读的确切字词。音频标记是指方括号中的字词,用于指示说话方式、音调变化或插话。多说话人名称需要与配置对应,示例如下: Speaker 1: I know right, I couldn't believe it. [whispers] She should have totally left at that point. Speaker 2: [cough] Well, [sighs] I guess it doesn't matter now.
modelgemini-2.5-flash-preview-tts
seed0

This is the party trick. The plain Gemini TTS node gives you one voice per call; this one renders a whole conversation in a single generation, with a different voice for every speaker. Podcast banter, audiobook dialogue, two characters bickering - you write the script with speaker labels, assign each speaker a voice, and the model produces one continuous audio file with the cast already separated. No splicing clips together, no crossfade hacks.

How it works

Same REST engine as its single-voice sibling, one crucial difference in the payload. Instead of a single prebuiltVoiceConfig, the node builds a multiSpeakerVoiceConfig with a speakerVoiceConfigs array - one entry per speaker, each mapping a speaker name to a voice. Your script uses those names as labels ("Speaker 1: …", "Speaker 2: …"), and the model renders each labelled line in the assigned voice. The response is raw PCM audio, decoded back into a standard ComfyUI AUDIO dict.

What you feed it

The inputs that do the work:

  • text - the script. The default is a Chinese-language template with three sections: scene background, director's notes (style, pace, accent guidance), and the transcript - the exact lines with speaker labels. You can keep that structure and swap the transcript for your own dialogue. The names in the transcript must match your configured speaker names exactly.
  • speaker_options - a list of {speaker, voiceName} entries. This comes from the pack's own helper nodes, not typed by hand: Gemini Speaker Options builds one speaker, Gemini Batch Speakers Options merges two arrays. So a two-speaker setup is Speaker Options → Batch Speakers → this node.
  • model - the same combo as the single TTS node, default gemini-2.5-flash-preview-tts.

Outputs are AUDIO (the full dialogue) and STRING (token usage or the error JSON). There's a seed input that, like elsewhere in this pack, is accepted but not sent to the API - don't lean on it for reproducibility.

Setting up two voices

  • One Gemini Speaker Options node per speaker: set speaker to the exact label used in the transcript (e.g. Speaker 1) and pick a voiceName (Zephyr, Puck, Charon…).
  • Run both into Gemini Batch Speakers Options, then into this node's speaker_options.
  • Keep transcript labels and speaker names in lockstep - a mismatch is the most common way this 400s.

Installing and the usual caveats

Same pack as everything above:

cd ComfyUI/custom_nodes
git clone https://github.com/ycyy/ComfyUI-YCYY-API

Copy config.json.example to config.json and add your key to the gemini-tts section. No models, no GPU, no extra deps - restart and look under YCYY/API.

The gotchas are inherited from single-voice TTS, plus one new one: duplicate speaker names are rejected, so every label must be unique, and every transcript label must have a matching speaker entry. The node also validates that speaker_options is a non-empty list - forget to wire the options in and you'll get an error before a single byte of audio comes back.

As always with this pack, failures don't throw - they return (None, error_json) out of the two outputs. Check the STRING, not the AUDIO. Multi-speaker mode is also a newer API surface than plain TTS, so if you start seeing 400s after a Google update, that's usually the model name churning in config rather than a problem with your script.

CategoryYCYY/API/audio

Inputs (6)

NameTypeDefaultDescription
textSTRING## THE SCENE 设置场景的背景信息,包括地点、氛围和环境细节,以确定基调和氛围。 ## DIRECTOR'S NOTES 导演备注,仅定义对性能至关重要的内容,并注意不要过度指定。最常见的指令是风格、语速和口音,但模型不限于这些指令,也不要求使用这些指令。您可以随意添加自定义说明 ## TRANSCRIPT 转写内容和音频标记,转写内容是模型将要朗读的确切字词。音频标记是指方括号中的字词,用于指示说话方式、音调变化或插话。多说话人名称需要与配置对应,示例如下: Speaker 1: I know right, I couldn't believe it. [whispers] She should have totally left at that point. Speaker 2: [cough] Well, [sighs] I guess it doesn't matter now.Conversation text. Include speaker labels that match the configured speaker names.
speaker_options*Speaker option array from Gemini Speaker Options or Gemini Batch Speakers Options
modelCOMBOgemini-2.5-flash-preview-tts1 options: gemini-2.5-flash-preview-tts
seedINT00–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)

NameTypeDescription
AUDIOAUDIO
STRINGSTRING