The Dify Plugin SDK allows developers to build custom plugins for the Dify platform. It provides classes and decorators to define plugin metadata, inputs, outputs, and API endpoints, enabling seamless integration with Dify AI applications. Currently at version 0.7.4, the library is under active development with frequent releases.
pip install dify-pluginVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a basic Dify plugin with metadata, inputs, outputs, and a single API endpoint. The `plugin.run()` call starts a local server for development and testing, exposing the plugin's OpenAPI specification.
Refer to the official GitHub repository's release notes and README for the latest API specifications and migration guides when upgrading.
Ensure your development environment and deployment target use Python 3.11 or a newer compatible version.
Always use `@plugin.api()` on functions intended to be called by Dify, matching the endpoint name defined in your Dify plugin configuration.
Carefully review and provide all required fields in `PluginMetadata`, ensuring they accurately reflect your plugin's purpose and interface.