This document guides non-professional developers on how to add new models to Dify, focusing on adding new model versions to existing model providers by modifying configuration files. Includes the complete process of forking the repository, copying and modifying model configurations, updating provider version, local testing, and submitting contributions.
Welcome to the world of Dify plugin development! Dify’s powerful functionality depends on the collective efforts of community contributors. We believe that even if you’re not a professional programmer, as long as you’re passionate about AI technology and willing to research information, you can contribute to Dify—for example, by helping Dify support more and newer AI models.
This article will guide you, in the simplest way possible, through completing the most common and straightforward contribution: adding a new model version to a model provider that Dify already supports. This approach typically only requires modifying configuration files, without writing code, making it perfect for your first contribution!
Related Concepts: Before starting, we recommend reading the Model Plugin documentation to understand the basic concepts and structure of model plugins.
This quick integration method is suitable for:
(If the model you need to add requires new API logic or supports special functionality, it will involve Python code writing. Please refer to Creating a New Model Provider for more detailed guidance.)
Preparation:
Steps:
Fork & Clone the Official Plugin Repository:
https://github.com/langgenius/dify-official-plugins
.Find and Copy the Model Configuration File:
models/
directory, find the provider folder for the model you want to add, for example vertex_ai
.models/llm/
(if it’s a text generation model).gemini-1.0-pro-001.yaml
).gemini-1.5-pro-latest.yaml
).Modify the Model Configuration (YAML):
gemini-1.5-pro-latest.yaml
).model
: Must be updated to the official API identifier for the new version.label
: Must be updated to the model name displayed to users in the Dify interface (recommend providing both en_US
and zh_Hans
languages).model_properties
: Update context_size
(context window size).parameter_rules
: Check and update model parameter limitations, especially the default
, min
, and max
values for max_tokens
(maximum output token count).pricing
: Update the model’s input
and output
pricing, as well as the unit
(typically 0.000001
representing per million tokens) and currency
.Example (Adding Gemini 1.5 Pro):
Parameter | Old Model (Example) | New Gemini 1.5 Pro (Example) | Notes |
---|---|---|---|
model | gemini-1.0-pro-001 | gemini-1.5-pro-latest | Must change to official model ID |
label: en_US | Gemini 1.0 Pro | Gemini 1.5 Pro | Must change user-visible label |
context_size | 30720 | 1048576 | Must change per official docs |
max_tokens (below) | 2048 | 8192 | Must change default/max values |
Update the Provider Manifest Version:
models/vertex_ai/
).manifest.yaml
file.version
field by a minor version number (e.g., version: 0.0.8
-> version: 0.0.9
). This tells Dify that this is an update.Package and Local Testing:
dify-official-plugins
repository (the directory containing folders like models
, tools
, etc.).plugin packaged successfully, output path: <provider_name>.difypkg
, and a plugin package file named <provider_name>.difypkg
will be generated in the current project root directory.<provider_name>.difypkg
file you just generated locally.Submit Your Contribution:
manifest.yaml
) via Git and push them to your forked GitHub repository.langgenius/dify-official-plugins
repository. In the PR description, briefly mention which model you added and include a link to the model’s official documentation to facilitate reviewer verification of parameters.What’s Next?
Once your PR is reviewed, approved, and merged, your contribution becomes part of the official Dify plugins, and all Dify users can easily use this new model!
This quick integration method is the fastest way to make Dify support new models. Of course, if this model needs to support more complex features in the future (such as image input, function calling, etc.), then experienced developers may need to update the plugin at the code level. But the step you’ve completed now is already a very valuable contribution!
Explore More:
manifest.yaml
)Edit this page | Report an issue