Eric Qwen Prompt Rewriter
Your terse prompt, upgraded to a Qwen-native 200 words
- enhanced_prompt
Qwen-Image is an instruction-following model - its text encoder is a real LLM, which means it wants sentences, not comma-stuffed tag soup. And like most of the current generation of models, it rewards detail. "A girl on a beach" gets you a generic picture; a two-hundred-word description gets you your picture. The gap between those is what this node exists to cross.
Eric Qwen Prompt Rewriter takes your rough prompt and has a separate LLM - running locally via Ollama or LM Studio, or remotely via any OpenAI-compatible API - expand it into a rich ~200-word description using Qwen-Image-2512's own recommended prompting methodology. Output is a single enhanced_prompt string that plugs straight into the prompt input of any generation node in this pack (UltraGen, Multi-Stage Generate, or the plain Generate node).
The smart bits
Two features make it more than a fancy text box:
LoRA trigger words. LoRAs need their trigger phrases in the prompt to activate. Instead of fighting the LLM to keep "ohwx woman" intact, you list triggers in lora_triggers and pick a mode: incorporate has the LLM weave them verbatim into the prose naturally; prepend/append tack them on the ends (and work even in passthrough mode, no LLM call needed).
Clean A/B testing. passthrough skips the rewrite entirely and returns your prompt unchanged, so you can measure whether the enhancement is actually helping your generations instead of trusting the hype.
Other controls are the standard set: language (English/Chinese), temperature, max_tokens (raise it for thinking models like DeepSeek-R1, where reasoning tokens eat the budget), custom_instructions, and model (leave blank to auto-detect what's loaded on your API server).
Inputs & output
Required: prompt (your rough idea) and api_url (defaults to LM Studio's http://localhost:1234/v1; Ollama uses :11434/v1). Optional: everything above. Output: enhanced_prompt (STRING).
Install & gotchas
Pack install: ComfyUI Manager (search "Eric Qwen-Edit") or git clone https://github.com/EricRollei/Eric_Qwen_Edit_Experiments.git into custom_nodes/, restart. No model to download for this node itself - you bring the LLM server. API keys load from environment variables (OPENAI_API_KEY, DEEPSEEK_API_KEY, or ERIC_QWEN_API_KEY) or the pack's api_keys.ini (git-ignored), never from the workflow JSON.
Three things to know before you wire it up:
- If you use long rewritten prompts, raise
max_sequence_lengthon UltraGen. The default 512-token budget silently truncates ~200-word descriptions; UltraGen exposes it up to 1024 with no quality penalty. - The rewrite is a helper, not an oracle. The KB's own warning about LLM-in-graph nodes applies: an enhancer adds detail, and unconstrained it adds detail you never asked for. That's why
passthroughexists. - This is the text-to-image rewriter. The pack has a separate vision rewriter for inpainting that analyzes the image and mask; don't reach for this one when you need the inpaint prompt.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Original image description to enhance | |
| api_url | STRING | http://localhost:1234/v1 | OpenAI-compatible API base URL. Examples: LM Studio: http://localhost:1234/v1 Ollama: http://localhost:11434/v1 DeepSeek: https://api.deepseek.com/v1 OpenAI: https://api.openai.com/v1 |
| modelopt | STRING | Model name override. Leave empty to auto-detect the loaded model from the API server. Ollama: qwen3:8b, llama3.1:8b DeepSeek: deepseek-chat OpenAI: gpt-4o-mini | |
| languageopt | COMBO | English | Language for the rewritten prompt |
| temperatureopt | FLOAT | 0.70–2 | LLM temperature — lower = more faithful, higher = more creative |
| max_tokensopt | INT | 2048256–8192 | Maximum tokens for the LLM response. Set higher for thinking models (DeepSeek-R1) where reasoning tokens consume part of this budget. 2048 is a safe default. |
| custom_instructionsopt | STRING | Optional additional instructions appended to the system prompt. Example: 'Focus on cinematic lighting and dramatic shadows.' Leave empty to use the default Qwen-style rewriting. | |
| lora_triggersopt | STRING | LoRA trigger words or phrases, one per line or comma-separated. These are special tokens that activate LoRA styles or subjects. Example: artdeco style ohwx person watercolor painting, soft edges | |
| trigger_modeopt | COMBO | incorporate | How to add LoRA trigger words to the prompt: incorporate — LLM weaves triggers naturally into the rewritten text prepend — add triggers before the prompt text (no LLM needed) append — add triggers after the prompt text (no LLM needed) off — ignore trigger words entirely |
| passthroughopt | BOOLEAN | false | If True, skip rewriting and pass the prompt through unchanged (for A/B testing). Prepend/append triggers are still applied. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| enhanced_prompt | STRING | — |