Nodes/ComfyUI-Google-AI-Studio/Google AI Studio Text Generator
ComfyUI Node

Google AI Studio Text Generator

A Gemini text node that actually behaves inside a workflow

By BuffMcBigHuge·Created about a year ago·Updated 6 months ago· 11
Google AI Studio Text Generator
    • text
    promptWrite a creative short story about artificial intelligence.
    api_key
    modelgemini-2.5-flash
    system_instruction
    temperature0.7
    max_output_tokens1024
    thinking_leveloff

    The odd one out in this pack: while its siblings generate images and audio, this node just produces text. That sounds boring until you want to automate prompt-writing inside ComfyUI - feed it a concept, get back a rich image prompt, and wire the output straight into an image generation node's prompt field. Or use it for rewriting, alt text, captioning, or any place a workflow needs a little generative text on the fly. It's Gemini 2.5/3 via the Google AI Studio API, no local model, no GPU.

    It earns its keep because of one small implementation detail most text nodes get wrong. ComfyUI caches node outputs and skips re-running nodes whose inputs haven't changed - which is why naive "text generation" nodes feel broken, giving you the same result forever. This node returns NaN from its IS_CHANGED hook, which forces ComfyUI to re-execute it on every run. That means each run gives you fresh text, which is what you want from a generator, and it means the node can never be "stale."

    How it works

    It calls the Gemini generate_content API through the google-genai SDK with the settings you pass in. Temperature, max tokens, and an optional system instruction are passed straight through as generation config; the thinking_level field (off/low/medium/high) is translated into a ThinkingConfig, which only has an effect on Gemini 2.5/3 models - on the older 1.5 models it's silently inert. The result comes back as a plain STRING.

    The inputs that matter

    • prompt - multiline, the actual thing you're asking for.
    • api_key - your Google AI Studio key.
    • model - 10 options, defaulting to gemini-2.5-flash, which is the sensible default for most use. Note the list still contains deprecated leftovers like gemini-1.5-flash-8b-001 and gemini-2.0-flash-thinking-001 - fine to use, but they're older, and Google will eventually pull them.
    • temperature - 0 to 2, default 0.7. Crank toward 1.5+ for creative variation, down near 0 if you want consistent output.
    • thinking_level - off by default; "high" for complex reasoning tasks, "low" when you care about latency.

    Output is text (STRING), which wires into any text display node, or - more usefully - into the prompt input of other nodes.

    Installing it

    Same as the rest of the pack: ComfyUI Manager, search "Google AI Studio," or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BuffMcBigHuge/ComfyUI-Google-AI-Studio.git
    cd ComfyUI-Google-AI-Studio
    pip install -r requirements.txt
    

    Just google-genai>=1.66.0, no model downloads. Restart and look under the "Google AI Studio" menu.

    Where people get burned

    Because the node deliberately re-runs every time, there's no seed - every run is a fresh draw, so don't chase a "reproducible" prompt without concatenating a seed into the prompt text yourself. And this is a Google API call, so it needs internet, a valid key, and has rate limits; if your workflow churns through prompts in a batch loop, you can trip the quota fast. Pick a current model from the dropdown and it's about the least-fiddly way to put a real LLM inside a ComfyUI graph.

    CategoryGoogle AI Studio

    Inputs (7)

    NameTypeDefaultDescription
    promptSTRINGWrite a creative short story about artificial intelligence.
    api_keySTRINGYour Google AI Studio API key
    modelCOMBOgemini-2.5-flash10 options: gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, +4
    system_instructionoptSTRINGSystem instruction to guide the model's behavior
    temperatureoptFLOAT0.70–2Controls randomness in generation (0=deterministic, 2=very creative)
    max_output_tokensoptINT10241–8192Maximum number of tokens to generate
    thinking_leveloptCOMBOoffReasoning depth (Gemini 2.5/3 only). 'high' for complex tasks, 'low' for latency-sensitive.

    Outputs (1)

    NameTypeDescription
    textSTRING