Nodes/ComfyUI-YCYY-API/Gemini STT API
ComfyUI Node

Gemini STT API

Transcribe audio inside ComfyUI without installing Whisper

By ycyy·Created 11 months ago·Updated 3 days ago· 11
Gemini STT API
  • audio
  • config_options
  • proxy_options
  • STRING
  • STRING
prompt
modelgemini-2.5-flash

Sometimes you just need the words. This node turns any audio in your ComfyUI graph into text via Google's Gemini API - no local Whisper model, no VRAM, no tokenizer dance. If you're building narration pipelines, generating subtitle text from a clip, or feeding TTS output back around for quality checks, it's the fastest path from AUDIO to a plain string.

How it works

It's a cloud call wearing a ComfyUI costume. The node takes the AUDIO input (a dict with a waveform tensor and sample rate), converts it to an int16 PCM WAV file in memory, base64-encodes it, and POSTs it to {base_url}/{model}:generateContent alongside your prompt. Gemini's ordinary multimodal chat model does the transcribing - there's no separate speech-recognition endpoint involved.

That's worth internalizing, because it means this isn't a dedicated STT engine. The default gemini-2.5-flash handles plain speech-to-text fine, but how the output comes back - punctuation, capitalization, JSON formatting, timestamps - depends heavily on what you ask for in the prompt.

Inputs and outputs

Only a few inputs really matter:

  • audio - the AUDIO you're transcribing. Comes from Load Audio, or anything else that emits ComfyUI audio, including the pack's own TTS nodes. That makes a neat round-trip: generate speech, then transcribe it back to check it survived.
  • prompt - optional guidance. Leave it empty and the code silently substitutes "Please transcribe the audio." This is where you get useful behavior, though: ask for timestamps, speaker labels, a JSON structure, or "transcribe with proper punctuation."
  • model - combo from the gemini-stt section of config.json. Defaults to gemini-2.5-flash; the example config also lists gemini-2.5-pro and gemini-3-flash-preview.

Outputs are two STRINGs: the transcript, and a JSON status blob with token usage (total_tokens, prompt_tokens, candidates_tokens) or an error message on failure. That second output is your debugging friend - when a call dies, the reason lands there, not in a crash.

Installing it

Same pack as its siblings:

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 fill in the gemini-stt section's api_key (and base_url, if you're using a Gemini-compatible relay rather than Google directly). No model downloads, no GPU requirement, nothing extra to pip-install - the node's imports all ship with ComfyUI. Restart and look under YCYY/API.

The usual trouble spots

  • Check the second STRING output first. Errors don't throw; they come back as JSON in the metadata output.
  • Long audio. The node re-encodes to WAV in memory and Gemini has context limits. Very long clips hit API limits or the 120s default timeout - chunk them.
  • 429s on the free tier. Gemini's free key is rate-limited hard, and STT burns tokens fast on long audio. A paid key is the actual fix.
  • It's a cloud call. No internet, no transcription. If offline robustness matters more than convenience, a local Whisper node is the honest recommendation; this node is for when you want Gemini's comprehension without the local stack.

One more thing worth knowing: because this rides on the generic chat model, the prompt can do heavy lifting the API doesn't give you natively - "output a JSON array of {start, end, text}" gets you structured results you can wire straight into downstream automation.

CategoryYCYY/API/audio

Inputs (5)

NameTypeDefaultDescription
audioAUDIOThe audio to transcribe
promptSTRINGThe prompt to guide the transcription. You can ask for specific formats or instructions.
modelCOMBOgemini-2.5-flash2 options: gemini-2.5-flash, gemini-2.5-pro
config_optionsopt*Optional configuration override from YCYY Gemini STT Config Options
proxy_optionsopt*Optional proxy configuration override from YCYY Proxy Config Options

Outputs (2)

NameTypeDescription
STRINGSTRING
STRINGSTRING