Nodes/comfyui_bmab/BMAB Google Gemini API
ComfyUI Node

BMAB Google Gemini API

Let Gemini write your prompt for you

By portu-sim·Created 2 years ago·Updated 8 months ago· 124
BMAB Google Gemini API
    • string
    prompt
    text
    api_key
    random_seed0

    The pack's own author files this under BMAB/toy, and that's worth taking at face value - it's a small, honest utility rather than a polished feature: a node that sends text to Google's Gemini API and hands back whatever comes out, so you can use an LLM to expand a rough idea into a proper prompt without leaving the graph. Google's Gemini line (the same family behind the "Nano Banana" image models, for context) is a capable general-purpose LLM, and asking it to turn "cyberpunk alley, neon" into a full, detailed txt2img prompt is exactly the kind of thing it's good at.

    How it works

    You give it two pieces of text - a prompt (think of this as your instruction/system message: "expand the following into a detailed SDXL prompt") and a text (the raw material you want it to work on) - plus your own Gemini api_key, and it makes an API call to Google and returns the model's response as a string. random_seed gets passed along for reproducibility of the generation call, the same idea as any LLM API's seed parameter. There's no local model here, no GPU work, no weight download - it's a thin wrapper around an outbound HTTP call.

    The inputs and outputs that matter

    • prompt (multiline STRING, required) - your instruction to Gemini. This is where the actual task lives: "rewrite this as a Danbooru-tag prompt," "add lighting and camera detail," whatever you need.
    • text (multiline STRING, required) - the input text Gemini works from.
    • api_key (STRING, required) - your Google Gemini API key, typed straight into the node.
    • random_seed (default 0, 0–65536) - passed to the API call for reproducibility.
    • Output: a single string, ready to wire straight into a CLIP Text Encode or into BMAB Prompt.

    How to install it

    ComfyUI Manager: search comfyui_bmab. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/portu-sim/comfyui_bmab.git
    cd comfyui_bmab
    pip install -r requirements.txt
    

    No extra model download for this specific node - it's just an HTTP call, so the only prerequisite is a working Gemini API key from Google AI Studio and outbound internet access from wherever ComfyUI is running (which matters if you're on an air-gapped or heavily firewalled box).

    Common issues & troubleshooting

    Your API key ends up saved in the workflow JSON, in plain text. This is the thing to actually worry about with this node. If you export or share a workflow that has this node filled in, whoever opens it gets your key along with it - burning through your quota or worse. Clear the field before sharing, or keep a separate "sharing" copy of the workflow with it blanked.

    "It's a toy" is the author's own label, not modesty. Treat it accordingly: it's genuinely useful for quick prompt expansion, but it's not positioned as a production-grade prompt engineering pipeline with retry logic, rate-limit handling, or structured output. If the call fails (bad key, quota exceeded, network hiccup), don't expect a graceful fallback - check your key and quota in Google AI Studio first.

    Nothing happens, or the output looks like an error message rather than a prompt. That's usually the API itself rejecting the request - an invalid or expired key, or a text/prompt combination Gemini's safety filtering didn't like. Test the same key with a plain curl call to the Gemini API outside ComfyUI if you're not sure whether the problem is the node or the credential.

    Cost. Gemini API usage is billed per Google's own pricing once you're past the free tier - this node doesn't meter or warn you, it just calls the API on every execution, including re-runs while you're iterating on other parts of the graph.

    CategoryBMAB/toy

    Inputs (4)

    NameTypeDefaultDescription
    promptSTRING
    textSTRING
    api_keySTRING
    random_seedINT00–65536

    Outputs (1)

    NameTypeDescription
    stringSTRING