Nodes/ComfyUI-ZML-Image/ZML_LLM 模型加载器
ComfyUI Node

ZML_LLM 模型加载器

The API key box that starts every ZML LLM workflow

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_LLM 模型加载器
    • 模型配置
    api_urlhttps://api.deepseek.com
    api_key
    model_iddeepseek-chat

    Every ZML LLM workflow starts here, because this is where you tell the pack which model to talk to and hand over the key. ZML_LLM_ModelLoader has exactly three text fields and one output - there's no real mechanism to explain, which is the point: it's the configuration box, and it's designed so a beginner can't get it wrong.

    The three inputs:

    • api_url - the base URL of an OpenAI-compatible API, defaulting to https://api.deepseek.com. The tooltip calls it "LLM API Base URL," which is the right mental model: this is the endpoint, not a model name. DeepSeek, OpenAI (https://api.openai.com/v1), a local vLLM server, a proxy - anything speaking the OpenAI dialect works. The node even sanitizes the URL character-by-character before storing it, so stray spaces or paste artifacts don't silently break the request.
    • api_key - your sk-... key. Empty means the request fails at the API with an auth error.
    • model_id - the model name, default deepseek-chat. This is what gets sent as the model field.

    Output: a single 模型配置 (LLM_MODEL_CONFIG) wire that you plug into ZML_LLM_Chat's model_config input. That custom type is just a little dict - api_url, api_key, model_id, preset_name - traveling down one wire, so a whole graph needs exactly one place to change providers.

    Why choose this over the V2 loader? Convenience. This version keeps everything in the node widget, so you can type a key and be running in ten seconds. But there's a real privacy catch: the key is stored inside the workflow. Save that workflow as a JSON, share the PNG, and your key rides along in the embedded metadata. The KB's metadata doc is blunt about this - the workflow is the file, and posting a PNG is posting your config. That's precisely why the author built ZML_LLM_ModelLoaderV2, which reads keys from a local JSON file instead of the workflow (worth reading; it's the sharing-safe path). For your own personal workflows, this one is perfectly fine - just don't paste a workflow with a live key into a Discord help channel.

    Where beginners trip: assuming the API key is optional or that the node "loads a model." It loads nothing - there's no download, no VRAM, no local weights. The name says "loader" but it's a config box for a remote service. If you expected an Ollama-style local model, this isn't it; the pack's LLM set is API-first.

    One nice detail hidden in the code: if you leave api_url slightly malformed the node still cleans it up rather than exploding. So the failure modes are almost all downstream - wrong key, model name the provider doesn't serve, or a base URL that's actually a web page. When Chat returns an error string, read it before touching the graph; it usually names the exact field.

    Install is pack-standard:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zml-w/ComfyUI-ZML-Image
    

    Manager search "ComfyUI-ZML-Image" also works, and it'll pull the openai requirement from requirements.txt. Restart, find it under ZML 图像 → LLM, and remember the UI is Chinese unless you apply the author's English translation patch.

    Categoryimage/ZML_图像/LLM

    Inputs (3)

    NameTypeDefaultDescription
    api_urlSTRINGhttps://api.deepseek.comLLM API Base URL
    api_keySTRINGsk-...
    model_idSTRINGdeepseek-chatmodel id

    Outputs (1)

    NameTypeDescription
    模型配置LLM_MODEL_CONFIG