π± Gemini Operation
Find-and-replace for your prompts, minus the regex headache
- response
Gemini Operation is the pack's plain text-editing node, and "plain" is doing a lot of work. You hand it some source text, you tell it what to change, and it hands back edited text. That's the whole job, and it's a more useful job than it sounds, because "edit this prompt" in natural language beats writing a regex or doing four manual find-and-replaces every single time.
It's part of the Artha-Gemini pack (the π± nodes in your node list), which wraps the Gemini API so your ComfyUI workflow can use a hosted LLM without downloading a model or using a single GB of VRAM. Operation is the utility node in that family: the one you drop in when you want your prompt pipeline to rewrite, trim, or reword something before it hits the KSampler.
How it works
The mechanism is almost embarrassingly simple. Operation takes your instruction and folds it into a system prompt: "Role: You are an intelligent ai assistant. Task: You will perform the given action on the text prompt. Action: [your instruction]". Your source text goes in as the user prompt, and the whole thing is sent to the Gemini model you picked. Whatever comes back is your output.
The important thing to know: this is stateless. Every run is a fresh one-shot call. There's no conversation, no memory, and no context carried between runs - which is usually what you want from a text transform, because it makes the node deterministic to reason about and cheap to iterate on.
The inputs that matter
The two you'll actually touch:
- source - the text being edited. Defaults to
A cat with a hat, which is a decent hint that this node was built by someone who loves demo cats. - instruction - what to do with it, e.g.
Change cat to dog. Think of it as a natural-language find-and-replace: the model is surprisingly good at "remove all color words" or "make it 50% shorter" even though you're not writing a formal pattern.
Then the shared API block every Gemini node in this pack carries: api_key, model, max_tokens, temperature. The model list defaults to gemini-2.5-flash, and honestly that's the right default for a task this light - no need to burn gemini-2.5-pro tokens on a find-and-replace. Output is a single response string, which wires straight into a CLIP text encoder or another text node.
Installing it
The pack installs like any custom node. In ComfyUI Manager, search Artha-Gemini and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Cyrostar/ComfyUI-Artha-Gemini
cd ComfyUI-Artha-Gemini
pip install -r requirements.txt
The dependencies are light (torch, numpy, Pillow, soundfile, google-genai) - nothing heavy, no model downloads. Then restart ComfyUI and get an API key from Google AI Studio. This is a cloud call, not a local one; the key is the one hard requirement.
Where people get burned
The number one failure mode is the API key, and it's worth doing properly. If you paste your key into the node's api_key field, it's stored in plain text in your workflow - visible to anyone who opens the JSON. The README is explicit about this. Put it in the api.json file inside the pack folder (that's the gemini_api_key field) or set a GEMINI_API_KEY environment variable instead, and leave the node field empty.
When the API call fails, the node prints the error to the console and returns a string that starts with Error: - that's the clue you're missing, not the node breaking. Check the key first, then check your quota. And one honest caveat: this pack is niche, with a tiny community footprint, so if you're building a production pipeline on it, test the call with your actual instruction before you automate around it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| source | STRING | A cat with a hat | β |
| instruction | STRING | Change cat to dog | β |
| api_key | STRING | API key will be visible in plain text. Consider adding your api to the api.json located inside this custom node folder. | |
| model | COMBO | gemini-2.5-flash | 5 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite |
| max_tokens | INT | 50001β8192 | For Gemini models, a token is equivalent to about 4 characters. 100 tokens is equal to about 60-80 English words. |
| temperature | FLOAT | 0.70β2 | A temperature of 0 means only the most likely tokens are selected, and there's no randomness. Conversely, a high temperature injects a high degree of randomness into the tokens selected by the model, leading to more unexpected, surprising model responses. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | β |