Local LLM Prompt Enhancer:
LocalLLMPromptEnhancer helps you develop image-generation prompts with a local GGUF language model while preserving your original wording. You can request a rewrite manually or generate a fresh one during each workflow run. It also keeps an editable collection of enhanced prompts, so you can compare alternatives and choose which one to send downstream. With a suitable vision-capable local model, it can use still images or video as visual references. The node uses the persistent Local LLM service, allowing repeated enhancement requests to use the same service rather than treating each rewrite as an unrelated model setup.
Local LLM Prompt Enhancer Input Parameters:
prompt
Your original prompt. This required, multiline text field defaults to an empty string. Enhancement does not replace the text in this field: it remains your source wording even when the node produces a revised version. The ↑ control lets you explicitly copy the active enhanced prompt into it. If you select a saved prompt_preset, that preset’s text is used as the effective source prompt instead.
enhanced_prompt
The editable enhanced prompt currently shown in the node. This required, multiline text field defaults to an empty string. It represents the active entry in your stored prompt collection; you can browse entries with ← and →, delete the active entry with ×, or restore the last collection edit with Undo. When workflow enhancement is off, the selected stored entry is normally sent downstream. If that entry is blank, the node falls back to the source prompt.
prompt_set
Selects a named saved set of enhanced prompts. Its options are the available saved-set names plus the default no-set option; the exact names depend on what has been saved in your installation. Selecting a set loads its prompts and active entry, while Save Prompt Set stores the current collection and refreshes the selector. This helps you keep groups of alternatives for different projects or styles.
prompt_cycle
Controls how the stored enhanced-prompt collection advances across normal workflow runs when enhance_with_workflow is off. Options are fixed (default), increment, decrement, shuffle, and random. Fixed keeps the selected entry; increment and decrement move through the collection with wraparound; shuffle avoids repeats until its bag is exhausted; and random chooses freely. Cycle selection applies to stored prompts—it does not ask the LLM to write a new prompt.
overwrite_enhanced
Controls where a newly generated enhancement is stored. This required Boolean defaults to False: the new prompt is added to the collection and made active. Set it to True to replace the active entry instead. Choose the default when exploring alternatives, or enable overwrite when refining one prompt without growing the collection.
enhancement_preset
Selects an enhancement-instruction template and loads its text into the editable enhancement_text field. The available options come from installed protected or user templates, so their exact labels can vary; the default is the configured default template, or the first available label if that template is absent. Selecting a preset changes the instructions you can review and edit, rather than directly replacing your source prompt.
enhancement_text
Instructions sent to the local LLM to guide the rewrite. This required, multiline text field defaults to the text of the selected default enhancement template, or an empty string if that template has no text. It is used when you click Enhance or enable enhance_with_workflow. You can edit it for a particular task; edits remain local until you save them as a template.
seed
The seed used for manual and workflow-triggered enhancement. This required integer defaults to 0 and ranges from 0 to 18446744073709551615. Changing it gives you control over the seed supplied to enhancement requests, although the resulting text also depends on the model and its settings. This node owns the seed even when a settings node is connected. Prompt Cycle’s random and shuffle choices use separate randomness.
enhance_with_workflow
Determines whether an ordinary workflow run generates a new enhancement. This required Boolean defaults to False. When enabled, the node sends the effective source prompt, enhancement instructions, seed, and any connected visual references to the local LLM and outputs the fresh rewrite. When disabled, it does not generate a new rewrite during normal execution; it outputs the selected stored enhanced prompt instead, with prompt_cycle controlling selection.
prompt_history_json
Stores the enhanced-prompt collection as a JSON-formatted string. This required field defaults to []. It allows the node to retain multiple prompt alternatives for browsing and cycling; it is normally maintained by the node’s interface rather than edited directly. If the stored value is missing or invalid, the node treats it as an empty collection and can use the visible enhanced_prompt as an entry.
prompt_history_index
Identifies the active position in the stored enhanced-prompt collection. This required integer defaults to 0, with a minimum of 0 and a maximum of 2147483647. It is principally interface state: in fixed mode, the node uses this position to choose the prompt for the current queued run. The interface’s browsing controls are a safer way to change it than editing the number directly.
prompt_preset
Selects reusable source-prompt text shared with Local LLM Generate. Options are Custom (default) and the names of available saved prompt presets. Custom uses the text in prompt; a saved preset uses its stored text as the effective source prompt. Editing Prompt switches the selector back to Custom. The original Prompt field is not rewritten by enhancement.
prompt_cycle_revision
Optional prompt-cycle metadata, defaulting to 0 with a range of 0 to 2147483647. It accompanies cycle state in the node’s interface updates but is not the prompt text or the counter that selects a stored entry. It is retained for compatibility with saved workflows; you normally do not need to edit it.
prompt_shuffle_json
Optional JSON-formatted cycle transport field, defaulting to []. It can carry queue-time information about which entry the interface should display next. Selection for the current queued run does not depend on this transport: that run’s selected state is already frozen when queued. Leave it under interface control unless you are maintaining a workflow integration.
prompt_state_id
Optional internal identifier for this enhancer instance, defaulting to an empty string. Together with prompt_runtime_scope, it helps keep pending manual requests and runtime history associated with the correct live workflow. Older workflows can omit it and still execute, but workflow-scoped background state is unavailable without both identifiers.
prompt_runtime_scope
Optional internal identifier for the live workflow or browser session, defaulting to an empty string. It works with prompt_state_id to prevent pending enhancement state from being shared across different workflows that happen to have similar node identifiers. The frontend supplies it when a workflow is mounted; a value saved in an imported workflow image is not treated as authoritative.
prompt_cycle_queue_seq
Optional legacy queue-diagnostic integer, defaulting to 0 with a range of 0 to 2147483647. It remains available for compatibility with older workflows, but native Prompt Cycle no longer uses it to choose an entry. Changing it is not a way to advance the prompt collection.
prompt_cycle_epoch
Optional integer recording deliberate edits to prompt-cycle state, defaulting to 0 with a range of 0 to 2147483647. It helps distinguish intentional changes to the prompt collection, selected entry, or cycle mode from routine interface updates. It is interface metadata, not a prompt-generation setting, and normally needs no manual adjustment.
prompt_cycle_counter
Optional internal counter used to select a stored prompt in non-fixed cycle modes. It defaults to 0 and ranges from -2147483647 to 2147483647. For a queued run, the node maps the counter to an entry by wrapping it around the collection length; ComfyUI’s control-after-generate behavior can advance the counter between queued runs. The interface manages its value according to the chosen cycle mode, so use prompt_cycle rather than editing this counter to control normal cycling.
images
Optional IMAGE input for a still image or image batch used as a visual reference during enhancement. It affects newly generated rewrites, whether requested manually or through workflow enhancement; it does not change which stored prompt is selected in a passive workflow run. The manual Enhance control partially executes the node so a connected image is available to the request. Use a suitable vision-capable local model if you want the model to interpret the visual content.
video
Optional VIDEO input for a native ComfyUI video reference. During enhancement, frames are extracted and passed to the Local GGUF service according to its current vision-frame sampling limits. It can help ground a new prompt in visual material, but has no role in selecting an already stored prompt. Video interpretation requires an appropriately configured vision-capable model.
settings
Optional LOCAL_LLM_SETTINGS input supplying sampler, vision-limit, and runtime values to enhancement requests. Use it to tune how the local model generates text or handles visual references. The Prompt Enhancer’s own seed remains authoritative: connecting settings does not override it. When workflow enhancement is off and no manual request is pending, the node selects a stored prompt rather than asking the model to generate one.
Local LLM Prompt Enhancer Output Parameters:
enhanced_prompt
The text to use as the enhanced prompt downstream. A manual Enhance request outputs the last prompt generated in that request; workflow enhancement outputs its newly generated rewrite. With enhancement disabled, it outputs the selected entry from the stored collection. If that entry is blank or no usable enhanced entry exists, it falls back to the effective source prompt, so this output can still contain text when no rewrite has been produced.
prompt
The effective original or source prompt, provided separately so you can retain or route your starting wording alongside the enhancement. It is the text entered in prompt when prompt_preset is Custom, or the selected saved prompt preset’s text when one is available. Enhancement does not turn this output into the revised prompt.
Local LLM Prompt Enhancer Usage Tips:
- Start with a short source prompt, choose an enhancement template, and read
enhancement_textbefore clicking Enhance. Edit the instructions if you want the rewrite to emphasize particular details, then save a user template if you want to reuse them. - Leave
overwrite_enhancedoff while exploring variations so each result becomes a separate entry. Turn it on when you want each new result to refine or replace the currently active entry. - Keep
enhance_with_workflowoff when you have already chosen a prompt and want normal workflow runs to reuse it without another LLM request. Usefixedfor one consistent choice, or a cycle mode to send different stored entries across runs. - Enable
enhance_with_workflowwhen each run should create a fresh rewrite. Setseedon this node to control the seed supplied to those requests; connectingsettingswill not replace it. - Connect
imagesorvideowhen visual references matter, and use a vision-capable local model. For video, adjust applicable vision limits throughsettingsif you need to control frame sampling. - Use
prompt_presetfor reusable starting text andprompt_setfor reusable collections of enhanced text. They serve different purposes and can be used together. - Avoid hand-editing the JSON and internal cycle fields during ordinary use. The node’s prompt browsing, cycle selector, and ComfyUI queue controls maintain the state needed to select the intended entry.
Local LLM Prompt Enhancer Common Errors and Solutions:
Seed must be an integer.
- Explanation: The enhancement request received a seed that cannot be converted to a whole number.
- Solution: Enter a whole number in
seedand remove any letters, decimal points, or other nonnumeric characters from values supplied through an API or custom workflow.
Seed must be between 0 and 18446744073709551615.
- Explanation: The supplied seed is negative or exceeds the supported range.
- Solution: Set
seedto a whole number from0through18446744073709551615.
The Local LLM produced reasoning but no final prompt text. Review Thinking Mode, max tokens, or stop sequences.
- Explanation: The model returned reasoning content, but no usable final enhanced prompt.
- Solution: Review Thinking Mode and the generation settings supplied to the local LLM. Allow enough output tokens for a final answer, and check that stop sequences do not end generation before the prompt is written.
The Local LLM returned an empty prompt.
- Explanation: An enhancement request finished without usable prompt text.
- Solution: Check that your source prompt and enhancement instructions give the model a clear rewriting task. Then review the connected model and generation settings, including output length and stop sequences, before trying again.
Could not load prompt preset
- Explanation: A selected saved source-prompt preset could not be loaded. The node logs a warning and falls back to the text in
prompt. - Solution: Select
Customto use the visible Prompt field, or restore and reselect the saved preset. Check the application log for the specific loading error.
Could not enumerate shared prompt presets
- Explanation: The node could not retrieve the list of saved source-prompt names, so those choices may be missing from the selector.
- Solution: Check the application log for the underlying error and verify that the shared prompt-preset storage is accessible. You can continue with
Customand enter text directly inprompt.
Enhanced prompt is the same as the source prompt
- Explanation: This is not necessarily an error. With workflow enhancement off, a blank or unavailable selected enhanced entry causes the output to fall back to the effective source prompt.
- Solution: Generate an enhancement, select a nonblank stored entry, or enable
enhance_with_workflowif you want a new rewrite on each run.
Visual reference does not appear to affect the rewrite
- Explanation: Connected media is used for new enhancement requests, not for choosing an existing stored prompt. Visual interpretation also depends on the model and its vision configuration.
- Solution: Click Enhance or enable
enhance_with_workflow, confirm the media connection, and use a suitable vision-capable local model. For video, review the vision-frame limits in your settings.
