ComfyUI Node

Qwen API

Alibaba's multimodal models in ComfyUI for captions and prompts

By al-swaiti·Created 2 years ago·Updated 2 months ago· 185
Qwen API
  • image1
  • image2
  • image3
  • image4
  • image5
  • text
promptWhat is the meaning of life?
qwen_modelqwen-max
max_tokens1024
temperature0.7
top_p0.7
structure_outputfalse
prompt_structureCustom
structure_formatReturn only the prompt text itself. No explanations or formatting.
output_formatraw_text
api_key

This node calls Alibaba's Qwen models from inside a ComfyUI graph. It's the same design as the pack's Gemini, OpenAI, Claude, and Ollama nodes - text and images in, a string out - with Qwen as the brain. Two reasons you'd pick it over the others: the qwen-vl models are solid, cheap vision-language models for reading images, and if you're already in the Alibaba Cloud ecosystem it's the natural fit. Don't confuse this with Qwen Image, the diffusion model you'd load as a checkpoint - this node talks to Qwen's text/vision LLMs over an API, for captioning and prompt-writing, not for generating pictures.

The two jobs

Vision. Point a qwen-vl model at an image (slots image1image5) and it'll describe or analyze it. Multiple slots let you feed several references in one call.

Prompt optimization. Flip structure_output on, choose a prompt_structure template - FLUX.1-dev, SDXL, Imagen4, HunyuanVideo, Wan2.1, FLUXKontext, GeminiNanaBananaEdit - and Qwen rewrites your rough idea into a prompt tuned for that target model. This is the genuinely useful mode. Prompting is encoder-specific now: tag-style for SDXL descendants, plain-language instructions for FLUX and the newer LLM-encoded models. Feeding the wrong style is the top cause of mediocre output, so letting a language model translate your intent into the correct dialect is a real lever, not a gimmick.

The inputs and outputs that matter

  • prompt - your instruction or seed idea.
  • qwen_model - six choices: qwen-max / qwen-plus / qwen-turbo (text, in descending cost/quality), qwen-vl-max / qwen-vl-plus (vision - pick these if you're feeding images), and qwen1.5-32b-chat. Turbo is cheap and plenty for prompt work; reach for -vl-max when captioning matters.
  • max_tokens (default 1024, up to 8192) - response cap. Prompts don't need much; captions even less.
  • temperature (0.7) and top_p (0.7) - the usual creativity/diversity dials.
  • structure_output + prompt_structure - the optimizer switch and its target template.
  • api_key (optional) - paste here or leave blank to read the pack config.

Output: text, a string. Wire it into a CLIP Text Encode, a Save Text node, or the next node.

Installing it and the key

ComfyUI Manager: search ComfyUI-OllamaGemini, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/al-swaiti/ComfyUI-OllamaGemini
pip install -r requirements.txt

then restart. Qwen's API keys come from Alibaba's DashScope console (dashscope.console.aliyun.com); store yours in the pack config as QWEN_API_KEY, or paste it into the api_key input. It's a paid/limited API - check the current free-quota terms on DashScope before you lean on it.

Where people get burned

Trust first. Your Qwen key sits in a plaintext config any installed custom node can read, and custom nodes are arbitrary Python with full machine access. Nothing here suggests this MIT-licensed pack is anything but honest, but the ecosystem's own lesson stands: the 2024 ComfyUI_LLMVISION malware hid an infostealer inside fake builds of common AI SDKs, which is exactly the class of dependency an API pack installs. Clone from the real repo, keep it current, and be willing to rotate a key.

Two practical notes. This is the pack's least-exercised provider, so if a model name in the dropdown has been renamed or retired on Alibaba's side, calls can fail even with a valid key - verify the model exists in your DashScope account. And if the node doesn't appear after install, suspect a failed pack dependency (check the startup console), not the node itself.

CategoryAI API/Qwen

Inputs (15)

NameTypeDefaultDescription
promptSTRINGWhat is the meaning of life?
qwen_modelCOMBOqwen-max6 options: qwen-max, qwen-plus, qwen-turbo, qwen-vl-max, qwen-vl-plus, qwen1.5-32b-chat
max_tokensINT10241–8192
temperatureFLOAT0.70–2
top_pFLOAT0.70–1
structure_outputBOOLEANfalse
prompt_structureCOMBOCustom8 options: Custom, HunyuanVideo, Wan2.1, FLUX.1-dev, SDXL, FLUXKontext, +2
structure_formatSTRINGReturn only the prompt text itself. No explanations or formatting.
output_formatCOMBOraw_text2 options: raw_text, json
api_keyoptSTRING
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
image5optIMAGE

Outputs (1)

NameTypeDescription
textSTRING