Build DeepSeek RAG & Agent Workflows in Dify
Connect DeepSeek API to Dify Cloud or self-hosted Docker deployments, configure embedding providers for RAG indexing, and build multi-node workflows.
On this page
- Provider type: DeepSeek or OpenAI-API-compatible
- API Base URL:
https://api.deepseek.comorhttps://api.deepseek.com/v1 - Model for daily tasks / Agent:
deepseek-chat(Supports tool execution) - Model for deep reasoning:
deepseek-reasoner(R1 chain of thought)
Add DeepSeek model provider in Dify
In Dify Cloud or a self-hosted Docker deployment:
- Log in to Dify and navigate to Settings → Model Providers via your profile icon in the top right.
- Locate DeepSeek (or select OpenAI-API-compatible).
- Click Set / Add Credentials:
- API Key: Your
sk-...key from the DeepSeek Platform. - API Base URL:
https://api.deepseek.com
- API Key: Your
- Save the settings and verify that
deepseek-chatanddeepseek-reasonershow active status.
Build an enterprise RAG knowledge base
Configure an Embedding provider first: Official DeepSeek API only provides chat and reasoning models, not text embeddings. Before creating a knowledge base, add an embedding-capable provider under Settings → Model Providers (such as SiliconFlow, OpenAI, or local Ollama/BGE) so Dify can index your uploaded files.
Once an embedding model is active, create your knowledge base:
- Click Knowledge → Create Knowledge in the top navigation.
- Upload your internal documents (PDF, DOCX, Markdown, CSV).
- Recommended segmentation: Choose Custom chunking with max segment length around
800 ~ 1000tokens and overlap of100tokens. - Retrieval mode: Select Hybrid Search (combining vector embeddings and keyword search) paired with a Reranking model for optimal precision.
Design automated visual workflows
Create a Workflow application to orchestrate multi-step data pipelines:
Information extraction & JSON transformation
Use a deepseek-chat node to extract structured entities from unstructured customer queries, passing the parsed output to Dify Code nodes for API integration.
Complex synthesis & report generation
Deploy a deepseek-reasoner node after knowledge retrieval steps to synthesize comprehensive, audit-ready technical briefs and business proposals.
Troubleshooting
Embedding model missing or failed
DeepSeek API provides language generation and reasoning endpoints rather than embedding vectors. Configure an embedding provider (such as SiliconFlow, OpenAI text-embedding-3, or local BGE) in Dify for document indexing.
401 Authentication Error
Verify that your API key is pasted accurately without extra spaces, and ensure your DeepSeek Platform account has positive balance.