Qwen Generate/Edit Image
Qwen Image Generation and Editing, Via Alibaba's DashScope
- image
- image1
- image2
- image3
- image4
- history
- image
- images
- num_images
- text
- history
Alibaba's Qwen-Image family is a fascinating case in this ecosystem: the open-weight models are the community's default instruction editor, but the flagship line - Qwen-Image-2.0 - launched API-only. YogurtQwenGenerateImage is the door into that API half: it calls Alibaba's DashScope (百炼) service for text-to-image and multi-image editing, and returns proper IMAGE tensors to your graph.
The inputs, with the ones you'll actually set first:
api_key- DashScope key. Leave blank and it tries the pack's qwen/dashscope config or theDASHSCOPE_API_KEYenv var.model_name- defaults toqwen-image-2.0-pro. The tooltip recommends theqwen-image-2.0series for models that support the sync interface.prompt- generation or editing instruction.system_prompt- locally prepended to the prompt (sent as a single user message).size- output resolution like1024*1024, orautoto let the model decide.n- number of images (1–6, model-dependent cap).negative_prompt- reverse prompt, which most modern API image models quietly don't support well - set it, but don't bet on it.prompt_extend- toggle Qwen's intelligent prompt rewriting.watermark- whether to add the Qwen-Image watermark.seed,retry_count,timeout,proxy_url- the usual.
Optional: image plus image1–image4 for multi-image editing, history, and extra (raw JSON merged into the request's parameters or top level). Outputs: image, images, num_images, text, history.
The context you should bring
From the knowledge base: Qwen-Image's Edit line became the default open instruction editor (Apache 2.0, no NSFW policing), but Qwen-Image-2.0 cut the model to 7B, unified generation with editing, and went API-only. This node is that API - so you're getting the current flagship's quality without the weights, and you're paying per call. The multi-image image1–image4 inputs are the editing story: describe a change across several reference images in one prompt.
Install and keys
Ships in ComfyUI-YogurtNodes. ComfyUI Manager → search ComfyUI-YogurtNodes → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart ComfyUI, find it under "Yogurt Nodes/LLM". Requires the openai package (DashScope's OpenAI-compatible endpoint) and a DashScope key.
Where people get burned: the base_url defaults to the Beijing region (dashscope.aliyuncs.com) - if your account is provisioned elsewhere, or you need the international endpoint, set it explicitly. And if you're coming from the open-weight Qwen-Image-Edit local workflow, remember this is a metered service: n multiplies cost, so leave it at 1 for tests.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | 百炼 API Key,留空时尝试读取 qwen / dashscope 配置或 DASHSCOPE_API_KEY | |
| base_url | STRING | DashScope API 根地址,留空时默认使用北京地域 | |
| model_name | STRING | qwen-image-2.0-pro | Qwen 图片模型名称,推荐使用支持同步接口的 qwen-image-2.0 系列 |
| system_prompt | STRING | 本地拼接到主提示词前的系统提示词,接口仍以单轮 user 消息发送 | |
| prompt | STRING | 图片生成或编辑提示词 | |
| size | STRING | auto | 输出分辨率,例如 1024*1024;auto 表示交给模型决定 |
| n | INT | 11–6 | 输出图片数量,具体上限取决于模型 |
| negative_prompt | STRING | 反向提示词 | |
| prompt_extend | BOOLEAN | true | 是否启用 Qwen 的提示词智能改写 |
| watermark | BOOLEAN | false | 是否添加 Qwen-Image 水印 |
| retry_count | INT | 1 | 请求失败时的重试次数 |
| proxy_url | STRING | 代理 URL,格式: protocol://user:pass@addr:port | |
| seed | INT | -1-1–2147483647 | 随机种子,-1 表示让服务端自动生成 |
| timeout | INT | 00–2147483647 | 请求超时时间(秒),0 表示不限制 |
| imageopt | IMAGE | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| historyopt | HISTORY | — | |
| extraopt | STRING | {} | 额外请求参数,支持直接补充到 parameters 或顶层请求体 |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| images | IMAGE | — |
| num_images | INT | — |
| text | STRING | — |
| history | HISTORY | — |