Nodes/ComfyUI Gemini Nodes/Gemini Text API
ComfyUI Node

Gemini Text API

Drop a real Gemini brain into any ComfyUI workflow

By jqy-yoΒ·Created about a year agoΒ·Updated 11 months agoΒ· 7
Gemini Text API
    • response
    • api_request
    • api_response
    β—„promptβ€”β–Ί
    β—„api_keyβ–Ί
    β—„modelgemini-2.0-flashβ–Ί
    β—„temperature0.70β–Ί
    β—„max_output_tokens1024β–Ί
    β—„seed0β–Ί
    β—„system_instructionsβ–Ί
    β—„top_p0.95β–Ί
    β—„top_k64β–Ί
    β—„api_versionautoβ–Ί

    The node that makes your graph think

    ComfyUI is brilliant at moving pixels and tensors around, but it has no idea what to say. GeminiTextAPI is the pack's workhorse: you feed it a prompt, it calls the Google Gemini API, and it hands you back plain text you can wire into anything else in the graph. Want an LLM to write your next prompt, summarize a caption, or condition the tone of a workflow on some external text? This is where that comes from.

    It's part of the jqy-yo/comfyui-gemini-nodes pack (a fork lineage of ComfyUI_Fill-Nodes), and it's the node the author built first - everything else in the pack is a variation on the same idea: Gemini API call in, structured data out.

    How it works

    The node uses the google-genai Python library to hit the generateContent endpoint. Nothing runs locally - no model download, no VRAM. Your key and prompt go up, text comes back. The model input is a plain string, so you can type any valid Gemini model name: gemini-2.0-flash (the default), gemini-2.5-flash-lite for cheap quick calls, or gemini-1.5-pro when you want the bigger brain on a hard question.

    The inputs that actually matter

    You'll set these every time:

    • prompt - what you want generated. Multiline, so paste freely.
    • api_key - paste your Google AI Studio key here, or skip it and set the GOOGLE_API_KEY environment variable instead. That's the cleaner setup; the node reads it automatically.
    • model - plain-text model name, any Gemini model you have access to.
    • temperature - 0.0 to 1.0, default 0.7. Crank it down to 0.1–0.3 for factual/technical output, up toward 0.9 for creative work.
    • max_output_tokens - how long the answer can be (default 1024, up to 8192).
    • seed - set it and the same request is reproducible (within the usual LLM "mostly reproducible" caveats).
    • system_instructions - the optional system prompt that steers the model's whole behavior. If you always want technical answers with code samples, put that here once instead of repeating it in every prompt.

    Outputs are response (the text), plus api_request and api_response - the full JSON the node sent and got back. Those two aren't decoration; when something goes wrong they're how you see exactly what the API received, which is most of the battle in debugging.

    Install

    The pack isn't in the default ComfyUI install. Easiest route is ComfyUI Manager: search for "ComfyUI Gemini Nodes" and install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jqy-yo/comfyui-gemini-nodes
    cd comfyui-gemini-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. The pack pulls in google-genai, aiohttp, opencv-python and moviepy - those last two are heavier and mostly needed by the video/image nodes, so a text-only workflow will still drag them in.

    Where people get burned

    Start with a dead-simple prompt before blaming the node - a 500 error on your first call usually means the API key is bad (extra whitespace is a classic), the model name is misspelled, or the model isn't available in your region. The pack ships a TROUBLESHOOTING.md that says the same thing: verify the key in Google AI Studio, then try gemini-1.5-flash as a baseline before anything fancier. Watch out for -exp suffix models too - they're experimental, can vanish, and gemini-2.5-flash-lite is documented in the pack as limited for big inputs. For plain text, though, this node is the reliable heart of the pack.

    CategoryπŸ€– Gemini

    Inputs (10)

    NameTypeDefaultDescription
    promptSTRINGβ€”
    api_keySTRINGβ€”
    modelSTRINGgemini-2.0-flashβ€”
    temperatureFLOAT0.700–1β€”
    max_output_tokensINT102464–8192β€”
    seedINT00–2147483647β€”
    system_instructionsoptSTRINGβ€”
    top_poptFLOAT0.950–1β€”
    top_koptINT641–100β€”
    api_versionoptCOMBOauto4 options: auto, v1, v1beta, v1alpha

    Outputs (3)

    NameTypeDescription
    responseSTRINGβ€”
    api_requestSTRINGβ€”
    api_responseSTRINGβ€”