Nodes/ComfyUI_GLM4Node/💬GLM4_Vsion_IMGURL
ComfyUI Node

💬GLM4_Vsion_IMGURL

Show GLM-4 a picture and get a prompt back — but the image has to live on the internet

By JcandZero·Created 3 years ago·Updated 2 years ago· 31
💬GLM4_Vsion_IMGURL
    • GETPrompt
    prompt先理解这个图片上面的内容,然后生成描绘主体对象的[[英文]]短语,语言是english。生成规范是,记住你需要描绘我提供给你的图片细节尽可能的多,角度尽可能更加丰富,多写[逗号‘,']相连接的英文短语,切记一定需要在生成的prompt文本当中中添加下面这堆prompt,[[best quality, high resolution, 4k, high quality]],描绘人称都用第三人称
    image_urlhttps://pic1.zhimg.com/v2-5f79c0d9466907a2227200620140835c_r.jpg
    model_name
    api_keyYour_ZHIPU_API_KEY

    This is the interesting node in the pack. GLM4_Vsion_IMGURL takes an image URL plus your instruction, sends both to Zhipu's glm-4v vision model, and returns the model's text. The author's intended use is right there in the default prompt: caption a reference image into an English, comma-separated prompt for your diffusion model - "best quality, high resolution, 4k" tags and all. It's a quick-and-dirty LLM captioner inside ComfyUI, no local model required.

    How it works

    The node builds one user message with two parts - a text block (your prompt) and an image_url pointing at the image - and calls chat.completions.create against glm-4v. The model reads both, and its reply comes out the GETPrompt output as a string. Clean and simple, as long as you respect the one big constraint below.

    The gotcha that burns everyone

    The image must be at a public URL. The README is explicit: base64 upload to GLM-4 was too slow, so "we temporarily support uploading via URL." "Temporarily" was written in January 2024, and the pack hasn't been touched since February 2024 - so it's still URL-only, and probably always will be.

    What that means in practice: this node can't see your local files, and it can't see what's already sitting in your ComfyUI graph. You have to host the image somewhere public - imgur, a GitHub raw link, any static host - and paste the URL. A file:// path or a locally loaded image won't work. That's the thing that trips up everyone on their first try, because the node doesn't look like a web tool; it just is one.

    The inputs that matter

    Four required fields:

    • prompt (multiline STRING) - your instruction. The shipped default is Chinese and reads like an SDXL-captioning spec: describe as many details as possible, write English comma-phrases, add [[best quality, high resolution, 4k, high quality]], third person. You can replace it with anything - "write a negative prompt for this image", "describe the lighting and composition", whatever the job needs.
    • image_url (STRING) - the public URL of the image. This is the field that defines the node.
    • model_name - locked dropdown, glm-4v only.
    • api_key - your Zhipu key, defaulting to the pack's config.json placeholder.

    Output: GETPrompt (STRING) - the model's caption or answer. Feed it into your positive prompt, or into a text input that leads toward the encoder.

    Two honest caveats

    The default prompt is tuned for the SDXL/anime tag dialect, where the best quality boilerplate is still alive and doing something. If you're targeting a newer LLM-encoded model, that tag list is mostly inert - rewrite the prompt for what you're actually feeding.

    And every run is one API call that sends your image off your machine. If you caption a handful of images, fine. If you caption hundreds, the cost adds up and your images are leaving the building. The local GLM-4 wrapper route (running glm-4v-9b on your own GPU) is the free and private alternative; this node is the wire-it-in-now choice.

    Install

    The whole pack installs at once - all three nodes ship in one repo:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JcandZero/ComfyUI_GLM4Node
    cd ComfyUI_GLM4Node
    pip install -r requirements.txt   # just installs `zhipuai`
    

    Or via ComfyUI Manager: search "GLM4Node", install, restart. The node lands in the BlinkNodes_PROMPT category. No model downloads, no VRAM - just a Zhipu API key, internet, and a publicly reachable image. And remember the README's warning: the key in the author's demo video is dead, so get your own.

    CategoryBlinkNodes_PROMPT

    Inputs (4)

    NameTypeDefaultDescription
    promptSTRING先理解这个图片上面的内容,然后生成描绘主体对象的[[英文]]短语,语言是english。生成规范是,记住你需要描绘我提供给你的图片细节尽可能的多,角度尽可能更加丰富,多写[逗号‘,']相连接的英文短语,切记一定需要在生成的prompt文本当中中添加下面这堆prompt,[[best quality, high resolution, 4k, high quality]],描绘人称都用第三人称
    image_urlSTRINGhttps://pic1.zhimg.com/v2-5f79c0d9466907a2227200620140835c_r.jpg
    model_nameCOMBO1 options: glm-4v
    api_keySTRINGYour_ZHIPU_API_KEY

    Outputs (1)

    NameTypeDescription
    GETPromptSTRING