Nodes/OmiXdev Custom Nodes/๐Ÿ‘พ Gemini Chat API ๐Ÿ”‘
ComfyUI Node

๐Ÿ‘พ Gemini Chat API ๐Ÿ”‘

OmixGeminiPro is cheap โ€” but the install bites exactly once

By omixmaxdimoยทCreated 11 months agoยทUpdated 6 months agoยท 0
๐Ÿ‘พ Gemini Chat API ๐Ÿ”‘
    • last_reply
    • chat_history
    โ—„api_key๐Ÿ”‘ AIzaSy...โ–บ
    โ—„user_messageHello Gemini ๐Ÿ‘‹โ–บ
    โ—„modelgemini-2.5-flash-liteโ–บ
    โ—„resetfalseโ–บ
    โ—„send_historytrueโ–บ

    If you want a cloud LLM inside ComfyUI but OpenAI's pricing irritates you, OmixGeminiPro ("๐Ÿ‘พ Gemini Chat API ๐Ÿ”‘") is the Google-flavored entry in OmiXDev's chat trio. The default model is gemini-2.5-flash-lite, which is fast, cheap, and has a usable free tier - a fine engine for the "draft me a detailed prompt for this character and composition" job. Same basic shape as the OpenAI node: key in, message in, reply out.

    How it works

    The node uses Google's google.generativeai SDK: it configures with your key, spins up a GenerativeModel, and - the nice bit - actually respects send_history. When it's on, the ๐Ÿ‘ค/๐Ÿค– log is rebuilt as user/model turns and passed to start_chat(history=...), so it holds a real conversation rather than the stateless single calls the OpenAI node makes.

    One validation quirk to know: the node checks that your key starts with "AI". Gemini keys look like AIzaSy..., so that's usually fine - but if it doesn't match you get "โŒ Invalid or missing Gemini API Key." instead of a call.

    The inputs and outputs that matter

    • api_key - your AIzaSy... key from aistudio.google.com. Same caveat as ever: it's saved in the workflow JSON, so don't hand out workflows with the key inside.
    • user_message - the instruction or prompt draft, multiline.
    • model - a hardcoded dropdown of just two: gemini-2.5-flash-lite (default) and gemini-exp-1206.

    reset clears the in-session history. Outputs are last_reply and chat_history, both STRING - the second is the newline-joined log with ๐Ÿ‘ค/๐Ÿค– markers, handy for display or saving.

    Installing - the one trap

    Install the pack normally (Manager: search OmiXdev Custom Nodes, or the clone steps below), then install the requirements:

    cd ComfyUI/custom_nodes
    git clone https://github.com/omixmaxdimo/OmiXDev.git
    cd OmiXDev
    pip install -r requirements.txt
    

    And here's where it bites: the pack's requirements.txt lists google-genai, but the node's code imports google.generativeai. Those are two different packages - google-genai ships the google.genai module, not the one this node needs. A fresh install can load everything fine, then throw ModuleNotFoundError: No module named 'google.generativeai' the first time the node is imported. If you see that:

    pip install google-generativeai
    

    then restart. Ten-second fix, just annoying it's not in the requirements file.

    Troubleshooting

    • The stale model. gemini-exp-1206 was an experimental 2024 release, and Google retires experimental models. If you pick it and get a model-not-found error, that's why - stick with gemini-2.5-flash-lite.
    • Shared history again. Like the rest of the pack, chat_history is class-level, so all your OmixGeminiPro instances share one log per session and it clears on restart. Hit reset if threads start bleeding together.
    • Errors are silent strings. Exceptions are caught and returned as last_reply with a โŒ prefix. Keep a text preview on the output so a failed call doesn't invisibly feed your prompt encoder.

    Pick this one when you want Google's cheap flash model doing your prompt drafting. The install hiccup is a one-time annoyance; after that it just works.

    Category๐Ÿ‘พ OmiXDev/Chat

    Inputs (5)

    NameTypeDefaultDescription
    api_keySTRING๐Ÿ”‘ AIzaSy...โ€”
    user_messageSTRINGHello Gemini ๐Ÿ‘‹โ€”
    modelCOMBOgemini-2.5-flash-lite2 options: gemini-2.5-flash-lite, gemini-exp-1206
    resetoptBOOLEANfalseโ€”
    send_historyoptBOOLEANtrueโ€”

    Outputs (2)

    NameTypeDescription
    last_replySTRINGโ€”
    chat_historySTRINGโ€”