Nodes/world weaver/Gemini API (World Weaver)
ComfyUI Node

Gemini API (World Weaver)

A Gemini call you can actually wire into a graph

By Creepybits·Created 10 months ago·Updated 2 months ago· 30
Gemini API (World Weaver)
  • image
  • text
system_prompt
model
max_output_tokens1024
temperature0.9
top_p0.90
seed0
top_k50
api_key_selection
user_instructions
resize_image_toNone
thinking_modedisable
safety_thresholdBlock None

World Weaver's whole system leans on an LLM: a vision model reads a reference image and turns it into the character's written "DNA," and another call directs the scene from text. This node is where those calls happen. It's a direct Gemini API client with a system prompt, an optional image input, and one text output - no models to download, just a Google API key and an internet connection.

It's also the pack's fiddliest piece, and the fiddliness is all in the setup. The node itself, once configured, is pleasant: Gemini 2.5 Flash is fast and cheap, the image input makes the Prompt Helper workflow work, and having the call sit inside the graph means the result flows straight into your prompt encoder instead of you copy-pasting from a browser.

How it works

The node builds a google-genai client, stuffs your system prompt in as the system instruction, and fires a generate_content call. The inputs you'll actually set:

  • system_prompt - this is the brain. The pack ships a tuned one (a Flux/T5-XXL prompting prompt that forces a 200–400 token, photoreal, uncensored output). You can paste any system prompt here.
  • model - gemini-2.5-flash-lite or gemini-2.5-flash.
  • max_output_tokens, temperature, top_p, top_k - the usual knobs; defaults are 1024, 0.9, 0.9, 50.
  • api_key_selection - a dropdown of keys from your config file (more on that below).
  • Optional: user_instructions (extra direction appended to the request), image (an IMAGE - it's resized via PIL if you set resize_image_to to 512/768/1024, which keeps your API bill down), thinking_mode (enable/disable), and safety_threshold (from "Block None" up to "Block High").

The single output, text, is Gemini's reply. In the pack's workflows it feeds Master Key or a concatenate node and then into the prompt encoder. One honest detail: the seed input exists in the UI but the current code never forwards it to the API, so don't expect it to make outputs deterministic. And if you feed neither a system prompt, user instructions, nor an image, you get an error - something has to actually ask the question.

Installing it and the key config (read this)

Install the pack: ComfyUI Manager, search "world weaver", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Creepybits/World_weaver

Restart, and let pip pull in google-genai plus the rest of the pack's requirements. No model downloads.

Then the part that trips everyone. The code hardcodes the config path as C:\PATH\TO\YOUR\API_KEY\api_keys_config.json - a literal placeholder. Meanwhile the README tells you to edit custom_nodes/Creepy_nodes/assets/scripts/api_keys_config.json, which is wrong on two counts (that's the pack's old name, and it's not where the code looks). The repo ships a config at assets/scripts/api_keys_config.json with placeholder paths pointing at text files containing your keys. So, pick one:

  1. Edit API_CONFIG_PATH at the top of GeminiAPI.py to point at your actual config file, or
  2. Create the config file at exactly the hardcoded path, with entries that point at .txt files holding your key.

The config format is a JSON map of display name to key-file path:

{
  "Gemini Free": "C:\\Users\\you\\keys\\gemini_free.txt",
  "Gemini Paid": "C:\\Users\\you\\keys\\gemini_paid.txt"
}

Grab a key from Google AI Studio. Restart ComfyUI. If the dropdown says "Config not found," the config file isn't at the hardcoded path - that's the signal you've hit this exact bug.

Where people get burned

  • "Config not found" - see above. This is the number-one support issue and it's a path bug, not a permissions one.
  • "API key not found" - the config loaded but the key file it points to doesn't exist or is empty. Windows paths in JSON need escaped backslashes (\\).
  • Rate limits - the pack adds a Delay Text Node in front of these calls for a reason. Free-tier Gemini throttles; space your calls out.
  • Output to nothing - the node returns error text as its text output rather than crashing, so a failed call can look like a weird prompt. Watch for API Error: in the output.
  • Thinking mode - enable requests reasoning, which costs more tokens; keep max_output_tokens sane (4096 is the built-in budget reference) or responses get cut off.

Honestly, the Gemini node is the heart of the system and the best argument for it: having a vision model that reads your reference image and writes the character description is where World Weaver's "text DNA" actually gets born. It just needs ten minutes of key wrangling before it'll talk to you.

CategoryCreepybits/API

Inputs (13)

NameTypeDefaultDescription
system_promptSTRING
modelCOMBO2 options: gemini-2.5-flash-lite, gemini-2.5-flash
max_output_tokensINT10241–8192
temperatureFLOAT0.90–2
top_pFLOAT0.900–1
seedINT00–18446744073709550000
top_kINT501–100
api_key_selectionCOMBO1 options: Config not found
user_instructionsoptSTRING
imageoptIMAGE
resize_image_tooptCOMBONone4 options: None, 512, 768, 1024
thinking_modeoptCOMBOdisable2 options: disable, enable
safety_thresholdoptCOMBOBlock None4 options: Block None, Block Low, Block Medium, Block High

Outputs (1)

NameTypeDescription
textSTRING