Nodes/SDXL Auto Prompter/APNext Grok Text Generator
ComfyUI Node

APNext Grok Text Generator

Prompt expansion through xAI's Grok models

By dagthomas·Created 3 years ago·Updated 12 days ago· 283
APNext Grok Text Generator
    • STRING
    input_text
    happy_talktrue
    compressfalse
    compression_level
    posterfalse
    grok_modelgrok-beta
    seed-1
    randomize_each_runtrue
    custom_base_prompt
    custom_title
    override
    variation_instructionGenerate different creative variations each time while maintaining the core concept.

    Same job as the GPT and Groq text nodes in this pack, different backend: GrokTextNode (APNext Grok Text Generator in the menu) takes a rough input_text, sends it to xAI's Grok API with a prompt-writer system message, and returns an expanded, image-ready prompt as a STRING. If your OpenAI or Anthropic key is rate-limited, or you just prefer Grok's flavor, this is the same node wearing a different provider hat.

    The reason any of these exist: LLM-assisted prompting became a node instead of a browser tab, because modern image models want a written instruction, not tag soup. dagthomas - the author behind the SDXL Auto Prompter this pack grew out of - built one node per provider so you can swap whichever LLM you have credits for without rewiring the graph.

    How it works

    It's an API client. You give it text, it calls Grok, you get text back. Nothing runs on your GPU. That means it needs a key and it costs money per call. The grok_model dropdown is long and moves fast - it lists the current Grok family (the beta, the 2/3/4 generations, the fast reasoning and non-reasoning variants). For plain prompt writing you don't need a reasoning model; a fast, cheap tier is fine and quicker.

    The style controls are the pack's shared set, so if you've used the GPT node these are identical:

    • happy_talk (on) - enthusiastic vs. neutral tone.
    • compress + compression_level (soft / medium / hard) - trim the output down. Worth using; these models over-write, and overly long prompts actively hurt on LLM-encoded checkpoints.
    • poster - movie-poster formatting, off by default.

    seed, randomize_each_run (on), and variation_instruction give you a different take each queue. The optional custom_base_prompt / override swap out the built-in system prompt when you want full control. One STRING output - wire it into your positive CLIP Text Encode.

    Installing it

    Via ComfyUI Manager, search comfyui_dagthomas, install, restart. Or manually:

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

    That requirements file drags in the whole multi-provider dependency tree (openai, anthropic, transformers, and so on) even though this node only really needs an HTTP client - standard tax for a pack that bundles a dozen backends into one install.

    Then set your xAI key as an environment variable before launching ComfyUI. The README accepts either XAI_API_KEY or GROK_API_KEY; set one. The node reads the environment, not a field in the node.

    Common issues

    No output / runtime error. The usual suspect is the key - make sure XAI_API_KEY (or GROK_API_KEY) is exported in the shell that started ComfyUI, not just in your .bashrc for other terminals.

    "Model not found." The Grok lineup churns; xAI renames and retires models regularly, so a name that was in the dropdown last month may 404 today. Pick a current model, and if you're stuck, edit data/grok_models.json in the pack to match what your account can call (restart after editing).

    It costs more than you expected. Reasoning-tier Grok models are pricier and slower, and prompt expansion doesn't need reasoning. Drop to a fast/cheap variant - you won't see a quality difference on a one-line prompt, and you'll get the answer sooner.

    Categorycomfyui_dagthomas/LLM

    Inputs (12)

    NameTypeDefaultDescription
    input_textSTRING
    happy_talkBOOLEANtrue
    compressBOOLEANfalse
    compression_levelCOMBO3 options: soft, medium, hard
    posterBOOLEANfalse
    grok_modelCOMBOgrok-beta11 options: grok-beta, grok-2-1212, grok-2-vision-1212, grok-2-public-beta, grok-2-image-1212, grok-3, +5
    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