ChatGLM-4 Instruct Media Node
Ask a vision LLM what's in your image
- image
- STRING
ChatGLM4InstructNode's sibling, but for images instead of text: feed it a picture, ask it a question about what's in it, and get a text answer back. This is a vision-language model call - the same category of tool as image captioning nodes, but conversational rather than fixed-format, since your question is a free-text field rather than a hardcoded "describe this image" template.
Why you'd reach for it
The obvious use is auto-captioning - feed it a training image and get a caption to seed a LoRA dataset, or describe a reference image so you can feed that description into a text-to-image prompt elsewhere in your graph. But because the instruct field is freely editable, you can ask more specific questions than a generic captioner would answer: "what's the lighting direction in this image," "describe only the clothing," "is there text visible, and what does it say." It's a general visual-QA tool wearing a captioning-shaped default.
How it works
Your image and instruction text go to one of Z.ai's GLM vision models - the -v (vision) variants of the GLM line, distinct from the plain text glm-4.5-flash used by the other ChatGLM nodes in this pack. The model looks at the image, follows your instruction, and returns a text response.
The inputs and outputs that matter
instruct(default: "What is shown in the picture?") - your question or instruction about the image, multiline. This is the field to edit for anything beyond a generic description - be as specific as you need.image(optional, IMAGE) - the image to analyze. It's technically optional in the schema, but without one, there's nothing for a vision model to describe, so in practice you'll almost always wire something in here.model(defaultglm-4.6v-flash) - 10 choices, all vision-capable GLM variants (glm-4v-flash,glm-4v,glm-4.1v-thinking-flash,glm-4.5v,glm-4.6v, and others, plusautoglm-phone). The-thinkingvariants reason more before answering - worth trying if you're asking something that needs actual analysis (counting objects, spatial relationships) rather than a straightforward description.max_tokens(default 1024),temperature(default 0.8),top_p(default 0.6) - standard sampling controls, tuned slightly more conservative than the text-onlyChatGLM4InstructNode's defaults, appropriate for descriptive rather than creative output.
Output is a single STRING - wire it to a PreviewTextNode, a CLIP Text Encode, or a caption file writer elsewhere in your pipeline.
How to install it
Via ComfyUI Manager: search "ComfyUI Custom Nodes AlekPet" and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet
Restart ComfyUI. You'll need a Z.ai (Zhipu) API key configured - check the ChatGLMNode subfolder in the repo for exactly where it goes, since the top-level README doesn't cover per-node setup. Note this node needs a vision-capable API key/access on Z.ai's platform specifically - the same account that works for the plain-text ChatGLM nodes should cover it, but the model list here is a different (vision) family from the text-only GLM models.
Common issues & troubleshooting
Authentication or model-not-found errors even though your text-based ChatGLM nodes work fine. Double check you're selecting one of this node's vision models (glm-4v-*, glm-4.6v-*, etc.) - these are a distinct model family from the plain glm-4.5-flash/glm-4-plus models the text nodes use, and not every API key tier necessarily has every model enabled.
No image connected, and the node either errors or answers a generic non-answer. image is optional in the schema, but the whole point of this node is analyzing an image - if you're not feeding one in, you'll get whatever the model does with an unanswerable question, which is not useful. Wire an IMAGE in.
Description is too generic or misses the detail you actually wanted. Rewrite instruct to be specific - "what is shown in the picture" is a fine default but a bad instruction if you actually need, say, just the color palette or just the pose. Vision LLMs generally follow narrow, explicit questions better than they infer what you actually wanted from a broad one.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | glm-4.6v-flash | The model code to be called. Models with text 'flash' should be free! |
| max_tokens | INT | 1024 | The maximum number of tokens for model output, maximum output is 4095, default value is 1024. |
| temperature | FLOAT | 0.800–1 | Sampling temperature, controls the randomness of the output, must be a positive number within the range: [0.0, 1.0], default value is 0.95. |
| top_p | FLOAT | 0.600–1 | Another method of temperature sampling, value range is: [0.0, 1.0], default value is 0.7. |
| instruct | STRING | What is shown in the picture? | Enter the instruction for the neural network |
| imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |