Qwen API
Alibaba's multimodal models in ComfyUI for captions and prompts
- image1
- image2
- image3
- image4
- image5
- text
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 image1–image5) 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), andqwen1.5-32b-chat. Turbo is cheap and plenty for prompt work; reach for-vl-maxwhen captioning matters.max_tokens(default 1024, up to 8192) - response cap. Prompts don't need much; captions even less.temperature(0.7) andtop_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.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | What is the meaning of life? | — |
| qwen_model | COMBO | qwen-max | 6 options: qwen-max, qwen-plus, qwen-turbo, qwen-vl-max, qwen-vl-plus, qwen1.5-32b-chat |
| max_tokens | INT | 10241–8192 | — |
| temperature | FLOAT | 0.70–2 | — |
| top_p | FLOAT | 0.70–1 | — |
| structure_output | BOOLEAN | false | — |
| prompt_structure | COMBO | Custom | 8 options: Custom, HunyuanVideo, Wan2.1, FLUX.1-dev, SDXL, FLUXKontext, +2 |
| structure_format | STRING | Return only the prompt text itself. No explanations or formatting. | — |
| output_format | COMBO | raw_text | 2 options: raw_text, json |
| api_keyopt | STRING | — | |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| image5opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |