Nodes/ComfyUI ModelScope API Node/ModelScope-Image 生图节点
ComfyUI Node

ModelScope-Image 生图节点

Qwen-Image and FLUX without the 20GB download

By hujuying·Created 12 months ago·Updated 8 months ago· 67
ModelScope-Image 生图节点
    • image
    promptA beautiful landscape
    api_tokens
    modelQwen/Qwen-Image
    negative_prompt
    width512
    height512
    seed-1
    steps30
    guidance7.5
    lora1_id
    lora1_w0.8
    lora2_id
    lora2_w0.8
    lora3_id
    lora3_w0.8

    This is the flagship of the ModelScope pack: a plain text-to-image node that turns a prompt into a real IMAGE tensor you can preview, save, or pass on to an upscaler. What makes it interesting isn't the node - it's what's behind it. The default model is Qwen/Qwen-Image, a 20B MMDiT that would otherwise want a big chunk of VRAM and a multi-gigabyte download. Here the actual diffusion happens on ModelScope's cloud, so you can generate with Qwen-Image, a MusePublic FLUX.1-Kontext-Dev, or Z-Image-Turbo with zero local model files and (in theory) a 6GB card. That's the real pitch: pick any model from the dropdown, pay per render, never download weights.

    How it works

    Mechanically it's more interesting than most cloud nodes. It POSTs to https://api-inference.modelscope.cn/v1/images/generations with an X-ModelScope-Async-Mode header, gets back a task_id, then polls /v1/tasks/{task_id} every five seconds until the job reports SUCCEED, downloads the image, and converts it to a ComfyUI tensor. Async because Qwen-Image is slow, even on their GPUs; the config file sets a default 720-second timeout. The console is chatty through all of it - every step, status, and seed is logged with emoji, which is either endearing or exhausting depending on how long you've watched a task poll.

    The inputs that matter

    Inputs you'll actually set:

    • prompt and api_tokens (both required) - the prompt is self-explanatory; the token you get from modelscope.cn. You can paste several tokens separated by commas or newlines, and the node falls through them if one hits a rate limit. First run auto-saves them, so later runs can leave the field blank.
    • model - dropdown default is Qwen/Qwen-Image, with Qwen-Image-2512, MusePublic/489_ckpt_FLUX_1, MAILAND/majicflus_v1, Tongyi-MAI/Z-Image-Turbo, and more. The list is read from modelscope_config.json, so you can edit that file to add models.
    • negative_prompt - only sent if you actually type something. Qwen-Image is picky about negatives; keep them short.
    • width/height (64–2048, step 64), steps (1–100), guidance (1.5–20, default 7.5) - the usual knobs. Default is 512×512, which is conservative; most people push 1024.
    • seed (-1 = random) - set it to reproduce a render, exactly like a local sampler.
    • lora1_id / lora1_w through lora3_id / lora3_w - hosted LoRAs, by ModelScope model ID, sent as a loras dict in the request. This is where the pack's LoRA loader nodes plug in.

    Output is a single image - wire it into PreviewImage or SaveImage.

    Installing it

    Install is the standard two ways: ComfyUI Manager, searching "ComfyUI ModelScope API Node", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hujuying/ComfyUI-ModelScope-API
    

    then restart. Dependencies are light - everything in requirements.txt (requests, pillow, torch, numpy) already ships with ComfyUI; only the text/vision nodes need the openai package.

    The honest caveats

    The honest caveats: this is a paid API, not free inference - your free ModelScope quota evaporates fast if you batch. And you're at the mercy of their queue: a render is a network round trip plus polling, so "30 steps" takes as long as their GPUs say it takes, not as long as your GPU would. It's a great node when you're on a weak card or testing models you can't run; it's a strange pick when you own a 4090 and the model already lives in your models folder.

    CategoryModelScopeAPI

    Inputs (15)

    NameTypeDefaultDescription
    promptSTRINGA beautiful landscape
    api_tokensSTRING
    modeloptCOMBOQwen/Qwen-Image9 options: Qwen/Qwen-Image, MusePublic/Qwen-image, Qwen/Qwen-Image-2512, MusePublic/489_ckpt_FLUX_1, MusePublic/flux-high-res, black-forest-labs/FLUX.1-Krea-dev, +3
    negative_promptoptSTRING
    widthoptINT51264–2048
    heightoptINT51264–2048
    seedoptINT-1-1–2147483647
    stepsoptINT301–100
    guidanceoptFLOAT7.51.5–20
    lora1_idoptSTRING
    lora1_woptFLOAT0.80–2
    lora2_idoptSTRING
    lora2_woptFLOAT0.80–2
    lora3_idoptSTRING
    lora3_woptFLOAT0.80–2

    Outputs (1)

    NameTypeDescription
    imageIMAGE