Ask Google Gemini JNK
Free text-and-image API calls, throttle included
- image
- response
Ask Google Gemini is the pack's gateway to a real LLM/VLM from inside the graph. You give it a text prompt, optionally an image, and it returns Gemini's text response as a string you can wire anywhere - into a prompt encoder, a captioner, a filename builder, whatever. Think of it as the "brains" node: image understanding, captioning, prompt expansion, sanity-checking a render - all without leaving ComfyUI and with no local GPU cost. If you've got a free Google AI Studio key, this is the cheapest way to add an actual vision model to your workflow.
How it works
The node calls the official Gemini API through the google-genai Python client. It builds a content list from your prompt and, if an image is attached, the image serialized to PNG bytes. No local model, no VRAM - it's a network call. The interesting part is the built-in RPM throttle: set rpm above 0 and the node records each request's timestamp to a temp file (keyed by a hash of model+key), then sleeps before the next call so you stay under free-tier rate limits without hammering Google. It's a genuinely thoughtful touch for batch workflows.
Inputs and outputs
api_key- your Google AI Studio key. Get a free one at aistudio.google.com/apikey.model- model ID, defaultgemini-2.5-flash. Free-tier defaults: flash is fast and cheap,gemini-2.5-prois stronger but slower and rate-limited harder. Check current models because IDs change.prompt- multiline text, whatever you want Gemini to do.rpm- requests per minute to throttle to;0disables throttling.image(optional) - an IMAGE to send alongside the prompt for vision tasks.
Output: response - a STRING with Gemini's text.
Installing it
Pack install as usual - search JNK in ComfyUI Manager, or:
cd ComfyUI/custom_nodes/
git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
Unlike most nodes in this pack, this one has a real dependency: google-genai (>=1.24.0) from requirements.txt, which is also in the pack's pyproject. Install it if the pack's auto-install didn't:
pip install google-genai
Then restart ComfyUI and restart the API client.
Where people get burned
Your API key ends up in the workflow file. The key is a plain widget value, which means it's baked into the workflow JSON and into the metadata of any image you save. Do not share a workflow that has your key in it - strip it first, or better, keep keys in a file with the pack's Get Gemini Keys node and wire them in. That's the whole reason that node exists.
Errors come back as strings, not exceptions. If the call fails, the node returns something like Error: ... as the response. That looks like output, so it can flow silently downstream and poison your next node. If your workflow starts behaving weirdly, check the console and look for an Error (AG) line.
Free tier is real. Flash defaults sit around 15 RPM on the free tier; if you set rpm to 0 and loop a batch, you will hit rate limits. Set it, and let the node pace you. Pairing this with Get Gemini Keys (rotation) and Get Gemini Models (centralized model/RPM config) is the intended setup, and it's the sane one.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | β | |
| model | STRING | gemini-2.5-flash | β |
| prompt | STRING | β | |
| rpm | INT | 00β1000 | β |
| imageopt | IMAGE | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| response | STRING | β |