ComfyUI Node

PFN Prompt Refiner

An LLM polish pass for whatever prompt you feed it

By zeeoale·Created about a year ago·Updated 2 months ago· 9
PFN Prompt Refiner
    • prompt_out
    • prompt_raw
    prompt_in
    enable_refinetrue
    provider
    refinement_mode
    model
    system_prompt
    hosthttp://127.0.0.1:11434

    PFN Prompt Refiner is the pack's standalone "make my prompt read better" node. It takes any prompt string, sends it through an LLM, and returns a cleaned-up rewrite - with the output forced to be a single usable paragraph and nothing else. No world JSON, no identity system, no pack-specific machinery. Feed it a prompt from anywhere (your own text, another node, a file) and get a polished prompt back.

    The refiner exists because the pack's generator produces long, messy seed text that the author kept wanting to smooth out - so the mechanism got extracted into its own node. The killer detail is the CLEAN_OUTPUT_PROMPT it appends to every system prompt: "return ONLY the final refined prompt, no explanations, no reasoning, no markdown, no hidden thinking tokens, no <think> tags." That's the difference between this and a raw chat endpoint - the node is engineered to kill the chatter that otherwise ruins prompts when you pipe LLM output into a sampler.

    How it works

    refinement_mode picks a default system prompt - subtle (preserve structure, improve clarity), balanced (clarity + visual richness), creative (richer detail and atmosphere), or consistency (keep wording stable, add nothing new). That gets combined with the clean-output rules and sent to your chosen provider: ollama, openrouter, openai, gemini, cohere, or llama_cpp. The response is split into prompt_out (the cleaned rewrite) and prompt_raw (the exact raw model reply, for when you want to see what it really said). If the call fails, it degrades gracefully - prompt_out just becomes your original input and prompt_raw carries the error string. Flip enable_refine off and it's a pure passthrough.

    The inputs that matter

    Just three, really: prompt_in, provider, and refinement_mode. The optional model, system_prompt, and host are worth knowing about - system_prompt overrides the mode's default entirely, and host defaults to http://127.0.0.1:11434 for Ollama (sane default, unlike the generator's hard-coded LAN addresses). Cloud providers read keys from the pack's api_keys.txt.

    Outputs and wiring

    prompt_out (STRING) is the one you use - wire it into a CLIPTextEncode. prompt_raw (STRING) is the debug/verification stream.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/zeeoale/PromptCreatorNode
    

    restart. Same light install as the rest of the pack - no models, just requests (bundled with ComfyUI) plus the optional openai / google-generativeai / cohere packages if you use those providers. Ollama needs no pip package at all.

    The honest take

    This is the most reusable node in the pack because it's the least opinionated - it doesn't care where the prompt came from. The consistency mode is quietly the interesting one for character work: it tells the model to improve clarity while changing nothing about the subject, which is exactly the discipline most LLM prompt-"enhancers" lack (they rewrite your character into someone else and call it creativity). Worth a try on any workflow where an LLM keeps mangling your prompts - the clean-output enforcement alone fixes a huge share of "the model added commentary to my prompt" problems.

    CategoryPFN / Prompt

    Inputs (7)

    NameTypeDefaultDescription
    prompt_inSTRING
    enable_refineBOOLEANtrue
    providerCOMBO6 options: ollama, openrouter, openai, gemini, cohere, llama_cpp
    refinement_modeCOMBO4 options: subtle, balanced, creative, consistency
    modeloptSTRING
    system_promptoptSTRING
    hostoptSTRINGhttp://127.0.0.1:11434

    Outputs (2)

    NameTypeDescription
    prompt_outSTRING
    prompt_rawSTRING