AfterDark Gemini Prompter
The AfterDark Gemini Prompter is a whole Gemini client — but it won't do a thing until you add an API key
- image1
- image2
- image3
- image4
- text_output
- image_output
The name undersells it. "AfterDark Gemini Prompter" sounds like a text helper, but this node is a full Google Gemini client with a ComfyUI face - it builds prompts, generates images, and analyzes up to four images you feed it. The catch, and it's a hard one: nothing works until you add a Google Gemini API key in ComfyUI's settings. No key, and the model dropdown literally reads ERROR: No models found and a text box appears telling you exactly that. So let's get the setup out of the way first.
Setting it up (required, not optional)
The key lives in ComfyUI's settings panel, not in your workflow JSON. Open settings via the gear icon, scroll to the HackAfterDark section, paste your Gemini API key into the "Gemini API Key" field, and restart ComfyUI. The node stores it in a hackafterdark_settings.json file inside the pack's folder, which is why it survives exports - your key never ends up baked into a shared workflow. That's a genuinely nice touch for a node like this.
You'll also need the pack's Python dependencies. ComfyUI Manager normally installs them, but portable and hand-rolled installs can miss it. If you see ModuleNotFoundError: No module named 'google.generativeai', run:
# point this at the Python ComfyUI actually uses (check your startup logs)
python -m pip install -r ComfyUI/custom_nodes/ComfyUI-HackAfterDark-Nodes/requirements.txt
The heavy one in that list is google-generativeai. Then restart.
How it works
Once a key is in place, the node calls the Gemini API on every execution: it sends your system prompt, your user prompt, and any attached images, then hands back the response. The model dropdown isn't hardcoded - it's populated live from Google's model list, so whichever Gemini models your key can reach show up automatically. The dropdown stays at ERROR: No models found until the key loads, which is your visual confirmation that setup worked.
This is where the bundled Z-Image Turbo Prompter preset earns its keep. Z-Image Turbo famously ignores negative prompts - everything must be engineered into the positive text. The preset is a full system prompt that knows this: it scaffolds prompts (shot, subject, clothing, environment, lighting, mood, style, plus an exclusion clause like "no watermark, no blur") and asks clarifying questions before generating. Feed it "a wizard in a library" and it returns an 80–250 word prompt built for Z-Image's strengths. If you're on SDXL/Pony/Flux you can write your own system prompt instead, or point the settings' "Prompt Template Directory" at a folder of .md files - each filename becomes a preset in the dropdown.
Inputs and outputs that matter
model- Gemini model, populated from the API. The one you'll actually set.system_prompt_preset-None, the bundled Z-Image Turbo Prompter, or your custom.mdpresets.system_prompt/user_prompt- your text. Use the preset and you can mostly ignore the former.temperature- 0.9 default, 0–1 range. Lower it for tighter, more literal outputs; raise it for creativity.image1–image4- optional IMAGE inputs for multimodal analysis or edit-style prompting.error- this one only exists as an input when no API key is set; it's the message telling you to go fix that.
Outputs: text_output (STRING - wire it into something like Inspect Text or Show Text to see it; the node strips markdown code fences for you) and image_output (IMAGE - only populated if the model actually returns an image, otherwise you get a 1x1 black placeholder tensor). If you see a black dot in your preview, that's not a bug - that's Gemini declining to draw.
Common issues
Beyond the missing-key message and the google.generativeai import error, the realistic failure mode is Gemini's own safety filtering. If a prompt trips it, the node returns an error string explaining the block reason rather than silently failing - read the text_output. And remember the image flow: use a model that actually generates images (the *-image / flash image family) if you want image_output to be anything but a 1x1 black pixel. Use a text model and you've built a very fancy prompt rewriter, which is fine - that's half the point.
It's a solid, actively useful node if you already have a Gemini API key floating around, and a skip if you don't want to touch Google's billing dashboard. For Z-Image users it's the most convenient on-ramp to the "let an LLM write my prompts" workflow that everyone's been trying.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 1 options: ERROR: No models found | |
| system_prompt_preset | COMBO | 2 options: None, Z-Image Turbo Prompter | |
| system_prompt | STRING | — | |
| user_prompt | STRING | — | |
| temperature | FLOAT | 0.900–1 | — |
| error | STRING | API key not found. Please set it in the ComfyUI settings. | — |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text_output | STRING | — |
| image_output | IMAGE | — |