Nodes/Gemini prompt generator JT version/Gemini Prompt Generator-JT
ComfyUI Node

Gemini Prompt Generator-JT

The node that outsources prompt-writing to Google — and stays free

By LiJT·Created 2 years ago·Updated 6 months ago· 3
Gemini Prompt Generator-JT
  • image_1
  • image_2
  • image_3
  • STRING
theme
override_system_prompt
model
enable_memoryfalse
english_onlyfalse
prompt_length120
seed0
timeout15

Stuck staring at an empty prompt box, again? This is the fix that costs you zero VRAM: Gemini Prompt Generator-JT is a tiny ComfyUI node that calls the Google Gemini API, hands it a theme, and returns a ready-to-use image prompt as a string. No local model, no download - just an API key and an internet connection. It's a fork of the older "Magifactory" prompt generator with enough extras bolted on that it's worth a look on its own, especially if you're already paying Google nothing for the Gemini free tier.

Honest framing up front: this is a thin wrapper around a cloud API, not a clever pipeline. But thin is fine when the alternative is running a 7B+ LLM locally just to write a sentence. The one genuinely useful thing it adds over a bare API call is multimodal input - wire in up to three reference images and Gemini captions or expands on them. That makes it a passable poor-man's image-to-prompt tool too.

How it works

The node reads your key from config.json (it must exist - more below), builds a canned English instruction - "Generate me a prompt for image generator. The theme of the prompt is {theme}." plus a length cap and a blunt "do not explain, only output the prompt" suffix - and sends it to Gemini at temperature 0.9. The request runs on a background thread with a timeout you control, so a hung call errors out instead of freezing your queue.

Two settings change what gets sent. enable_memory keeps the last 15 generated prompts in memory and feeds them back so the model doesn't repeat itself across a batch - genuinely nice for keeping variety when you're generating a whole set. override_system_prompt is the secret weapon: leave it empty and this behaves like a normal prompt generator, but fill it in and the node turns into a general-purpose LLM call with template variables {theme}, {prompt_history} (or {memory}), {prompt_length}, and {seed}. The README's own example is "generate an image prompt for {theme}, history: {prompt_history}" - you can also just ask it to do something unrelated, since it's now a full chat-model call.

The inputs that matter

  • theme - the only thing you must fill in. A phrase, a sentence, a vibe. This is what gets expanded.
  • model - dropdown ships with gemini-2.5-flash-lite, gemini-2.5-flash, gemini-2.5-pro, and gemini-3-flash-preview. For day-to-day use start with 2.5-flash; the pro model is slower and throttled harder.
  • seed - the gotcha the README calls out: it is not sent to Gemini. It just controls when ComfyUI re-runs the node, so keeping it random is your "give me a new prompt" button.
  • image_1 / image_2 / image_3 (optional) - IMAGE inputs; wire a Load Image (or a VAE decode) in and the model sees it.
  • prompt_length (default 120, 0 = unlimited) and timeout (default 15s) are the only other ones worth touching early.

The single STRING output is your generated prompt. Wire it into a CLIP Text Encode node's positive input and you're done.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/LiJT/ComfyUI-Gemini-Prompt-Generator-JT

Then restart ComfyUI. Its only Python dependency is google-generativeai, which the install handles. You can also try ComfyUI Manager by searching "Gemini prompt generator JT". After restart, the step everyone forgets:

cd ComfyUI-Gemini-Prompt-Generator-JT
cp config.json.default config.json
# then edit config.json and put your key in "GEMINI_API_KEY"

Grab a free key from Google AI Studio - no credit card needed for the free tier.

Common issues

  • "API key is required" - you skipped the config step. The node reads config.json from its own folder; without it, it refuses to run.
  • Stale model errors - Gemini 1.5 models were retired in September 2025; if you're still pointed at one, everything 400s. The dropdown's 2.5 line is the fix.
  • Rate limits. The free tier is genuinely small - on the order of tens to low thousands of requests per day depending on the model - and the README's numbers already disagree with the node's own tooltip, because Google keeps moving them. A batch run can blow a day's budget fast. When you hit 429, the fix is waiting, not retrying harder.
  • Timeouts - the default 15 seconds is fine for flash models, tight for 2.5-pro. Bump timeout if you see ComfyUITimeoutError.
  • Memory isn't persistent - history lives in RAM, so it resets every restart. That's by design, not a bug.

One last security note, since a prior node in this exact niche (a "LLM vision" helper) turned out to be malware: your Gemini key sits in plaintext inside custom_nodes, so read what you install and keep that folder trusted. This one is a plain API wrapper, but the habit matters.

If you'd rather keep prompt-writing local and private, the community's usual answer is a Qwen-VL node or Ollama - but that's VRAM and setup. This node is the zero-setup-on-the-GPU option: grab a free key, type a theme, get a prompt.

Categorytext/generation

Inputs (11)

NameTypeDefaultDescription
themeSTRING输入想要生成的提示词主题
override_system_promptSTRING自定义提示词。您可以使用以下变量: {theme} - 当前主题 {prompt_history}或{memory} - 历史提示记录(当Memory设置为Disable时将替换为空列表[]) {prompt_length} - 提示长度设置 {seed} - 当前种子值 例如:'为{theme}生成一个图像提示词,历史记录:{prompt_history}'
modelCOMBO模型名称 + 免费层速率限制(官方配额会动态调整,以 AI Studio 为准): • gemini-2.5-flash-lite:10 RPM / 250K TPM / 20 RPD • gemini-2.5-flash:5 RPM / 250K TPM / 20 RPD • gemini-2.5-pro:2 RPM / 125K TPM / 50 RPD • gemini-2.0-flash-lite:30 RPM / 1M TPM / 200 RPD • gemini-2.0-flash:15 RPM / 1M TPM / 200 RPD • gemini-3-flash-preview:5 RPM / 250K TPM / 20 RPD 参数:RPM=每分钟请求数,TPM=每分钟Token数,RPD=每日请求数
enable_memoryBOOLEANfalse启用或禁用历史记忆功能。启用时会记住之前生成的提示,避免重复;禁用时每次生成独立提示
english_onlyBOOLEANfalse启用后将强制生成的提示词只使用英文。会在发送给Gemini的指令中添加英文限制要求
prompt_lengthINT1200–5000控制生成提示词的长度(单词数)。设为0表示不限制长度
seedINT00–18446744073709550000随机种子值,相同的种子会产生相似的结果
timeoutINT150–6000API请求超时时间(秒)。如果在指定时间内未收到响应,将中断请求
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE

Outputs (1)

NameTypeDescription
STRINGSTRING