Skip to content
Sign in

Dify integration guide

Low-code platformVisual developmentUpdated: 2025-11-27

Introduction

Dify is an open-source platform for building LLM applications, letting you create capable AI applications without writing code. Backed by SeaWhale AI models, you can build a wide range of intelligent applications quickly.

Key capabilities

  • 🎨 Visual development — drag-and-drop, no programming needed
  • 🤖 Many application types — chatbots, agents, workflows, knowledge bases
  • 🔧 Rich node library — HTTP, databases, code execution and more
  • 📚 RAG knowledge bases — precise answers grounded in your documents
  • 🔌 Plugin ecosystem — a large plugin library for extensibility
  • 🌐 API publishing — expose your app as an API in one click
  • 🎯 Multimodal — text, images, audio and video

Application types

TypeDescriptionBest forDifficulty
ChatbotConversational interactionSupport bots, Q&A assistants
AgentCalls tools autonomouslySmart assistants, task automation⭐⭐⭐
ChatflowVisual conversation flowsComplex conversational scenarios⭐⭐
WorkflowAutomated pipelinesData processing, batch jobs⭐⭐⭐
Knowledge baseDocument-grounded Q&AEnterprise knowledge, document retrieval⭐⭐

Why Dify + SeaWhale AI?

A good combination

  • 🚀 Fast to build: Dify's visual builder plus SeaWhale AI's models
  • 💰 Cost effective: pay as you go, pick the model that fits
  • 🎯 Many models: Qwen, DeepSeek, GPT and more
  • 🔒 Self-hostable: deploy locally for data control
  • 🌟 Open source: Dify's core is fully open source

Before you begin

1. Create a Dify account

DeploymentDescriptionBest for
Dify CloudNothing to deploy, ready to useTrying it out, small projects
Self-hostedFull control, no platform limitsEnterprise use, data control
  1. Visit the Dify website
  2. Click "Get started for free"
  3. Sign up with GitHub or Google
  4. Open the workspace

Cloud limitations

  • The free tier allows at most 5 applications
  • There are monthly usage limits
  • Self-hosting is recommended for enterprise use

2. Get a SeaWhale AI API key

  1. Open the SeaWhale AI console
  2. Sign up and log in
  3. Generate an API key on the API management page
  4. Make sure your account has enough balance

New user credit

  • 🎁 New accounts receive free credit
  • 💰 Usable across all model inference services

3. Choose a model

Through Dify, SeaWhale AI supports:

FamilyModel nameStrengthsBest for
Qwen Plusqwen-plus-latest• Strong performance
• Reasoning mode
Chatbots, agents
Qwen Maxqwen-max• Highest capability
• Long context
Complex tasks, knowledge bases
Qwen Turboqwen-turbo• Fast responses
• Low cost
Simple chat, batch processing
Qwen VLqwen-vl-plus• Vision understanding
• Multimodal
Image analysis, OCR
QVQqvq-72b-preview• Visual reasoning
• Deep analysis
Visual Q&A, scene understanding
DeepSeekdeepseek-chat• Open model
• Strong reasoning
Code generation, logical reasoning

Configuration

1. Install the model provider plugin

Step 1: open the Dify marketplace

  1. Sign in to the Dify workspace
  2. Click "Plugins" in the left sidebar
  3. Select the "Models" tab

Step 2: install the Qwen plugin

  1. Search for "Qwen" (or "Tongyi Qianwen")
  2. Find the Qwen plugin (maintained by Dify)
  3. Click "Install"
  4. Choose the latest (or a stable) version

Important

  • The Qwen plugin is maintained by Dify, not by Alibaba Cloud or SeaWhale AI
  • If the latest version errors, try an older release (such as v0.0.40)
  • Using SeaWhale AI's DeepSeek models also requires the Qwen plugin
Choosing a plugin version

Latest (recommended)

  • ✅ Most complete feature set
  • ✅ Supports the newest models
  • ⚠️ May be less stable

Stable (v0.0.40–v0.0.41)

  • ✅ Reliable
  • ✅ Good compatibility
  • ⚠️ Fewer features

Notes

  • v0.0.41 validates qwen-turbo permissions
  • Use an API key from your default workspace
  • Avoid keys scoped to a sub-workspace

2. Configure the API key

Step 1: open settings

  1. Click your avatar in the top right
  2. Choose "Settings"
  3. Find the "Model providers" section

Step 2: configure Qwen

Find the Qwen card and open its configuration:

text
API Key: sk-xxxxxxxxxxxxxxxx
Use international endpoint: No
text
API Key: sk-intl-xxxxxxxxxxxxxxxx
Use international endpoint: Yes

Step 3: save

Click "Save" to finish.

Common error

Message: Invalid API-key provided

Possible causes:

  1. The API key format is wrong, or the key expired
  2. You used a key scoped to a sub-workspace
  3. The "use international endpoint" setting is wrong
  4. The plugin version is incompatible

Fix:

  • ✅ Check the API key is correct
  • ✅ Confirm the key's region matches the endpoint setting
  • ✅ Try installing an older plugin version (v0.0.40)
  • ✅ Use an API key from the default workspace

3. Enable models

Step 1: open the model list

On the Qwen card, click "Show models".

Step 2: enable what you need

Toggle on the models you plan to use:

Recommended:

ModelPurposeEnable?
qwen-plus-latestEveryday chat, reasoning mode✅ Yes
qwen-maxComplex tasks, long text✅ Yes
qwen-turboFast responses, cost first✅ Yes
qwen-vl-plusImage understandingAs needed
qvq-72b-previewVisual reasoningAs needed
deepseek-chatCode generationAs needed

Can't find the newest model?

If the plugin does not include the newest Qwen models yet, configure them through the OpenAI-API-compatible plugin:

  1. Install the OpenAI-API-compatible plugin
  2. Configure:
    • API Endpoint URL: https://api.your-domain.com/compatible-mode/v1
    • API Key: your SeaWhale AI API key
    • Model Name: the specific model (such as qwen3-max)

This gives you access to every model SeaWhale AI supports.


Usage guide

Scenario 1: build a chatbot

The simplest application type, good for getting started.

1. Create the application

  1. In the studio, click "Create blank app"
  2. Choose the "Chatbot" type
  3. Name it (for example "Support assistant")
  4. Click "Create"

2. Select a model

In the top right of the app page:

  1. Open the "Model" dropdown
  2. Choose "Qwen"
  3. Pick a specific model (such as qwen-plus-latest)

3. Configure reasoning mode (optional)

For models that support reasoning:

  1. Find the "Reasoning mode" option in the model configuration
  2. Set it to "True"
  3. Save

4. Test the conversation

Type this in the chat panel on the right:

Who are you?

What to expect:

  • Reasoning mode on: the model's thought process is shown
  • Reasoning mode off: you get the answer directly

Models with reasoning support

  • qwen-plus-latest (Qwen3)
  • qwen-max
  • qwen3-235b-a22b
  • qvq-72b-preview

Scenario 2: build an agent

Agents call tools autonomously to complete complex tasks.

1. Create the agent

  1. In the studio, click "Create blank app"
  2. Choose the "Agent" type
  3. Set a name and description

2. Add tools

Tool calling is what makes an agent useful:

Built-in tools:

  • 🌐 Web search — fetch live information
  • 📄 Document parsing — read PDF, Word and similar
  • 🔢 Calculator — arithmetic
  • 📧 Email — send mail automatically

Custom tools:

  • HTTP API calls
  • Database queries
  • Custom Python code

3. Example: a web search agent

markdown
User: Who won the 2024 Nobel Prize in Physics?

What the agent does:

1. 🔍 Calls the web search tool
2. 📊 Analyzes the results
3. ✍️ Writes a structured answer

Agent's answer:
The 2024 Nobel Prize in Physics was awarded to John J. Hopfield and
Geoffrey E. Hinton for foundational discoveries and inventions that
enable machine learning with artificial neural networks...

Scenario 3: build a workflow

Workflows suit complex automation.

1. Create the workflow

  1. Click "Create blank app"
  2. Choose the "Workflow" type
  3. Open the visual editor

2. Node types

Node typeWhat it doesTypical use
StartReceives inputRequired
LLMCalls a modelGeneration, analysis
HTTPCalls an APIFetch external data
CodeRuns PythonData processing, math
ConditionalBranches on logicFlow control
LoopRepeats workBatch processing
EndReturns the resultRequired

3. Example: a text-to-image workflow

Ready-made templates are available.

Step 1: download a template

Step 2: import the workflow

  1. In the studio, click "Import DSL file"
  2. Select the downloaded template
  3. Click "Import"

Step 3: configure the API key

  1. Find the environment variables icon (⚙️)
  2. Set DASHSCOPE_API_KEY to your API key
  3. Save

Step 4: test it

  1. Enter a description, such as "A cute kitten"
  2. Click "Run"
  3. Wait for generation to finish

Notes

  • Text-to-image: roughly 5–30 seconds
  • Text-to-video: roughly 5–10 minutes
  • Video generation returns a URL you need to download
  • The template defaults to the wanx2.1-t2i-turbo model

Step 5: publish as a tool (optional)

To reuse it from other applications:

  1. Click "Publish" in the top right
  2. Choose "Publish as tool"
  3. Set a tool name and description
  4. Publish

Scenario 4: build a knowledge base

Knowledge bases use RAG to answer questions grounded in your documents.

1. Create the knowledge base

  1. Click "Knowledge" in the left sidebar
  2. Click "Create knowledge base"
  3. Enter a name
  4. Choose an embedding model

Recommended embedding models:

ModelDimensionsCharacteristicsBest for
text-embedding-3-small1536Fast, inexpensiveGeneral documents
text-embedding-3-large3072Higher accuracyPrecise retrieval
text-embedding-ada-0021536The OpenAI classicBroad compatibility

2. Upload documents

Supported formats:

  • 📄 Text files: TXT, MD, CSV
  • 📝 Office documents: PDF, Word, Excel, PPT
  • 🌐 Web content: HTML, URLs
  • 💬 Conversation logs: JSON

Steps:

  1. Click "Upload document"
  2. Select or drag in your files
  3. Choose a chunking strategy:
    • Automatic (recommended)
    • Custom chunk size (500–1000 characters)
  4. Wait for vectorization to finish

3. Create a knowledge base application

  1. Create a new "Chatbot" application
  2. Add the knowledge base under "Context"
  3. Configure retrieval:
    • Top K: how many chunks to retrieve (3–5 works well)
    • Score threshold: similarity cutoff (0.7 works well)
  4. Test the answers

4. Example conversation

markdown
👤 User: How can Dify be deployed?

🤖 AI (grounded in the knowledge base):
According to the documentation, Dify supports two deployment models:

1. **Cloud**
   - Nothing to deploy, ready to use
   - Good for trying it out and small projects
   - Limitation: the free tier allows at most 5 applications

2. **Self-hosted**
   - Full control, no platform limits
   - Good for enterprise use and data control
   - Supports Docker, Kubernetes and similar

See page 42 of the documentation for more.

Scenario 5: using vision models

Dify can analyze images with vision models.

1. Pick a vision model

Supported models:

  • Qwen-VL Plusqwen-vl-plus (general vision understanding)
  • QVQqvq-72b-preview (visual reasoning)
  • GPT-4Vgpt-4-vision-preview (OpenAI)

2. Enable vision

  1. Select a vision model in your chatbot
  2. A "Vision" toggle appears on the left
  3. Turn it on

3. Upload an image and ask

  1. Click the 📎 image button in the chat panel
  2. Upload an image (JPG, PNG or WebP)
  3. Ask your question

Example:

markdown
👤 User: [uploads a product photo] What are this product's features?

🤖 AI (Qwen-VL Plus):
Based on the image, this is a smartwatch. Key features:

1. **Design**
   - Round face, metal construction
   - Sporty style, suitable for everyday wear

2. **Functionality**
   - Touchscreen display
   - Activity tracking
   - Heart rate monitoring

3. **Who it suits**
   - Fitness enthusiasts
   - People tracking their health

Advanced features

1. Calling models through HTTP nodes

Some models (Qwen-Omni, Qwen-Audio, Qwen-OCR) cannot be configured directly in Dify and need an HTTP node.

How to configure it

Step 1: create a workflow

Add an HTTP request node.

Step 2: configure the request

json
{
  "url": "https://api.your-domain.com/v1/audio/transcriptions",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer sk-xxxxxxxxxxxxxxxx",
    "Content-Type": "application/json"
  },
  "body": {
    "model": "qwen-audio-turbo",
    "audio": "{{audio_base64}}",
    "prompt": "Transcribe this audio"
  }
}
json
{
  "url": "https://api.your-domain.com/v1/ocr",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer sk-xxxxxxxxxxxxxxxx",
    "Content-Type": "application/json"
  },
  "body": {
    "model": "qwen-ocr",
    "image": "{{image_url}}",
    "task": "ocr"
  }
}

Step 3: handle the response

Add a Code node to parse it:

python
import json

def main(response):
    data = json.loads(response)
    result = data.get('result', '')
    return {
        "output": result
    }

Prefer streaming

To reduce the chance of an HTTP node timing out, call the API in streaming mode.

Add this to the request body:

json
{
  "stream": true
}

2. Publishing an API

Publish your application as an API for external callers.

Steps

  1. Click "Publish" in the top right of the app page
  2. Choose "Publish as API"
  3. Configure:
    • API name
    • Access permissions
    • Rate limits
  4. Collect the API key and endpoint documentation

Example call

bash
curl -X POST https://api.dify.ai/v1/chat-messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": {},
    "query": "Hello",
    "response_mode": "streaming",
    "user": "user123"
  }'

3. Webhook integration

Connect Dify applications to other systems through webhooks.

Supported platforms:

  • DingTalk bots
  • WeCom
  • Slack
  • Discord
  • Custom webhooks

FAQ

Q1: I get an error when configuring the API key

Message: Invalid API-key provided

Common causes and fixes:

Cause 1: an unstable plugin version

Fix:

  • ✅ Uninstall the current plugin
  • ✅ Install an older version (such as v0.0.40)
  • ✅ Reconfigure the API key

Cause 2: a sub-workspace API key

Background:

  • Plugin v0.0.41 validates permission to call qwen-turbo
  • Sub-workspaces may not have that permission

Fix:

  • ✅ Use an API key from the default workspace
  • ✅ Or grant qwen-turbo permission to that workspace
  • ✅ Or downgrade to v0.0.40

Cause 3: the wrong endpoint setting

Fix:

  • ✅ Mainland China API key → set "use international endpoint" to No
  • ✅ International API key → set "use international endpoint" to Yes

Q2: How do I use Qwen-Omni / Qwen-Audio / Qwen-OCR?

These models cannot be configured directly in Dify.

Solution:

Call them from an HTTP node inside a Chatflow or workflow.

Key points:

  • ✅ Use an HTTP node to call the API
  • ✅ Prefer streaming to reduce timeout risk
  • ✅ Add error handling

See calling models through HTTP nodes.


Q3: How do I use the image generation models?

Dify does not ship an official plugin for them.

Solution:

Use our workflow templates.

Summary:

  1. Download a template (text-to-image / text-to-video)
  2. Import it into Dify
  3. Set the DASHSCOPE_API_KEY environment variable
  4. Run a test
  5. (Optional) publish it as a tool

See scenario 3: build a workflow.

Notes:

  • Video generation takes a while (5 minutes or more)
  • The templates default to wanx2.1-t2i-turbo and wanx2.1-t2v-turbo
  • You can change the model in the workflow node

Q4: How do I self-host Dify?

Dify Cloud has limits (such as 5 applications), so self-hosting suits enterprise use.

Deployment options

OptionDifficultyBest for
Docker Compose⭐⭐Single host, quick testing
Kubernetes⭐⭐⭐⭐Production, high availability
Cloud templates⭐⭐⭐Enterprise, one-click deployment

Step 1: prepare the environment

bash
# Install Docker and Docker Compose
curl -fsSL https://get.docker.com | sh

Step 2: download the configuration

bash
git clone https://github.com/langgenius/dify.git
cd dify/docker

Step 3: configure environment variables

Edit the .env file:

bash
# Database configuration
POSTGRES_PASSWORD=your_password
REDIS_PASSWORD=your_password

# Application configuration
SECRET_KEY=your_secret_key
API_URL=http://your-domain.com
CONSOLE_URL=http://your-domain.com/console

# Model configuration (optional)
# OPENAI_API_KEY=sk-xxx

Step 4: start the services

bash
docker-compose up -d

Step 5: open the application

Visit http://localhost in your browser.


Q5: How do I reduce token usage?

Strategies

1. Model selection

  • Simple tasks: qwen-turbo (lower cost)
  • Complex tasks: qwen-plus or qwen-max

2. Prompt tuning

  • Trim the system prompt
  • Drop unnecessary examples
  • Use variables instead of repeated text

3. Knowledge base tuning

  • Lower Top K to retrieve fewer chunks
  • Raise the score threshold to filter weak matches
  • Tune the document chunk size

4. Workflow tuning

  • Remove unnecessary LLM nodes
  • Use conditional branches to avoid duplicate calls
  • Cache frequently used results

5. Conversation history

  • Limit the number of turns (5–10 works well)
  • Clear conversations you no longer need
  • Use summarization to compress history

Best practices

1. Prompt design

Structured prompts

A useful format:

## Role
You are a [specific role] skilled at [specific capability].

## Task
Based on the user's input, do the following:
1. [Task 1]
2. [Task 2]

## Requirements
- [Requirement 1]
- [Requirement 2]

## Output format
[The format you expect]

Example prompt

A support bot:

## Role
You are SeaWhale AI's support assistant: professional, friendly and efficient.

## Task
1. Understand the user's question
2. Provide an accurate solution
3. Point to documentation where it helps

## Requirements
- Keep replies concise, under 200 words
- Use a friendly tone
- Include documentation links for technical questions

## Output format
Markdown, containing:
- A restatement of the problem
- The solution
- Related links (if any)

2. Workflow design principles

Modular design

  • Give each node a single responsibility
  • Wrap complex logic in sub-workflows
  • Favor reuse and maintainability

Error handling

  • Add exception-handling nodes
  • Set timeouts and retries
  • Log errors

Performance

  • Reduce unnecessary LLM calls
  • Cache where you can
  • Run independent tasks in parallel

3. Knowledge base management

Document conventions

  • Use a consistent format and structure
  • Add metadata (title, tags, date)
  • Refresh outdated content regularly

Chunking strategy

  • Chunk semantically so each piece stands alone
  • Chunk size: 500–1000 characters
  • Overlap: 50–100 characters

Vectorization

  • Choose an embedding model that fits your data
  • Rebuild indexes periodically
  • Monitor retrieval quality

4. Security recommendations

Security

  • 🔒 Never hard-code secrets in prompts
  • 🔒 Store API keys in environment variables
  • 🔒 Rotate keys periodically
  • 🔒 Set up API access control
  • 🔒 Monitor for unusual calls
  • 🔒 Keep self-hosted deployments updated

Comparing developer tools

ToolTypeHighlightsBest forDocumentation
DifyLow-code platformVisual, many application typesAI app development, enterpriseThis guide
ClineVSCode extensionPlan/Act modes, automationCode development, project workRead
Claude CodeCLIConversational programmingScripting, terminal usersRead
Cherry StudioDesktop appMCP integration, knowledge basesPower users, researchRead
ChatboxAll platformsSimple and approachableQuick chat, general usersRead

Support

ChannelResponse timeContact
📖 DocumentationImmediateRead the docs
💬 Live supportWeekdays 9:00–18:00Contact support
📧 Email supportWithin 24 hourssupport@atalk-ai.com
🐛 Bug reportsWithin 48 hoursSubmit feedback

External resources


Going further

1. Developing custom plugins

Dify supports custom plugins for extending its functionality.

Plugin types:

  • Model providers
  • Tool nodes
  • Data source connectors

How to build one:

  1. Read the Dify plugin documentation
  2. Clone the plugin template
  3. Implement the interface methods
  4. Test locally
  5. Publish to the marketplace

2. Multilingual applications

Building AI applications for several languages:

Option 1: separate applications

  • Create one application per language
  • Route users based on their language

Option 2: dynamic prompts

  • Detect the user's language with a variable
  • Generate the prompt in that language

Option 3: a translation node

  • Add a translation API node
  • Process everything in one language internally
  • Translate back to the user's language at the end

3. Data analysis applications

Building analytics applications with Dify:

Steps:

  1. Connect to a database through an HTTP node
  2. Process the data in a code node
  3. Generate the analysis with an LLM node
  4. Present the results visually

Example use cases:

  • Sales analysis
  • User behavior analysis
  • Financial reporting

Changelog

2025-11-27

  • ✨ Added the full SeaWhale AI integration guide
  • 📝 Expanded the application scenario examples
  • 🔧 Clarified the configuration steps
  • 📖 Added a best practices section
  • 🐛 Reworked the FAQ

2025-10-15

  • 🎉 Initial release

Contributing

Feedback

We welcome suggestions for improving this documentation:

  1. Visit the feedback page
  2. Describe your suggestion or the problem you hit
  3. We review and act on feedback promptly

Share what you build

If you build something good with Dify + SeaWhale AI:

  1. 📧 Email support@atalk-ai.com
  2. 📝 Include a description and screenshots
  3. 🎁 Standout projects get promotion and rewards