Skip to main content
本文档由 AI 自动翻译。如有任何不准确之处,请参考 英文原版

环境要求

  • Python 版本 3.12
  • Dify 插件脚手架工具(dify-plugin-daemon
配置说明详见 初始化开发工具

获取 Dify 插件开发包

从 GitHub releases 页面下载 Dify Plugin CLI

不同平台的安装方法

macOS Brew(全局安装)
brew tap langgenius/dify
brew install dify
安装完成后,打开一个新的终端窗口并输入 dify version 命令。如果输出版本信息,则表示安装成功。 macOS ARM(M 系列芯片)
# Download dify-plugin-darwin-arm64
chmod +x dify-plugin-darwin-arm64
./dify-plugin-darwin-arm64 version
macOS Intel
# Download dify-plugin-darwin-amd64
chmod +x dify-plugin-darwin-amd64
./dify-plugin-darwin-amd64 version
Linux
# Download dify-plugin-linux-amd64
chmod +x dify-plugin-linux-amd64
./dify-plugin-linux-amd64 version
全局安装(推荐)
# Rename and move to system path
# Example (macOS ARM)
mv dify-plugin-darwin-arm64 dify
sudo mv dify /usr/local/bin/
dify version

运行开发包

以下示例均以 dify 作为命令。如果你采用本地安装方式,请相应替换命令,例如 ./dify-plugin-darwin-arm64 plugin init

插件开发流程

1. 创建新插件

./dify plugin init
按照提示完成基本的插件信息配置。 完整教程详见 Dify 插件开发:Hello World 指南

2. 以开发模式运行

配置 .env 文件,然后在插件目录中运行以下命令:
python -m main
调试细节详见 远程调试插件

3. 打包和部署

打包插件:
cd ..
dify plugin package ./yourapp
发布细节详见 发布概览

插件类别

工具标签

类别标签在 ToolLabelEnum 中定义:
class ToolLabelEnum(Enum):
    SEARCH = "search"
    IMAGE = "image"
    VIDEOS = "videos"
    WEATHER = "weather"
    FINANCE = "finance"
    DESIGN = "design"
    TRAVEL = "travel"
    SOCIAL = "social"
    NEWS = "news"
    MEDICAL = "medical"
    PRODUCTIVITY = "productivity"
    EDUCATION = "education"
    BUSINESS = "business"
    ENTERTAINMENT = "entertainment"
    UTILITIES = "utilities"
    OTHER = "other"

插件类型参考

Dify 支持多种插件类型:
Last modified on June 25, 2026