Build DeepSeek RAG Knowledge Bases and Workflows with Dify
Dify is the leading low-code platform for LLM applications. Learn how to configure DeepSeek API, build production RAG knowledge bases, and design automated agent workflows in Dify.
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
Whether using 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
Leverage DeepSeek's long-context fidelity for document Q&A:
- 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.