Nodes/AI_Text_Comfyui/Prompt Generator (Auto Step)
ComfyUI Node

Prompt Generator (Auto Step)

A 25-prompt buffet that serves one at a time

By Zch6111·Created about a year ago·Updated about a year ago· 1
Prompt Generator (Auto Step)
    • prompt
    api_keysk-xxx
    model
    num_prompts25
    prompt_input

    If you've ever stared at a blank prompt box with a LoRA loaded and nothing to say, this is the node that talks for you. Prompt Generator (Auto Step) takes a rough idea - "girl, red dress, park, sunset," a loose string, whatever you've got - and turns it into a batch of polished Flux-style prompts. Then, and this is the trick, it doles that batch out one prompt per execution, cycling through it automatically.

    It's the middle child of the AI_Text_Comfyui pack from Zch6111, and its own description is: "Smart prompt generator. Parses input and generates dynamic prompts from structured info." That "parses" is the interesting word - this node doesn't just rewrite, it extracts structure first.

    How it works - two API calls, then free

    The clever part is the pipeline. Run one:

    1. Extract phase. The node sends your prompt_input to the model and asks it to return JSON with six fields: subject, obj, lora_trigger, setting, interaction, style. Low temperature (0.3) so the parse is stable.
    2. Generate phase. It feeds those fields to a second call - temperature 0.88, system prompt is literally "You are a creative prompt engineer for Flux" - and asks for num_prompts line-separated prompts, each one opening with your LoRA trigger.
    3. Serve phase. The batch is cached in the node's in-memory state, keyed on (api_key, model, num_prompts, and a hash of your input). Every execution returns the next line and advances a counter, wrapping around when it hits the end.

    So the real cost is two API calls per unique input, and after that every queue pass just reads the cache. The "Auto Step" in the name is that cycling behavior: queue up 25 generations and each one gets a different prompt without you touching anything.

    Inputs and outputs

    Same four inputs as its sibling node, different defaults:

    • api_key - placeholder sk-xxx; paste a real key or nothing happens.
    • model - gpt-4o / gpt-4 / gpt-3.5-turbo, gpt-4o by default.
    • num_prompts - default 25 (range 1–100). This one comes set high on purpose - it's a buffet.
    • prompt_input - your rough idea, multiline. Keep it loose; extraction is what turns it into structure.

    Output is prompt (STRING), and unlike Smart Input it's a single line per execution - the current step's prompt. Wire it straight into your sampler's positive prompt and run.

    The Flux angle

    The system prompt says it, and it's the right instinct: Flux runs on T5 natural-language prompting, so sentence-structured prompts beat tag soup, and LoRA trigger words work best embedded in a sentence rather than bolted on the front. This node deliberately opens each generated prompt with your lora_trigger field - so if you're feeding it a workflow with a Flux LoRA, fill that bit in and let the model construct the sentence around it.

    Gotchas

    • The batch cache is memory-only. Restart ComfyUI and it's gone - next run makes two fresh API calls. Same if you change any input, even a stray space, because the cache key includes a hash of your prompt.
    • Expect exactly one prompt per execution. If you wanted all 25 lines at once, that's the other node in the pack (Prompt Generator / Smart Input), not this one.
    • Same security caveat as its sibling: the API calls go to openai-api.codejoyai.com:8003, a third-party OpenAI-compatible proxy, not OpenAI's own endpoint. Use a key you're comfortable handing to a relay.

    Install

    No dependencies, no model downloads, nothing to configure beyond the key.

    cd ComfyUI/custom_nodes
    git clone https://github.com/Zch6111/AI_Text_Comfyui
    

    Restart, and Prompt Generator (Auto Step) appears under flux/prompt. Or ComfyUI Manager → search AI_Text_Comfyui → install → restart. Either way it's live in seconds.

    Categoryflux/prompt

    Inputs (4)

    NameTypeDefaultDescription
    api_keySTRINGsk-xxx
    modelCOMBO3 options: gpt-4o, gpt-4, gpt-3.5-turbo
    num_promptsINT251–100
    prompt_inputSTRING

    Outputs (1)

    NameTypeDescription
    promptSTRING