AI & LLMs · Guide · AI & Prompt Tools
How to Use Dify
Self-hosting Dify, visual workflows, agents, datasets, apps (chatbot/completion), API keys, monitoring.
Dify is an open-source LLMOps platform that ships visual workflows, agents, datasets, and APIs in one stack.
Advertisement
Dify positions itself between “no-code builder” and “full LLMOps platform.” You design prompts and agents in a browser, attach datasets for RAG, and the platform exposes them as REST APIs with auth, rate limits, and analytics. Self-host for free or use the managed cloud.
What it is
A Python backend (Flask + Celery + Postgres + Redis + a vector store) plus a Next.js frontend. Apps come in four flavors: chat, agent, workflow, and text generation. Datasets handle ingestion and retrieval; models plug in via a provider registry with 30+ vendors supported.
Install / set up
# self-host with docker compose git clone https://github.com/langgenius/dify cd dify/docker cp .env.example .env docker compose up -d
First run
Browse to http://localhost, create the admin account, and wire up a model provider (OpenAI, Anthropic, or a local Ollama endpoint). Click Create App, pick Chatbot, write a system prompt, and publish — Dify generates a shareable URL and an API token.
$ curl -X POST http://localhost/v1/chat-messages \
-H "Authorization: Bearer app-xxx" \
-d '{"inputs":{},"query":"hi","user":"u1"}'
{"answer":"Hello!","conversation_id":"..."}Everyday workflows
- Build a RAG chatbot by creating a dataset, uploading files, and toggling retrieval on in the app settings.
- Use the Workflow app type to chain HTTP calls, LLM nodes, code blocks, and conditionals for deterministic pipelines.
- Ship an internal tool by embedding the generated web app URL or calling the API from your existing product.
Gotchas and tips
The Docker Compose stack pulls a lot of images (Postgres, Redis, Weaviate, sandbox, SSRF proxy). Budget 4–6 GB of RAM minimum and don’t run it on a 1 GB VPS. The sandbox container runs user code and needs privileged or a seccomp profile — read the security docs before exposing Dify publicly.
Version upgrades occasionally require database migrations that aren’t automatic. Snapshot your Postgres volume before docker compose pull. The team moves quickly and breaking changes do happen between minor versions.
Who it’s for
Product teams that want to ship LLM features without building the platform layer. If you need prompts, datasets, auth, logs, and an API gateway in one package, Dify is the most complete open-source option today.
Use these while you read
Tools that pair with this guide
- System Prompt BuilderCompose a focused system prompt from a role, tone, constraints, and output format — copy-ready for any LLM.AI & Prompt Tools
- AI Prompt GeneratorTurn a vague idea into a structured prompt. Pick role, task, context, constraints, and output format. Works with ChatGPT, Claude, and Gemini.AI & Prompt Tools
- AI Token CounterEstimate tokens, characters, words, and approximate API cost for GPT-4o, GPT-4, Claude, and Gemini — before you hit send.AI & Prompt Tools
- AI Output Length EstimatorPredict how many tokens an LLM will generate for summaries, rewrites, code, or essays — and budget max_tokens. Free, instant, no sign-up needed.AI & Prompt Tools
Advertisement
Continue reading
- AI & LLMsGitHub Copilot Pricing and ComparisonCompare free vs paid GitHub Copilot tiers and analyze it against ChatGPT, Cursor, and Tabnine. Find the best value plan instantly with this free online guide.
- AI & LLMsGitHub Copilot Features and CapabilitiesTest what Copilot really does — code accuracy, scope limits, debugging, web dev, legacy code, tests, docs, team customization. Free guide, no sign-up.
- AI & LLMsGitHub Copilot Security and Data HandlingAudit where your code goes, who sees it, training-data policy, network needs, and what happens when Copilot suggests broken code. Free, no sign-up.
- AI & LLMsAI Fluency SkillsThe 8 sub-skills of AI fluency: prompt structure, model selection, tool use, quality calibration, iteration, context management, cost awareness, privacy.
- AI & LLMsAnthropic Skills ExplainedSkills as Anthropic's answer to Custom GPTs — markdown-defined, version-controlled in git, work in terminal. Anatomy + Skills vs Custom GPTs.
- AI & LLMsKimi K2 vs DeepSeek V3Two open-weight Chinese flagships. Kimi K2 = 1M context, DeepSeek V3.2 = top-tier reasoning + coding. Pick by use case.