Nodes/Text Gen Nodes/Prompt Enhancer
ComfyUI Node

Prompt Enhancer

Hand your rough prompt to any chat model

By cora-clanker·Created 4 months ago·Updated 3 months ago· 1
Prompt Enhancer
    • text
    text
    style
    model

    The honest pitch: Prompt Enhancer is a wrapper around one HTTP POST to any OpenAI-compatible chat endpoint. It downloads no model, needs no key baked into your workflow file, and "the AI" is whatever you point it at - OpenAI, Ollama, LM Studio, llama.cpp, vLLM, you name it. You type a rough prompt, pick a style and a model, and get back a rewritten version with reasoning-model noise stripped.

    That part matters more than it sounds. The models people run locally (DeepSeek R1-class, QwQ, various -thinking builds) emit their chain of thought wrapped in <think>…</think> tags, and a raw completion will happily ship that straight into your KSampler. This node strips them - balanced, dangling, or truncated - before the text goes anywhere.

    Why bother with an LLM rewriting your prompts at all? Because the whole game has shifted: your diffusion model's text encoder is increasingly a general-purpose LLM reading your prompt as a chat turn, so having an LLM write the instruction is a translation between two things that speak the same language - now one of the most common prompt workflows in the community. The catch, which this node handles nicely, is that tag-based models still need explicit instruction to emit comma-separated booru-style tags rather than sentences. The seeded "Stable Diffusion" style does exactly that, and it's refreshingly opinionated: no masterpiece, 8k filler unless you ask for it, densest information first. The "Flux" style flips to natural-language prose. Both are YAML files under user/default/coras_textgen/prompts/prompt_enhancer/ - edit them or add your own; existing files are never clobbered.

    The inputs that matter

    Three inputs, two of them dropdowns:

    • text (multiline) - the draft prompt you want rewritten. This is your input; everything else is flavor.
    • style - which system prompt gets sent. Seeded with Stable Diffusion and Flux; edit the YAML files to tune behavior.
    • model - populated from the endpoint's /models route, so it lists whatever your server actually serves.

    The output is a single text string, <think>-stripped and whitespace-trimmed. Wire it into your positive-prompt text encoder, or into Refine Text (the pack's third node) if you plan to hand-edit it.

    How it works

    On run, the node posts your text plus the style's system prompt to <api_base>/chat/completions at the temperature set in Settings. The model and style dropdowns are populated by two small server routes (/coras_textgen/models, /coras_textgen/prompt_styles/prompt_enhancer) that proxy the endpoint's /models and read your YAML files. Endpoint, key, temperature, and timeout all come from ComfyUI's Settings → Cora's Textgen panel, not from the node.

    Install

    Same for all three nodes in this pack. In ComfyUI Manager, search "Text Gen Nodes" and install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cora-clanker/comfyui-textgen-nodes
    

    Then restart ComfyUI. Dependencies are a non-event: requests is the only runtime dependency and ComfyUI already bundles it.

    Configuration - the API key gotcha

    Open Settings → Cora's Textgen and set the API Base URL (default https://api.openai.com/v1) and API Key. This is the one real trap in the pack: the key has no default, and ComfyUI only writes a setting to disk after you change it once. So actually enter the key, or set CORAS_TEXTGEN_API_KEY for headless/Docker, or the node fails with a clear "No API key configured" error. The key lives in your local settings file, never in the workflow JSON, which is the right call: it means you can share a workflow without leaking credentials. (Given how much the custom-node scene has been burned on sketchy LLM nodes, a pack that keeps your key out of the workflow and ships nothing but requests is a breath of fresh air.)

    Where people get burned

    • Empty model dropdown. The route returns an empty list on any failure, so an empty dropdown usually means the endpoint is unreachable or the key is missing - check those before blaming the node.
    • No nodes at all after install. This pack targets the Nodes 2.0 (V3) API and needs a ComfyUI build that ships comfy_api.latest. If you're on an older install, you won't see the nodes.
    • Multi-user ComfyUI. Only the default user's settings file is read (env vars aside) - other users aren't supported yet.
    • Expecting magic. The rewrite quality is 100% the model and the system prompt. A tiny local model will produce tiny-prompt results; that's not the node's fault, it's the model's.

    One honest caveat: the same functionality exists in any chat client. What this buys you is the pipeline - prompt in, enhanced prompt out on a wire, no copy-paste between ComfyUI and a browser tab.

    Categorytextgen

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGDraft prompt the model should rewrite.
    styleCOMBOPrompt style. Edit or add YAML files under <user>/default/coras_textgen/prompts/prompt_enhancer/. Replaces the Settings system prompt for this node.
    modelCOMBOModels advertised by the configured endpoint.

    Outputs (1)

    NameTypeDescription
    textSTRING