QWEN3 文本生成
A multi-turn Qwen3 chat that lives on your ComfyUI canvas
- response
- conversation_history
This is the text half of the ComfyUI_QWEN3VL_API pack: a node that puts a Qwen3 chat session directly in your graph, complete with conversation memory. No local model, no transformers upgrade, no VRAM - it calls Alibaba's DashScope API under the hood and hands you the reply as a plain string you can pipe anywhere.
Why would you want an LLM sitting in a ComfyUI graph at all? Because the LLM-in-the-graph pattern is one of the most useful things this ecosystem has settled on: you use it to turn a rough idea into a structured prompt, to rewrite and reformat text between stages, or to generate dialogue that then feeds a text-to-video pipeline. It's a tool that operates on text upstream of the sampler - it never touches your images directly. The tradeoff here is that it's a cloud call, so it costs a little per message and, unlike a local abliterated 8B, it's not something you use for the uncensored stuff.
How it works
The node builds an OpenAI-compatible chat request and sends it to DashScope's compatible endpoint (https://dashscope.aliyuncs.com/compatible-mode/v1). That's why the only dependency is the openai library - DashScope speaks the same protocol, so the pack never needed a custom SDK.
The clever bit is conversation_history. It's a JSON string, and the node's two outputs are designed to be wired back into itself: response is the assistant's answer, and conversation_history is that answer appended to everything you've said so far. Loop the second output back into the node's own input and you get genuine multi-turn conversation. Skip the loop and you get a stateless one-shot, which is honestly what most workflows want.
Inputs worth knowing: model (qwen3-max for the heavy lifting, qwen-plus for general use, qwen-flash when you want speed), system_prompt to set the role, temperature and top_p for creativity, and seed for reproducible output. All the usual suspects, all in one node.
A caching trap to know about
The node's IS_CHANGED returns the seed - ComfyUI uses that to decide whether to cache the result. What that means in practice: if you edit user_prompt but leave seed the same, ComfyUI may hand you the previous cached reply instead of calling the API again. Bump the seed (or any other parameter) when you want a fresh call. It's a small thing, but it confuses people for the first hour.
How to install it
Same story as every node in this pack - no weights to download, just the client:
cd ComfyUI/custom_nodes
git clone https://github.com/flywhale-666/ComfyUI_QWEN3VL_API
cd ComfyUI_QWEN3VL_API
pip install -r requirements.txt
Restart ComfyUI, and you'll also need a DashScope API key (see the QWEN_APIKey node in this pack - that's the clean way to supply it). You can also just search "ComfyUI_QWEN3VL_API" in ComfyUI Manager.
Troubleshooting
- "API 调用失败" / an exception in the node - nine times out of ten it's the key. Check the api_key.ini file or the key node before anything else.
- Cached/stale replies - you hit the
IS_CHANGEDtrap above. Change the seed. - Conversation goes weird after several turns - the history is just a JSON string, and if you've got another node mangling it, the parser will silently ignore malformed history and start fresh. If the multi-turn context suddenly forgets itself, suspect the JSON, not the model.
- It's an API, so it filters - DashScope applies its own content policy server-side. If your prompt needs no filtering, a local model is the honest answer; this node is for when you want Qwen3 quality without running it.
One more honest note: this is a small, fresh pack with no real community track record yet, so read the source if you plan to depend on it. The text-formatting and key plumbing are all plain to follow.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 3 options: qwen3-max, qwen-plus, qwen-flash | |
| user_prompt | STRING | 你好,请介绍一下你自己 | — |
| system_prompt | STRING | You are a helpful assistant. | — |
| temperature | FLOAT | 0.70–2 | — |
| top_p | FLOAT | 0.800–1 | — |
| seed | INT | 00–18446744073709550000 | — |
| conversation_historyopt | STRING | — | |
| api_keyopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| conversation_history | STRING | — |