Nodes/SDXL Auto Prompter/APNext GPT Mini Generator
ComfyUI Node

APNext GPT Mini Generator

Turn a scrappy idea into a full image prompt with GPT

By dagthomas·Created 3 years ago·Updated 12 days ago· 283
APNext GPT Mini Generator
    • STRING
    input_text
    happy_talktrue
    compressfalse
    compression_level
    posterfalse
    gpt_modelgpt-4o-mini
    seed-1
    randomize_each_runtrue
    custom_base_prompt
    custom_title
    override
    variation_instructionGenerate different creative variations each time while maintaining the core concept.

    You type "girl in a diner, neon" and you want a full, image-model-ready prompt out the other end without alt-tabbing to ChatGPT. That's this node. GptMiniNode (shown in the menu as APNext GPT Mini Generator) sends your scrap to a cheap OpenAI model, wraps it in a prompt-writer system message, and hands back an expanded description you wire straight into a text encoder.

    This is part of a wider shift the community made a while ago: LLM-assisted prompting stopped being a browser tab and became a node. It fits the way modern models actually read a prompt - Flux, Z-Image, Qwen and friends run your text through a general-purpose LLM, so they want a well-structured instruction, not a bag of tags. Having an LLM write that instruction for you is basically a translation between two things that speak the same language. dagthomas (a ComfyUI author who's been shipping prompt tools since the original SDXL Auto Prompter and still turns up in r/comfyui threads) built the whole pack around that idea.

    How it works

    You give it input_text, it calls the OpenAI API with a baked-in "you are a prompt writer" system prompt plus a few style switches, and the model returns prose. It's not doing anything locally - no model on your GPU, just an API round-trip. Which means two things: it needs a key, and every run costs money.

    The switches you'll actually touch:

    • happy_talk (default on) - enthusiastic, flowery phrasing vs. a flatter professional tone. Turn it off if the output reads like ad copy.
    • compress + compression_level (soft / medium / hard) - squeeze the result shorter. Handy, because the model loves to ramble and long prompts hurt you on LLM-encoded checkpoints (attention drifts past ~75-100 effective tokens).
    • poster - reformats toward a movie-poster style. Niche; leave it off unless that's the look.
    • gpt_model - the dropdown carries OpenAI's current lineup (the mini and nano tiers plus the full models). It defaults to a cheap mini model, which is the right call for prompt writing.

    seed and randomize_each_run (on by default) give you a fresh variation each queue, steered by variation_instruction. The optional custom_base_prompt and override let you throw out the built-in system prompt entirely and drive it yourself. The single output is a STRING - run it into a CLIP Text Encode (or your model's equivalent) as the positive.

    Installing it

    ComfyUI Manager is the easy path: search comfyui_dagthomas, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dagthomas/comfyui_dagthomas
    cd comfyui_dagthomas
    pip install -r requirements.txt
    

    Heads up on that requirements.txt - it's not small. One pack covers a dozen providers, so installing it pulls openai, anthropic, google-generativeai, transformers, decord and more, even though this node only needs the openai bit. That's the standard ComfyUI dependency-hell tax; budget a minute and watch for version conflicts with nodes you already have.

    Then the part people forget: set OPENAI_API_KEY as an environment variable before you launch ComfyUI. The node reads it from the environment, not from a field in the graph. No key and it errors at runtime.

    Common issues

    "It works but I got charged." Yeah - every queue is a live API call. It's cheap on a mini model (fractions of a cent per prompt), but a batch of 50 is 50 calls. The author himself flagged the pricier models as "semi-expensive"; stick to mini/nano for prompt writing and save the big ones for when you actually need the quality.

    Empty or error output. Almost always the key. Confirm OPENAI_API_KEY is set in the same shell that started ComfyUI, and that the model name in the dropdown is one your account can actually call - an invalid model name fails at request time, not on load.

    The prompt is too long / too purple. Turn happy_talk off and compress on at medium. On a modern LLM-encoded model, three or four strong concepts beat a 200-word paragraph every time.

    Categorycomfyui_dagthomas

    Inputs (12)

    NameTypeDefaultDescription
    input_textSTRING
    happy_talkBOOLEANtrue
    compressBOOLEANfalse
    compression_levelCOMBO3 options: soft, medium, hard
    posterBOOLEANfalse
    gpt_modelCOMBOgpt-4o-mini6 options: gpt-5, gpt-5-mini, gpt-5-nano, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano
    seedINT-1-1–18446744073709550000
    randomize_each_runBOOLEANtrue
    custom_base_promptoptSTRING
    custom_titleoptSTRING
    overrideoptSTRING
    variation_instructionoptSTRINGGenerate different creative variations each time while maintaining the core concept.

    Outputs (1)

    NameTypeDescription
    STRINGSTRING