Nodes/OmiXdev Custom Nodes/πŸ‘Ύ Gemini Chat API πŸ”‘
ComfyUI Node

πŸ‘Ύ Gemini Chat API πŸ”‘

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

By omixmaxdimoΒ·Created 12 months agoΒ·Updated 2 days 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β€”