Nodes/ComfyUI_DW_Chat/SD Prompt Agent
ComfyUI Node

SD Prompt Agent

Type a theme, get SDXL or Flux prompts back in a couple of seconds (via Groq)

By yiwangsimple·Created 2 years ago·Updated about a year ago· 89
SD Prompt Agent
    • positive_prompt
    • negative_prompt
    model
    theme
    max_tokens1000
    temperature0.7
    prompt_type
    seed-1

    The SD Prompt Agent is the marquee prompt-writer of the ComfyUI_DW_Chat pack (yiwangsimple/ComfyUI_GroqChat). You type a theme, it calls Groq's cloud API, and a second or two later you've got a ready-made positive/negative prompt pair formatted for SDXL, Kolors, or Flux. The pack's README claims ~2 second turnarounds, and that's Groq's whole selling point - their LPU hardware runs llama-class models fast, and the free tier is generous enough that casual use costs nothing.

    This is "LLM-assisted prompting" turned into a node: an LLM writes the instruction that the image model reads. The KB's prompt-engineering essay tracks that practice exploding over the last few years precisely because it fits the architecture - on LLM-encoded models, a well-written instruction prompt reads as natural input to the encoder. If you want consistent, well-structured prompts without hand-writing them, this is the tool. If you don't want to depend on a cloud API, the pack's Ollama Prompt Extractor is the same idea, local.

    How it works

    It uses the official groq Python client with a big per-mode system prompt (written in Chinese, per the author). The behavior splits by prompt_type:

    • sdxl - the model writes both sides; the node looks for Prompt: / Negative Prompt: in the reply and splits them into the two outputs. This is the only mode where the negative is genuinely model-authored.
    • kolors - a Chinese natural-language prompt with a hardcoded negative ("低质量,坏手,水印").
    • flux - a long English description (the system prompt demands 180+ words) with a hardcoded negative.

    So if you're on Flux, the negative_prompt output is boilerplate, not tailored. The author's own README notes the temperature/top-p advice you'd expect: lower for consistency, higher for creativity.

    Inputs and outputs

    • model - a dropdown of 16 Groq models: gemma-7b-it, gemma2-9b-it, mixtral, llama3-8b/70b, llama-3.1/3.2, llava-v1.5, even llama-guard-3-8b.
    • theme - your subject, in any language; it gets wrapped in a Chinese instruction.
    • prompt_type - sdxl, kolors, or flux.
    • max_tokens (default 1000), temperature (default 0.7), seed (-1 randomizes).

    Outputs are positive_prompt and negative_prompt, wired into your checkpoint's inputs (positive only for Flux).

    Installing it

    The pack, not just this node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yiwangsimple/ComfyUI_GroqChat
    

    Restart ComfyUI (or Manager → search "ComfyUI_DW_Chat"). Then get a free key from https://console.groq.com/keys and drop it in api_key.ini in the pack folder (copy api_key.ini.example.ini and fill GROQ_API_KEY).

    Common issues

    The usual first failure is the key: if it's missing, the node returns an error string instead of prompts - check your api_key.ini and restart ComfyUI after editing it. Second, the model dropdown was frozen in mid-2024, and Groq has since retired some of those preview entries (the llama-3.2-*-preview ones among them); if a model errors out, switch to a current one listed in Groq's console rather than assuming the pack is broken. And keep in mind the hardcoded negatives for Flux/Kolors - if you want model-written negatives, use sdxl mode or patch the system prompt yourself.

    Category🌙DW/prompt_utils

    Inputs (6)

    NameTypeDefaultDescription
    modelCOMBO16 options: gemma-7b-it, gemma2-9b-it, mixtral-8x7b-32768, llama3-8b-8192, llama3-70b-8192, llama3-groq-8b-8192-tool-use-preview, +10
    themeSTRING
    max_tokensINT10001–32768
    temperatureFLOAT0.70–2
    prompt_typeCOMBO3 options: sdxl, kolors, flux
    seedINT-1-1–18446744073709550000

    Outputs (2)

    NameTypeDescription
    positive_promptSTRING
    negative_promptSTRING