Nodes/ComfyUI_Prompt-All-In-One/API Qwen Image2Text
ComfyUI Node

API Qwen Image2Text

Reverse-prompt any image through DashScope

By billwuhao·Created about a year ago·Updated about a year ago· 56
API Qwen Image2Text
  • image
  • text
api_key
system_prompt
prompt
modelqwen2.5-vl-32b-instruct
seed0

API Qwen Image2Text is the reverse-prompting node: you feed it an image tensor from your canvas and it returns a written description of what's in it. It's the Qwen-VL family doing image interrogation through Alibaba's DashScope API - no local VLM, no VRAM, just a key and a network call.

This is the node to reach for when you look at a reference image and can't put words to why it works. Wire an image in, get a caption back, and either reuse that caption as a prompt or hand it to a text-gen node for a rewrite. It also does the captioning half of a LoRA prep pipeline - lora-training.md is the place to read up on what a good caption should actually say - and the six-model dropdown lets you trade cost against description quality on the fly.

How it works

The image tensor is converted to a base64 PNG (data:image/png;base64,...) and sent as an image_url content part to DashScope's OpenAI-compatible endpoint, alongside your text prompt. Two execution paths in the source: if the model name contains "omni" (qwen-omni-turbo-latest, qwen2.5-omni-7b) it streams with modalities=["text"]; otherwise it makes a plain completion. Either way you get one string back. The key is DASHSCOPE_API_KEY or the api_key field.

The inputs that matter

  • image (IMAGE, required) - feed it from a Load Image, a VAE decode, or the output of any generator node. A single image is fine; it doesn't batch here.
  • prompt (multiline) - what you want said about the image. "Describe this image in detail" is a fine start; "Extract a stable diffusion prompt from this image" gets you a prompt-shaped answer.
  • system_prompt (multiline) - optional persona/format guardrails, e.g. "Return only tags, comma-separated."
  • model - the interesting knob. qwen2.5-vl-7b/32b/72b-instruct scale cost and quality; qwen-vl-plus is the cheap workhorse; the omni models are the multimodal heavy hitters. Start with qwen2.5-vl-32b-instruct (the default) and step down if you're burning credits.
  • api_key - env var or field; blank field + missing env var throws API Key is not set.
  • seed - accepted, never sent. Decorative.

Output is a single text STRING - wire it to a prompt box, a text viewer, or a text-gen node for a rewrite pass.

Installing it

Part of ComfyUI_Prompt-All-In-One by billwuhao. ComfyUI Manager → search Prompt-All-In-One, or:

cd ComfyUI/custom_nodes
git clone https://github.com/billwuhao/ComfyUI_Prompt-All-In-One.git
cd ComfyUI_Prompt-All-In-One
pip install -r requirements.txt

Restart; find it under 🎤MW/MW-Prompt-All-In-One.

Where people get burned

The key setup is the usual one: apply at Alibaba Cloud Bailian, set DASHSCOPE_API_KEY, reboot Windows if needed. If the caption comes back generic or misses the point, the fix is usually your prompt, not the model - VLMs follow instructions, so "describe the lighting, camera angle and mood" beats "what is this?". And remember the honest ceiling every VLM shares (it's in llm-in-comfyui.md): captions are good enough to describe an image but not guaranteed faithful enough to reproduce it, especially with multiple subjects - audit anything important by eye. The cloud path also means your image leaves the machine, which is worth remembering if you're interrogating something private.

Category🎤MW/MW-Prompt-All-In-One

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
api_keySTRING
system_promptSTRING
promptSTRING
modelCOMBOqwen2.5-vl-32b-instruct6 options: qwen2.5-vl-7b-instruct, qwen2.5-vl-32b-instruct, qwen2.5-vl-72b-instruct, qwen-vl-plus, qwen-omni-turbo-latest, qwen2.5-omni-7b
seedINT00–18446744073709550000

Outputs (1)

NameTypeDescription
textSTRING