How to Make a Local LLM Write Random Prompts for You in ComfyUI

New prompt:
You are a creative engineer who creates rich image-generation prompts for unusual high-fashion photography.
User options: [young woman in night club]
Treat the User options as the ONLY fixed constraint: the subject and the location.
Step 1 (internal only, never output): Invent a completely random short story that fits the given scene. The genre and action must be random each time: love, battle, training, everyday life, leisure, mystery, adventure, rivalry, solitude, celebration, etc. The story must define ONE specific action, ONE mood, and ONE coherent moment inside that location.
Step 2: Convert that story into one rich English image-generation prompt, maximum 400 words. The final image must look like a high-fashion editorial shoot.
Output only the final raw prompt. Do NOT output the story, reasoning, explanations, headings, key points, or phrases like "Here's a hint:".
IMPORTANT — what "unusual" means here:
Unusual comes from COMPOSITION, CAMERA, and FRAMING — NOT from dumping random surreal objects into the scene. Every object in the frame must belong to the chosen location and make logical sense there. If the scene is a gym, everything is gym-related; if it is a cafe, everything is cafe-related. Nothing unrelated may appear.
Achieve the unusual look through at least 3 of these: unexpected camera angle; extreme low or top-down view; strong foreground occlusion; off-center or tilted composition; unusual crop; extreme perspective or foreshortening; deep layered depth with foreground / midground / background; subject partially out of frame; mirror or reflection play; motion blur; lens distortion; wide-angle or telephoto compression; dramatic negative space; asymmetric balance; extreme scale contrast between subject and environment.
Keep it coherent: one clear scene, one clear action, one clear mood. Do not mix unrelated themes.
Style: high-fashion editorial photography. Styling, outfit, hair, makeup, and props must fit the chosen location and the invented story. Think Vogue / campaign-level composition. Atmospheric, intentional, cinematic. If the setting suggests it, allow subtle futuristic or magical elements — but only ones that logically belong to that setting.
Include a 5–10 word lighting and atmosphere description.
Test images from generator.
https://civitai.red/posts/31170231
More:
https://civitai.red/posts/31299313
===============================================================
🎲 OLLAMA RANDOM PROMPT → GENERATE
Custom node for ComfyUI
Folder: ComfyUI/custom_nodes/OGTE/
Hatolic 2026 — made for lazy bums. 🦆
Telegram: https://t.me/chototipaneuro
===============================================================
A node for lazy bums. 🦆
Are you seriously going to come up with a prompt by hand every single time?
No. You'll queue up a batch, go grab a cup of tea, come back — and you'll have
200 images generated from random solid prompts. A local LLM via Ollama writes
the prompt for you, the node immediately wraps it into conditioning and hands
it off to any generator.
===============================================================
⭐ WORKS PERFECTLY WITH GEMMA 4
===============================================================
This node is tuned and tested for the Gemma family, including the new
Gemma 4 line: gemma4:e2b, gemma4:e4b, gemma4:12b.
Why Gemma 4:
• Native support for the system prompt — you can use a full system role,
just like in regular chat models (older Gemma can't do this)
• Consistently produces long, coherent text without lists or tags
• Holds the "output only the prompt, nothing else" instruction very well
• E2B and E4B — efficient, lightweight, run great on laptops
• 12B — unified multimodal model with up to 256K context
Choosing a model for your hardware:
gemma4:e2b — 2.3B, ~2-3 GB, ultra-light for laptops and edge devices
gemma4:e4b — 4.5B, ~3-5 GB, the sweet spot for most tasks
gemma4:12b — 12B, ~7-8 GB, best balance of quality and speed on RTX 3060+
gemma4:26b — 26B MoE (4B active), ~17 GB, fast and smart
gemma4:31b — 31B Dense, ~20 GB, max quality, needs real VRAM
Verified commands:
ollama pull gemma4:e2b
ollama pull gemma4:e4b
ollama pull gemma4:12b
ollama pull gemma4:26b
ollama pull gemma4:31b
If you want to set it up once and forget it — use gemma4:e4b on a laptop or
gemma4:12b on a machine with a GPU. Other models are supported too,
but Gemma 4 is the top pick.
===============================================================
📁 FILE STRUCTURE
===============================================================
ComfyUI/custom_nodes/OGTE/
├── init.py ← REQUIRED
├── ollama_generate_then_encode.py ← main script
└── config.ini ← created automatically on first run
===============================================================
🧠 SUPPORTED MODELS
===============================================================
gemma4* → ⭐ RECOMMENDED. Native system + user
gemma* (older) → single user prompt (no system)
qwen* → system + user (natively handles system)
mistral* / mixtral* → system + user
everything else → standard system + user
The model list is pulled automatically from your Ollama at /api/tags.
===============================================================
📦 REQUIREMENTS
===============================================================
• Running Ollama at http://127.0.0.1:11434 (or another address)
• At least one model: ollama pull gemma4:e4b (recommended) / e2b / 12b
• Python packages: requests, torch (already bundled with ComfyUI)
===============================================================
⚙️ INPUTS / OUTPUTS
===============================================================
INPUTS:
ollama_host — Ollama address (default: http://127.0.0.1:11434)
ollama_model — which model to call (list is automatic)
system_prompt — instruction for the model (multiline)
temperature — creativity (0.7 normal, 1.2+ chaos, 0.3 boring)
seed — 0 = random every time, otherwise fixed
max_retries — how many times to re-request on short/empty responses
save_prompts — whether to save the prompt to a file
clip (optional) — if connected, returns CONDITIONING
OUTPUTS:
conditioning — ready CONDITIONING for the sampler
generated_prompt — the prompt text (for Show Text / copying)
===============================================================
🚀 HOW TO USE (FOR LAZY BUMS)
===============================================================
1. Add the node 🎲 Ollama → Random Prompt → Generate
2. Pick a model like gemma4:e4b (or e2b / 12b) in the ollama_model field
3. Connect CLIP (the same one going into your generator — Flux/SDXL/anything)
4. conditioning output → into KSampler
5. generated_prompt output → into Show Text (so you can read what it cooked up)
6. Queue with as many iterations as you want (e.g., 100)
7. Go drink your tea ☕
Every iteration — a new random prompt. Every iteration — a new image.
===============================================================
💾 SAVING PROMPTS
===============================================================
If save_prompts = true (default), every prompt is written to:
ComfyUI/output/prompts/prompts_YYYY-MM-DD.txt
Format:
1. A bathroom turned upside down. The bathtub is filled with rubber ducks...
2. An abandoned observatory on a cliff at dawn, brass telescopes covered in...
Numbering is continuous within a day, each day gets a new file.
You can change the folder in config.ini (the folder field).
===============================================================
🔧 config.ini
===============================================================
The file is created automatically next to the script:
[Ollama]
host = http://127.0.0.1:11434
model = gemma4:e4b
system_prompt = Generate a detailed image prompt...
temperature = 0.7
max_retries = 3
[Save]
enabled = true
folder = prompts
What this gives you:
• Default values for all node fields
• Every time the node runs, the current settings are SAVED back
• folder can be an absolute path (e.g., D:/prompts)
===============================================================
🦆 FALLBACK
===============================================================
If Ollama is unreachable, all retries failed, or the model produced garbage
shorter than 50 characters — the node returns the LEGENDARY fallback about
rubber ducks in the bathroom:
"A bathroom turned upside down. The bathtub is filled with rubber ducks
wearing tiny sunglasses..."
This is not a bug. It's a feature. Better ducks than a red error screen.
===============================================================
❓ FAQ
===============================================================
Why is the prompt short / empty?
The model is being dumb or timing out. Increase max_retries to 4–5.
Or switch to gemma4:e4b.
Why is it slow?
Ollama on CPU is pain. On GPU it's tolerable. gemma4:e2b flies even on a
laptop, gemma4:e4b is the sweet spot, gemma4:12b if you have an RTX 3060+.
Which model is best?
Gemma 4. Specifically:
• gemma4:e2b — for weak machines and edge devices
• gemma4:e4b — optimal for most people
• gemma4:12b — best quality on reasonable hardware
It doesn't act up, natively supports the system prompt, and consistently
writes long scenes without garbage.
I want text only, without CLIP.
Don't connect clip. The conditioning output will be None, and
generated_prompt works as usual.
The node didn't appear in the menu.
Check that OGTE/ contains init.py. Without it ComfyUI won't see the
script inside the subfolder.
Where are the prompts saved?
ComfyUI/output/prompts/. If you want a different location — edit config.ini.
===============================================================
📜 LICENSE
===============================================================
Do whatever you want. Just don't hurt the ducks. 🦆
Hatolic 2026 — for lazy bums, with love.
More useful stuff: https://t.me/chototipaneuro
По Русски.
===============================================================
🎲 OLLAMA RANDOM PROMPT → GENERATE
Кастомная нода для ComfyUI
Папка: ComfyUI/custom_nodes/OGTE/
Hatolic 2026 — сделано для ленивых жопок. 🦆
Telegram: https://t.me/chototipaneuro
===============================================================
Нода для ленивых жопок. 🦆
Ты что, серьёзно будешь каждый раз руками придумывать промпт? Нет. Ты запустишь
очередь, уйдёшь пить чай, вернёшься — а у тебя 200 картинок сгенерировано по
случайным годным промптам. Локальная LLM через Ollama пишет промпт за тебя,
нода сразу заворачивает его в conditioning и отдаёт любому генератору.
===============================================================
⭐ ИДЕАЛЬНО РАБОТАЕТ С GEMMA 4
===============================================================
Нода заточена и протестирована под семейство Gemma, включая новую линейку
Gemma 4: gemma4:e2b, gemma4:e4b, gemma4:12b.
Почему именно Gemma 4:
• Нативная поддержка system-промпта — можно использовать полноценный system
role, как в обычных чат-моделях (старые Gemma так не умеют)
• Стабильно выдаёт длинный связный текст без списков и тегов
• Отлично держит инструкцию "output only the prompt, nothing else"
• E2B и E4B — эффективные модели, лёгкие, летают на ноутбуках
• 12B — унифицированная мультимодальная модель с контекстом до 256K
Выбор модели под железо:
gemma4:e2b — 2.3B, ~2-3 GB, ультралёгкая для ноутов и edge-девайсов
gemma4:e4b — 4.5B, ~3-5 GB, золотая середина для большинства задач
gemma4:12b — 12B, ~7-8 GB, лучший баланс качества и скорости на RTX 3060+
gemma4:26b — 26B MoE (4B активных), ~17 GB, быстрая и умная
gemma4:31b — 31B Dense, ~20 GB, максимальное качество, нужна нормальная VRAM
Проверенные команды:
ollama pull gemma4:e2b
ollama pull gemma4:e4b
ollama pull gemma4:12b
ollama pull gemma4:26b
ollama pull gemma4:31b
Если хочешь один раз настроить и забыть — ставь gemma4:e4b для ноутбука или
gemma4:12b для машины с видеокартой. Остальные модели тоже поддерживаются,
но Gemma 4 — топ.
===============================================================
📁 СТРУКТУРА ФАЙЛОВ
===============================================================
ComfyUI/custom_nodes/OGTE/
├── init.py ← ОБЯЗАТЕЛЕН
├── ollama_generate_then_encode.py ← основной скрипт
└── config.ini ← создастся автоматически при первом запуске
===============================================================
🧠 ПОДДЕРЖИВАЕМЫЕ МОДЕЛИ
===============================================================
gemma4* → ⭐ РЕКОМЕНДУЕТСЯ. Нативный system + user
gemma* (старые) → один user-промпт (без system)
qwen* → system + user (нативно жрёт system)
mistral* / mixtral* → system + user
остальные (llama...) → стандартный system + user
Список моделей подтягивается автоматически из твоего Ollama по /api/tags.
===============================================================
📦 ТРЕБОВАНИЯ
===============================================================
• Запущенный Ollama на http://127.0.0.1:11434 (или другом адресе)
• Хотя бы одна модель: ollama pull gemma4:e4b (рекомендую) / e2b / 12b
• Python-пакеты: requests, torch (уже стоят вместе с ComfyUI)
===============================================================
⚙️ ВХОДЫ / ВЫХОДЫ
===============================================================
ВХОДЫ:
ollama_host — адрес Ollama (default: http://127.0.0.1:11434)
ollama_model — какую модель дёргать (список автоматом)
system_prompt — инструкция для модели (multiline)
temperature — креативность (0.7 норм, 1.2+ дичь, 0.3 скука)
seed — 0 = каждый раз рандом, иначе фиксированный
max_retries — сколько раз перезапросить при коротком/пустом ответе
save_prompts — сохранять ли промпт в файл
clip (optional) — если подключишь, вернёт CONDITIONING
ВЫХОДЫ:
conditioning — готовый CONDITIONING для сэмплера
generated_prompt — текст промпта (для Show Text / копирования)
===============================================================
🚀 КАК ПОЛЬЗОВАТЬСЯ (ДЛЯ ЛЕНИВЫХ ЖОПОК)
===============================================================
1. Добавь ноду 🎲 Ollama → Random Prompt → Generate
2. Выбери модель gemma4:e4b (или e2b / 12b) в поле ollama_model
3. Подключи CLIP (тот же, что идёт в твой генератор — Flux/SDXL/что угодно)
4. Выход conditioning → в KSampler
5. Выход generated_prompt → в Show Text (чтобы читать, что там выдумалось)
6. Включи queue с нужным количеством итераций (например, 100)
7. Иди пить чай ☕
Каждая итерация — новый случайный промпт. Каждая итерация — новая картинка.
===============================================================
💾 СОХРАНЕНИЕ ПРОМПТОВ
===============================================================
Если save_prompts = true (по умолчанию), каждый промпт пишется в:
ComfyUI/output/prompts/prompts_YYYY-MM-DD.txt
Формат:
1. A bathroom turned upside down. The bathtub is filled with rubber ducks...
2. An abandoned observatory on a cliff at dawn, brass telescopes covered in...
Нумерация сквозная в пределах дня, каждый день — новый файл.
Папку можно поменять в config.ini (поле folder).
===============================================================
🔧 config.ini
===============================================================
Файл создаётся автоматически рядом со скриптом:
[Ollama]
host = http://127.0.0.1:11434
model = gemma4:e4b
system_prompt = Generate a detailed image prompt...
temperature = 0.7
max_retries = 3
[Save]
enabled = true
folder = prompts
Что это даёт:
• Значения по умолчанию для всех полей ноды
• При каждом запуске ноды текущие настройки СОХРАНЯЮТСЯ обратно
• folder можно указать абсолютным путём (например D:/prompts)
===============================================================
🦆 FALLBACK
===============================================================
Если Ollama недоступна, все ретраи провалились, или модель выдала мусор
короче 50 символов — нода вернёт ЛЕГЕНДАРНЫЙ fallback про уточек в ванной:
"A bathroom turned upside down. The bathtub is filled with rubber ducks
wearing tiny sunglasses..."
Это не баг. Это фича. Лучше уточки, чем красный экран с ошибкой.
===============================================================
❓ FAQ
===============================================================
Почему промпт короткий / пустой?
Модель тупит или таймаут. Увеличь max_retries до 4–5. Или возьми gemma4:e4b.
Почему долго?
Ollama на CPU — это боль. На GPU — терпимо. gemma4:e2b летает даже на ноуте,
gemma4:e4b — золотая середина, gemma4:12b — если есть RTX 3060+.
Какая модель лучше всего?
Gemma 4. Конкретно:
• gemma4:e2b — для слабых машин и edge
• gemma4:e4b — оптимально для большинства
• gemma4:12b — лучшее качество на разумном железе
Она не выделывается, нативно поддерживает system-промпт и стабильно пишет
длинные сцены без мусора.
Хочу только текст, без CLIP.
Не подключай clip. Выход conditioning будет None, а generated_prompt — как обычно.
Нода не появилась в меню.
Проверь, что в папке OGTE/ есть init.py. Без него ComfyUI не увидит
скрипт внутри подпапки.
Куда пишутся промпты?
ComfyUI/output/prompts/. Если надо в другое место — правь config.ini.
===============================================================
📜 ЛИЦЕНЗИЯ
===============================================================
Делай что хочешь. Только уточек не обижай. 🦆
Hatolic 2026 — для ленивых жопок, с любовью.
Больше полезного: https://t.me/chototipaneuro