Nodes/babydjac Nodes/Flux Dual Prompt Node (Grok)
ComfyUI Node

Flux Dual Prompt Node (Grok)

Flux's Two Text Encoders, Fed by Grok

By babydjac·Created 7 months ago·Updated 5 months ago· 12
Flux Dual Prompt Node (Grok)
    • STRING
    • STRING
    api_key
    ideaA short description of the scene or concept
    modelgrok-3-latest
    temperature0.7

    Flux doesn't read one prompt - it reads two. It sends one string to the CLIP-L encoder and another to T5-XXL, and the standard advice is to feed CLIP a tight comma-separated keyword list while T5 gets flowing natural language. Doing that by hand, twice, for every idea is tedious. Flux Dual Prompt Node (Grok) automates it: you type a loose idea, it calls the xAI API, and hands back two ready-made strings - one for each encoder.

    This is a Grok node from the babydjacNODES pack, built by the solo dev babydjac. The whole pack leans on Grok - the author is upfront that they picked xAI because "you don't have to trick it to produce NSFW" - so expect to pay per call and to have your prompt leave your machine. That's the trade, and it's the same trade every API prompt-enhancer node makes (external-api-nodes.md covers why that trade exists).

    How it works

    The node hits https://api.x.ai/v1/chat/completions with a system prompt that tells Grok to act as a Flux prompt engineer and return a JSON object with two keys:

    • clip_l - a concise, comma-separated keyword list (subject, style, camera, lighting), ~77 tokens max
    • t5xxl - a multi-sentence scene description with foreground, midground, background and photorealism detail

    It parses the JSON and returns both as separate STRING outputs. If Grok returns prose instead of JSON, it falls back to splitting the text on the t5xxl label - which usually works, but is exactly the "LLM hands you chat scaffolding instead of a prompt" failure mode the KB warns about.

    The inputs that matter

    • api_key - required, and unlike some other nodes in this pack it does not fall back to a XAI_API_KEY/GROK_API_KEY env var. This one raises an error if the field is empty. Paste the key from console.x.ai and you're set.
    • idea - your one-line concept. "A cyberpunk street at night in the rain" is plenty.
    • model - defaults to grok-3-latest. The newer grok-4 names exist in xAI's catalog and generally work; no need to change it unless you're chasing a specific model.
    • temperature - 0.7 default; lower it to 0.3–0.5 if you want the same output for the same idea.

    Outputs: two strings, clip_l-style and t5xxl-style. In ComfyUI's Flux workflow they wire straight into the two inputs of a CLIPTextEncodeFlux node (the clip_l and t5xxl sockets). You can also keep one as an override and hand-write the other.

    Install

    ComfyUI Manager → search babydjacNODES, or git clone https://github.com/babydjac/babydjacNODES into ComfyUI/custom_nodes, restart, and hard-refresh the browser. No extra dependencies beyond what ComfyUI ships.

    Troubleshooting

    • "API key is required" - you genuinely need to fill the widget; env vars won't save you here.
    • Slow or flaky runs - each queue run makes a fresh paid API call. There's no caching, so don't re-queue the same idea expecting a free ride.
    • Garbled output - if Grok's answer doesn't contain clip_l/t5xxl markers cleanly, you'll get a ValueError. Bump temperature or rephrase the idea; it's a parsing problem, not a model problem.

    If you already write good dual prompts by hand, this won't beat you - but for rapid idea iteration, not having to think about CLIP-vs-T5 is a real quality-of-life win.

    CategorybabydjacNODES/Prompting/Flux

    Inputs (4)

    NameTypeDefaultDescription
    api_keySTRING
    ideaSTRINGA short description of the scene or concept
    modelSTRINGgrok-3-latest
    temperatureFLOAT0.70–2

    Outputs (2)

    NameTypeDescription
    STRINGSTRING
    STRINGSTRING