Nodes/CornmeisterNL PowerPack/Power Prompt Builder
ComfyUI Node

Power Prompt Builder

Let GPT-5 write the prompt; you keep the taste

By Cornmeister·Created 8 months ago·Updated 8 months ago· 0
Power Prompt Builder
    • TEXT
    base_prompt
    instructions
    modelgpt-5.1
    custom_model
    temperature0.70
    max_output_tokens900
    force_clean_outputtrue
    api_key_override

    This is the one node in the CornmeisterNL PowerPack that actually calls out to the internet and costs you money. Power Prompt Builder takes a base idea plus some instructions and uses the OpenAI Responses API to expand it into a finished image prompt. If you've been writing prompts by hand for the new generation of models - where your prompt is a chat instruction to an LLM-based text encoder rather than a bag of tags - this is a way to hand the busywork to a bigger LLM and keep the direction to yourself.

    Why it's useful right now: prompting changed. On Z-Image, Flux, and the other LLM-encoded stacks, structured natural-language prompts beat comma soup, and that's exactly the kind of writing a frontier model is good at. The README pitches it for "Z-Image / cinematic prompt styles," which checks out - descriptive block-style prompting is where those models shine. Give it "moody cyberpunk alley, rain, neon" plus some instructions, and it returns a fleshed-out prompt you then feed to a normal CLIP Text Encode.

    How it works

    Mechanically it's a thin wrapper over the OpenAI Responses API. It POSTs your base_prompt as the user message and instructions as the system message to api.openai.com/v1/responses, with the selected model, temperature, and max_output_tokens. The key comes from the OPENAI_API_KEY environment variable, or from the optional api_key_override field if you'd rather type it in. If neither exists, it raises an error rather than silently doing nothing.

    The force_clean_output toggle (on by default) appends "Return ONLY the final image prompt text. No explanations, no bullet points, no markdown, no code fences" to your instructions - the difference between a usable prompt and a ChatGPT essay. The response text gets extracted and handed to you as a single string.

    Inputs that matter

    • base_prompt - your rough idea. The seed of what you want.
    • instructions - how to behave: style guidance, "add cinematic lighting," "make it more detailed," whatever you'd tell a human assistant.
    • model - defaults to gpt-5.1; the dropdown offers the GPT-5.x family (chat-latest, base, pro, mini, nano) plus custom..., in which case custom_model lets you type any model name.
    • temperature (0–2, default 0.7) and max_output_tokens (default 900) - the standard LLM knobs. Lower temperature for consistent, predictable rewrites.
    • force_clean_output - keep it on unless you actually want prose back.

    Output: TEXT (STRING) - straight into a CLIP Text Encode.

    Install

    It ships in the CornmeisterNL PowerPack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cornmeister/ComfyUI-CornmeisterNL-PowerPack.git
    

    Restart ComfyUI, or use ComfyUI Manager → search "CornmeisterNL PowerPack". The pack itself only needs requests and Pillow, but this node additionally needs an OpenAI account and API key - set it with:

    export OPENAI_API_KEY=sk-...
    

    before launching ComfyUI (or use api_key_override on the node).

    Where people get burned

    • "Missing OpenAI API key" - the most common error, and it's exactly what it says. Set the env var or use api_key_override. This is also the one node in a pack that otherwise promises "never break execution": it's a network call, so it will fail loudly if there's no key, no network, or the API errors.
    • It costs money and adds latency. Every run is a paid API call. It's not for batch-queuing hundreds of images with a different prompt each - you'll notice the bill and the wait.
    • Empty response - the node raises if the API returns nothing useful; bump max_output_tokens or switch models.
    • The generated prompt still needs your taste. A strong base_prompt and good instructions are 90% of the result. If the output is generic, that's the input's fault, not the node's.

    The honest take: this is a convenience node for people who like LLM-assisted prompt writing and already pay for an API. If you'd rather not hand your prompt generation to OpenAI, skip it - the rest of the pack works fine without it.

    Category⚡ CornmeisterNL/PowerPack/Text

    Inputs (8)

    NameTypeDefaultDescription
    base_promptSTRING
    instructionsSTRING
    modelCOMBOgpt-5.17 options: gpt-5.2-chat-latest, gpt-5.2, gpt-5.2-pro, gpt-5.1, gpt-5-mini, gpt-5-nano, +1
    custom_modelSTRING
    temperatureFLOAT0.700–2
    max_output_tokensINT90016–8192
    force_clean_outputBOOLEANtrue
    api_key_overrideoptSTRING

    Outputs (1)

    NameTypeDescription
    TEXTSTRING