🎨 KoboldCpp Prompt Engine for ComfyUI
Transform simple ideas into high-production prompts. This node integrates local LLMs via KoboldCpp to expand basic input into descriptive Prompts, ranging from Danbooru tags to technical staging.
*I use it to creating complexed Wildcard*
UPDATE: Version 1.1 - The "Thinking" Update 🚀
Optimized for Reasoning Models (DeepSeek-R1, Qwen-Thinking, o1).
Key Features
"Thinking" Mode: Enables Chain-of-Thought (CoT). The LLM plans the composition internally before generating the prompt.
Automatic Filtering: Removes all internal reasoning (
<think>...</think>) and meta-text (e.g., "Here is your prompt") so only the clean visual prompt reaches ComfyUI.Token Buffer: Automatically adds +250 tokens in Thinking mode to prevent prompts from being cut off by lengthy reasoning.
Source Cleaner: Strips out dataset artifacts like ``.
How to Use
Select "Thinking" in the Mode dropdown.
Use a reasoning-capable model in KoboldCpp.
Note:
start_helperis disabled in this mode to prioritize the<think>tag.Enable "debug" to view the LLM's internal logic in the console.
Tip: If the output still truncates, increase max_tokens. Reasoning consumes a significant portion of the context window.
Workflow Components (Included)
This workflow automates prompt engineering by connecting your local LLM to ComfyUI. It requires the following custom nodes:
KoboldLLMPrompter: The core engine for prompt expansion.
Wildcard Saver: Automatically archives every generated prompt.
LazySmartWildcards: Manages dynamic inputs and wildcard processing.
🚀 Quick Start
Installation: Save LLM_Wildcard.py in ComfyUI/custom_nodes/.
Backend: Ensure KoboldCpp is running a compatible model (Llama, Mistral, or Qwen).
Connection: Set the URL to your local API (default: http://127.0.0.1:5001).
🧠 Generation Modes:
SDXL (Tags) * Best For: SDXL / Pony-based models.
Output Style: Converts input into comma-separated Danbooru-style tags
Natural Sentence * Best For: Flux.1, SD3, or Midjourney-style prompting.
Output Style: Creates a cohesive, cinematic paragraph naturally fusing the subject, style, environment, and lighting.
Z-Engineer Best For: Qwen3-Z-Engineer Models* or similar high-parameter models.
Output Style: A production-focused, ~200-250 word paragraph with a deep focus on visual staging, lighting physics, and material textures.
🛠️ Key Functions:
Style Selection:
Choose from 14 aesthetics (e.g., Cyberpunk, DSLR, Anime) or use Random to cycle styles based on the seed.
Start Helper:
Force-starts the AI with specific phrases to bypass conversational "chatter" and ensure consistency.
Filter:
Internal logic that automatically strips AI artifacts like "Sure! Here is your prompt" and cleans up unfinished sentences.
⚙️ General Settings:
Temperature Advice:
Use 0.2 – 0.5 for literal, prompt-loyal results.
Use 0.8 – 1.2 for creative variety and unexpected descriptions.
Max Tokens Advice:
Low (50–150): Perfect for SDXL (Tags) to keep them punchy.
High (100): Necessary for Natural Sentence or
High+ (250+): for Z-Engineer.
*I found this Model and the prompting template so effective that I decided to integrate them directly.
'VibeCoded' I'll try my best, or you can always ask Gemini or ChatGPT.