Dify is an open-source platform for building AI applications. You can build applications using model APIs from Alibaba Cloud Model Studio.
Prerequisites
You need to get an API key and activate the required model services in Model Studio.
1. Configure the model
1.1. Install the model provider
Go to the Dify Marketplace. Under Model, find Qwen and install the latest version of the plugin.
-
The TONGYI plugin is maintained by Dify, not Alibaba Cloud. If you encounter an error when installing the latest version, try installing an earlier version.
-
To use DeepSeek models from Model Studio, you must also use the Qwen plugin.
1.2. Configure the API key
In the top-right corner of the page, click your profile picture → Settings. Under Model Providers, find the Qwen card and click Settings.
-
If you use a model from the Singapore region, go to the API-KEY Settings section, enter the API key for that region, and set Use International Endpoint to Yes.
-
If you use a model from the Beijing region, go to the API-KEY Settings section, enter the API key for the Beijing region, and set Use International Endpoint to No.
If you receive an Invalid API key provided error during configuration, try installing an earlier version of the TONGYI plugin.

1.3. Select a model
On the Qwen card, click to show the model list, then enable the switch for the models you need.
If the plugin does not include the latest Qwen model, you can install the OpenAI-API-compatible plugin. In the plugin settings, set the API endpoint URL to one of the following:https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1(Singapore region) orhttps://dashscope.aliyuncs.com/compatible-mode/v1(Beijing region). ReplaceWorkspaceIdwith your actual Get the Workspace ID.
2. Get started
Dify supports several application types. Select yours for instructions.
Chat assistant and agent
-
Create a chat assistant or agent
In the workspace, click Create blank app. Under Beginner-Friendly, create and open a chat assistant or agent.
-
Select a model
In the top-right corner of the application page, select a model. For example, under Qwen, select qwen-plus-latest(Qwen3), then enable thinking mode.
-
Test the conversation
Enter "Who are you?" The model responds after its thinking process is complete.
You can also use a Qwen-VL or QVQ model to ask questions about images. After selecting a vision model, a Vision switch appears on the left. Enable it to upload images in the chat window on the right.
Chatflow and workflow
-
Create a Chatflow or workflow
In the workspace, create and open a Chatflow or workflow.
-
Add an LLM node
Add an LLM node to the canvas. Select the node to open its editing panel, then choose the model you need. For this example, select qwen-plus-2025-07-28(Qwen3) and enable thinking mode.
If you are using a Qwen-VL or QVQ model, you must enable the Vision switch for the LLM node:
At the bottom of the LLM node editing panel, find and enable the Vision switch. You can then set the Resolution to High or Low.
-
Run the LLM node
Click Add message. In the message field corresponding to USER, enter the question "Who are you?", and click the run button
in the top-right corner of the node.After the run completes, inspect the
textfield in the output. The thinking process is enclosed in...tags, followed by the model's main response.The
textfield returned by the LLM node contains both the thinking process and the response. You can use a Dify code execution node with regular expressions to extract them separately.
Knowledge base
-
Create a knowledge base
Create and open a knowledge base.
-
Select a data source
Upload your knowledge base files.
-
Text segmentation and cleaning
Configure the embedding and rerank models from Model Studio. This example uses text-embedding-v4 and gte-rerank-v2. Adjust other parameters as needed.
The gte-rerank-v2 model is supported only in the Beijing region.
The multimodal-embedding-v1 model cannot currently be selected as an embedding model. Stay tuned for future updates.
FAQ
Q1: TONGYI plugin API key error
A: Common reasons:
-
The latest version of the plugin might be unstable. Try installing an earlier version.
-
You are using an API key from a sub-workspace. Version
0.0.41of the TONGYI plugin validates invocation permissions for theqwen-turbomodel. You must grant invocation permission forqwen-turbo.The TONGYI plugin is not maintained by Alibaba Cloud, and its validation policies may change in future versions. Use an API key from the default workspace.
-
The endpoint setting is incorrect. Set Use International Endpoint correctly based on the region of your API key.
Q2: Using Qwen-Omni and Qwen-OCR models
A: These models cannot be configured directly in Dify. You can integrate them using an HTTP node in a Chatflow or workflow. For integration details, refer to the cURL command examples in the model's documentation.
To reduce the risk of timeouts in the HTTP node, use streaming output for API calls.
Q3: Using Wan models
A: Dify does not offer a dedicated plugin for Wan models. However, you can achieve text-to-image and text-to-video generation using nodes in a Dify Chatflow or workflow. Follow these steps:
-
Download and import a workflow template
Download one of our pre-built templates: Wan - Text-to-Image Demo.yml or Wan - Text-to-Video Demo.yml. In the workspace, click Import DSL File and select the template you downloaded.
-
Configure environment variables
On the workflow page, find the environment variables icon
, and change the value of DASHSCOPE_API_KEYto your API key. -
Test the output
Click the Run button to generate the output. For example, entering "a small cat" in the text-to-image workflow produces an image.
The text-to-video workflow returns a URL for the generated video.
Text-to-video generation typically takes five minutes or more.
-
Publish as a tool (optional)
To use these capabilities in other applications, click Publish in the top-right corner and select Publish as tool.
The templates use models from the Singapore region:wan2.2-t2i-flash(text-to-image) andwan2.1-t2v-turbo(text-to-video). You can change the model in the STEP1 node and modify the region-specific API endpoint in the STEP1 and STEP3 nodes.
Q4: Private deployment of Dify
A: The Dify cloud service has several limitations, such as a maximum of five applications. For a private deployment, see the Alibaba Cloud solution for Dify deployment.