glm prompt
Have an LLM write your Flux prompt, inside the graph
- clip-L
- clip-T5
Type "a rainy Tokyo street at dusk, photorealistic" into GlmPromptNode (display name "glm prompt") and it sends that to Zhipu's GLM chat API, then hands you back two finished prompt strings split exactly the way Flux wants them: one for CLIP-L, one for T5-XXL. LLM-assisted prompting as a node in your graph, no browser tab required. Zhipu is the same Tsinghua spin-off behind CogVideoX and GLM, and this one needs no local model and no VRAM - the model runs on Zhipu's servers, so all you need is internet and a key.
Why you'd reach for it
Prompt-writing nodes went from "emerging practice" to standard equipment - the community converged on having an LLM translate a plain desire into a well-structured prompt rather than hand-tweaking a wall of text. This node does that translation inside ComfyUI, and it knows the Flux trick that trips people up: Flux doesn't take one prompt, it takes a CLIP-L sentence and a separate T5-XXL description. GlmPromptNode returns both, pre-split.
How it works
It calls ZhipuAI.chat.completions.create with your prompt and a built-in system persona (in Chinese, from the author) telling the model it's a Flux prompt builder for photorealistic images that must reply with JSON containing three fields: theme, clip-L (style description), and clip-T5 (detailed content). The node strips the markdown fences, json.loads the reply, and outputs the two strings.
The inputs
prompt(required, multiline) - what you actually want, natural language is fine.model(enum, defaultglm-4-flash) - eight GLM options;glm-4-flashis the free tier.max_tokens(INT, 128–4096, default 1024) - cap on the reply length.system(optional, multiline) - replaces the built-in persona. Handy if you want a different style, but the node still expectsclip-Landclip-T5keys in the JSON.
Outputs
clip-L(STRING) - wire into theclip_linput of a FluxCLIPTextEncodeFluxnode.clip-T5(STRING) - wire into that node'st5xxlinput (it takes its dual clip fromDualCLIPLoader).
The gotchas, in order
- Free model, not no key.
glm-4-flashcosts nothing to run, but you still register at open.bigmodel.cn and paste your API key intoconfig.jsonin the plugin folder. The shippedconfig.jsonhas an emptyCHATGLM_API_KEY, so it errors ("please set CHATGLM_API_KEY in Config.json") until you do. This is step one for everyone. - It's a live API call. No internet, no output - and each run ships your prompt off to Zhipu. If you're privacy-sensitive about prompts, this isn't the tool.
- JSON parsing is the fragile bit. The whole node rests on the model returning valid JSON.
json_repairsits in the pack's requirements, which suggests the author planned for the model occasionally mangling the reply - but the shipped code does strictjson.loads, so a malformed response raises. Retry, or tighten the system prompt if you keep hitting it. - It's Flux-flavored. The outputs are literally named after Flux's encoders. On SD1.5/SDXL you'd only use
clip-L, and honestly a tag-oriented LLM does that job better.
Install
ComfyUI Manager (search "SimpleToolsNodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/Mcmillian/ComfyUI-SimpleToolsNodes.git
Then run install.bat on Windows (it targets portable and Aki installs, else system pip) - on Linux/Mac just pip install -r requirements.txt into your ComfyUI env - and restart. The only real dependency is the zhipuai SDK; no models to download. Then open config.json in the plugin directory and drop in your key.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| model | COMBO | glm-4-flash | 8 options: glm-4-flash, glm-4, glm-4-flashx, glm-4-plus, glm-4v-plus, glm-4-0520, +2 |
| max_tokens | INT | 1024128–4096 | — |
| systemopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| clip-L | STRING | — |
| clip-T5 | STRING | — |