Dify: App Types, Self-Hosting, and API Integration Explained
Dify is an open-source platform for building AI applications with agents, agentic workflows, and chatbots grounded in your own data. This guide compares Cloud and self-hosted deployment, walks through the Docker Compose steps, explains the plugin types and app patterns, and flags the security settings that matter before a team rollout.
View 4 referencesAllow the functional cookie to save your likes. Privacy details
Dify is an open-source platform for building AI applications with agents, agentic workflows, and chatbots grounded in your own data. It can run as a managed cloud service or on your own infrastructure with Docker Compose, and apps can be published as web apps or integrated through APIs. Official documentation
What is Dify?
Dify is an open-source platform for building AI applications. You create agents, agentic workflows, and chatbots that draw on your own data, then publish them as web apps or integrate them through APIs. The name comes from "Do It For You". The docs also expose a REST API, a difyctl CLI, and a plugin framework for extending models and tools.
Which Dify app type should you choose?
Choose a workflow when the steps are fixed, an agent when the model must pick tools at runtime, and a chatbot when the main surface is a conversation. Dify's quick start builds a content generator as a workflow: user input, model nodes, and formatted output. The canvas shows every node, so one app combines deterministic steps with model calls. Quick start
| Need | Dify pattern |
|---|---|
| Fixed sequence of steps | Workflow |
| Conversation with memory | Chatbot or chatflow |
| Model chooses tools | Agent |
| One-off text transformation | Text generator |
How do you run Dify: Cloud or self-hosted?
Dify Cloud is the managed option and needs no installation; new accounts start on a Sandbox plan with 200 one-time AI credits. Self-hosting runs the open-source Community Edition on your own infrastructure. Choose Cloud to prototype quickly, and self-host when data residency, private model endpoints, or internal network access decide the deployment.
How do you self-host Dify with Docker Compose?
The default Compose stack bundles PostgreSQL, Weaviate, and the other services, so no separate database setup is needed. Hardware requirements are at least 2 CPU cores and 4 GiB RAM, with Docker Compose 2.35.0 or later, Git, and OpenSSL. Deployment guide
- Clone a release:
git clone --branch <version> --depth 1 https://github.com/langgenius/dify.git, thencd dify/docker. - Configure: copy
.env.exampleto.env, generate a token withopenssl rand -hex 32, and setDIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN. - Start: run
docker compose up -dand check withdocker compose ps --all. - Install: open
http://localhost/install, create the administrator account, then sign in athttp://localhost.
Changing the vector store or database after first start does not migrate existing data, so decide before initial boot.
How do you integrate a Dify app through API or CLI?
Dify exposes a REST API for embedding published apps in your own product and a difyctl CLI for running apps from terminals, scripts, CI, and other AI agents. Use the API when a web or backend product calls the app; use the CLI for automation and pipelines. Both treat the published app as the boundary rather than internal services.
What can Dify plugins do?
Plugins extend Dify with models, tools, agent strategies, extensions, and bundles. Model plugins connect LLM providers; tool plugins wrap third-party services for chatflows, workflows, or agents; agent strategy plugins define tool selection and result handling. The Dify Marketplace distributes community and official plugins, and publishing requires a .difypkg package and a pull request. Plugin documentation
How do you add your own data to a Dify app?
Dify's RAG pipeline lets an app draw on your documents rather than only the model's training data. In practice you upload files to a knowledge base, choose how they are chunked and indexed, then add a knowledge-retrieval node to a workflow. The retrieved passages become context for the model call, and the app can cite them in its answer.
Start with a small, clean document set and check retrieved passages manually before widening the collection. Retrieval quality usually matters more than model choice: if the right passage is not retrieved, a stronger model cannot recover it. Vector-store choice is a deployment decision made at first start; switching VECTOR_STORE later does not migrate existing knowledge bases.
What are the security considerations for self-hosted Dify?
Before exposing a deployment, replace the bundled credentials: DB_PASSWORD, REDIS_PASSWORD, SANDBOX_API_KEY, CODE_EXECUTION_API_KEY, WEAVIATE_API_KEY, PLUGIN_DAEMON_KEY, and PLUGIN_DIFY_INNER_API_KEY. Configure HTTPS before sharing access. Leave SECRET_KEY untouched after first start, because changing it invalidates signed tokens and file links for every user.
The default stack publishes no host ports for the database, Redis, code sandbox, or Weaviate; keep them private on the network too.
This guide reflects Dify documentation checked on December 2, 2026, including a deployment page last modified November 18, 2026.
Dify FAQ
Do I need to bring my own model API key?
On Dify Cloud, the Sandbox plan includes one-time AI credits for providers such as OpenAI, Anthropic, and Gemini, and the quick start uses those without a key. Beyond the credits, you configure your own provider and key. Self-hosted deployments always need model credentials you control.
Is Dify a no-code tool?
It is low-code rather than strictly no-code. You assemble apps on a visual canvas, but the API, CLI, and plugin system are developer-facing. Teams typically start with a workflow in Studio and move to the REST API once the app is embedded in a product. Self-hosting also needs Docker and basic environment-variable management.