ComfyUI Node

ModelScope Universal API

The ModelScope API node

By Onionman61·Created about a year ago·Updated 9 months ago· 7
ModelScope Universal API
  • image_1
  • image_2
  • image_3
  • IMAGE
modelblack-forest-labs/FLUX.2-dev
api_keyyour_modelscope_api_key
promptGive the dog in the picture a birthday hat
width1024
height1024
seed0
steps30
guidance3.5

The pitch is simple: drop a picture in, type "give the dog in the picture a birthday hat," and get the edited picture back - with FLUX.1-Kontext-Dev or the full FLUX.2-dev model running on Alibaba's servers, not your GPU. No 12B Kontext weights, no 32B FLUX.2 download, no 18–24GB VRAM invoice. The ModelScope Universal API node is a thin wrapper around ModelScope's hosted inference, and it's genuinely useful if you run ComfyUI on a laptop or a mid-range card that would choke on FLUX.2 locally.

The "Kontext" in the pack name is a history lesson: this started as a wrapper for BFL's instruction-editing model, then the author bolted on FLUX.2 support. The node itself is one class with a dropdown, hence "universal."

How it works

Read the source and it's three steps, all over HTTP. First it takes your input image tensor, converts it to a PNG, and uploads it to freeimage.host to get a public URL - because the ModelScope API needs to fetch the reference image from somewhere. Then it POSTs an async task to api-inference.modelscope.cn/v1/images/generations with your api_key in the header, and finally it polls /v1/tasks/<id> every 5 seconds until the task is SUCCEED, downloads the output image, and hands it back as a tensor.

Dependencies are almost insultingly light: requests and Pillow, nothing else. No torch install, no model files, no models folder. That's the whole appeal - the heavy lifting happens in the cloud.

The inputs that matter

You only need to touch a handful of fields:

  • model - dropdown between black-forest-labs/FLUX.2-dev (default) and MusePublic/FLUX.1-Kontext-Dev.
  • image_1 - the input image. Optional image_2 and image_3 exist for FLUX.2's multi-reference editing.
  • api_key - your ModelScope key from modelscope.cn/my/myaccesstoken. The default is a placeholder and will not work.
  • prompt - the edit instruction, as a sentence.

The rest are Kontext-era leftovers: width, height, seed, steps, and guidance only get sent when you pick Kontext (single-image, respects all of them). Select FLUX.2-dev and the code silently ignores every one of them - that's not a bug, FLUX.2 on this API just doesn't take them. Kontext also only uses image_1; extra images are ignored.

The single IMAGE output wires straight into PreviewImage or SaveImage.

Install

ComfyUI Manager will find it by searching "ModelScope"; otherwise:

cd ComfyUI/custom_nodes
git clone https://github.com/Onionman61/ComfyUI-ModelScope-Kontext

Then restart ComfyUI. One trap: the README's own clone command says ComfyUI-ModelScope.git - a stale copy-paste from the author's earlier repo, and it clones the wrong thing. Use the URL above.

Where people get burned

  • Privacy, real talk. Every input image is uploaded to freeimage.host - a public third-party image host - using a shared API key hardcoded into the node. Whatever you feed this node goes up on a public URL, and the same key is used by everyone running it. Don't feed it anything you wouldn't post online. If that shared key ever gets rate-limited or rotated, you'll get an "Image hosting service connection error" and the node dies before reaching ModelScope.
  • It's slow and looks frozen. Async polling every 5 seconds means a long FLUX.2 job can sit there for a minute-plus with no progress bar. Be patient.
  • FLUX.2 ignores the sliders. If you're cranking seed and steps and seeing nothing change, that's the expected behavior.
  • Censorship. Kontext and FLUX.2 are both heavily safety-filtered, and Kontext's license makes NSFW LoRAs a violation. If that matters to you, Qwen-Image-Edit (Apache 2.0, uncensored) is the local rival everyone actually switched to.

It's not a miracle node - it's a convenience node. But for trying FLUX.2's multi-image editing without a 24GB card, it's about the cheapest on-ramp you'll find.

CategoryModelScope

Inputs (11)

NameTypeDefaultDescription
modelCOMBOblack-forest-labs/FLUX.2-dev2 options: black-forest-labs/FLUX.2-dev, MusePublic/FLUX.1-Kontext-Dev
image_1IMAGE
api_keySTRINGyour_modelscope_api_key
promptSTRINGGive the dog in the picture a birthday hat
widthINT102464–2048
heightINT102464–2048
seedINT00–2147483647
stepsINT301–100
guidanceFLOAT3.51.5–20
image_2optIMAGE
image_3optIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE