Nodes/Comfyui-Z-Image-Utilities/Z-Image API Config
ComfyUI Node

Z-Image API Config

One node, three LLM backends

By Koko-boya·Created 9 months ago·Updated 6 months ago· 127
Z-Image API Config
    • config
    provideropenrouter
    modelqwen/qwen3-235b-a22b:free
    api_key
    local_endpointhttp://localhost:11434/v1
    llm_path
    auto_download_fallbackfalse
    quantization4bit
    deviceauto

    The name is a lie, in the good way: this node doesn't call any API and needs no key. It's the single configuration hub for the whole pack - the thing that decides which LLM powers your Z-Image prompt enhancement, and how that LLM is reached. Every graph that uses this pack starts here, because both Z-Image Prompt Enhancer and Z-Image Integrated KSampler take a config input that only this node produces. Despite the "API Config" label, it's really a connection builder: pick a backend, fill in its details, and it hands you a config object the rest of the pack can use.

    Three providers, one dropdown:

    OpenRouter (cloud, easiest)

    provider: openrouter with a model ID like the default qwen/qwen3-235b-a22b:free. Paste an API key from openrouter.ai/keys into api_key. The free tier genuinely works - the author's own demo runs were done on the free Qwen model. Want to feed an image into the enhancer? Use a vision-capable model here, or the image input will be rejected.

    Local (your own server, no key)

    provider: local points at any OpenAI-compatible /v1/chat/completions server. The local_endpoint field defaults to http://localhost:11434/v1 (Ollama), with LM Studio on :1234, vLLM on :8000, and text-generation-webui on :5000 as the common alternatives. model is the model name your server exposes - e.g. qwen2.5:7b. This is the route that costs nothing per run and keeps everything on your machine; several users run a small Qwen in LM Studio on a second GPU just to feed this node.

    Direct (HuggingFace, zero servers)

    provider: direct downloads and loads the model itself. model is a HuggingFace repo ID, downloaded into ComfyUI/models/LLM/Z-Image/ and cached. This is where the heavy settings live:

    • quantization - 4bit (default), 8bit, or none. 4-bit saves the most VRAM; none (fp16) is best quality. The tooltip's honest framing.
    • device - auto, cuda, cpu, or mps.
    • llm_path - an optional local model folder; if set, the model name is treated as a folder name inside it.
    • auto_download_fallback - on: try the manual path, fall back to downloading if not found. Off (default): strict, fails if the folder is missing.

    The Direct route is the only one with real dependencies: pip install bitsandbytes huggingface-hub (hf_transfer optional for faster downloads). And it's the only route where you might OOM - dropping to 4-bit or switching to a smaller model is the fix.

    Output and gotchas

    Single output: config (type ZIMAGE_CONFIG), feeding the Prompt Enhancer or Integrated KSampler. A few things that'll bite: an empty model errors immediately; OpenRouter with no key logs a warning and then fails at request time; and a text-only Direct model will reject image input - pick a vision-language model for that. If your local server is misconfigured, the node will still happily build a config and only fail when the enhancer actually calls the endpoint, so keep the Z-Image Options debug_mode in mind when troubleshooting.

    Install the pack once via ComfyUI Manager (search "Comfyui-Z-Image-Utilities") or cd ComfyUI/custom_nodes && git clone https://github.com/Koko-boya/ComfyUI-Z-Image-Utilities.git, restart, and this node is your front door.

    CategoryZ-Image

    Inputs (8)

    NameTypeDefaultDescription
    providerCOMBOopenrouterSelect API provider: openrouter (cloud), local (API server), or direct (HuggingFace model loading)
    modelSTRINGqwen/qwen3-235b-a22b:freeModel identifier. OpenRouter: provider/model-name | Local: model name from server | Direct: HuggingFace repo ID
    api_keyoptSTRINGAPI key for OpenRouter. Get one at https://openrouter.ai/keys
    local_endpointoptSTRINGhttp://localhost:11434/v1Local LLM server endpoint (Ollama: 11434, LM Studio: 1234, vLLM: 8000)
    llm_pathoptSTRINGCustom path to local LLM models. If set, model name is treated as folder name. If empty, downloads from HuggingFace.
    auto_download_fallbackoptBOOLEANfalseIf enabled: try manual path first, fall back to auto-download if not found. If disabled: manual path is strict (fails if not found).
    quantizationoptCOMBO4bitModel precision. 4-bit saves VRAM, 8-bit is balanced, FP16/None gives best quality
    deviceoptCOMBOautoDevice for direct model loading

    Outputs (1)

    NameTypeDescription
    configZIMAGE_CONFIG