A model plugin describes itself with two entities: a Provider that handles authentication and lists supported models, and one AIModelEntity per model declaring its type, features, and parameters.
All entities below are Pydantic BaseModel subclasses from the dify_plugin.entities.model module.
Quick Decision#
User pastes an API key, gets your full model list. Set configurate_methods: [predefined-model] and define each model’s AIModelEntity in YAML.
User configures their own model name and base URL (OpenAI-compatible endpoints, custom deployments). Use configurate_methods: [customizable-model] and see Customizable Model.
Built-in catalog plus user-added custom models. Combine both configurate_methods values.
For an end-to-end example, see Creating a New Model Provider.
Provider#
Provider identifier, for example openai.
Background color value, for example #FFFFFF. If empty, the frontend default color is used.
Supported model types.
Configuration methods.
Provider credential specification.
Model credential specification.
AIModelEntity#
Model identifier, for example gpt-3.5-turbo.
Model type.
Supported features.
Model properties.
Mode (model type llm).
Context size (model types llm and text-embedding).
Maximum number of chunks (model types text-embedding and moderation).
Maximum file upload size in MB (model type speech2text).
Supported file extensions, for example mp3,mp4 (model type speech2text).
Default voice; one of alloy, echo, fable, onyx, nova, shimmer (model type tts).
Word limit per conversion; defaults to splitting by paragraph (model type tts).
Supported audio file extensions, for example mp3,wav (model type tts).
Number of concurrent text-to-audio conversion tasks (model type tts).
Maximum characters per chunk (model type moderation).
Rules for model call parameters.
Pricing information.
Whether the model is deprecated. Deprecated models no longer appear in the model list, but existing configurations keep working. Defaults to False.
ModelType#
Text generation model.
Text embedding model.
Rerank model.
Speech to text.
Text to speech.
Content moderation.
ConfigurateMethod#
Predefined model. The user configures unified provider credentials once to use all predefined models under the provider.
Customizable model. The user adds a credential configuration for each model.
Fetch from remote. Like predefined-model, only unified provider credentials are needed, but the model list is fetched from the provider using those credentials.
ModelFeature#
Agent reasoning. Generally, models over 70B have chain-of-thought capabilities.
Vision (image understanding).
Tool calling.
Multiple tool calling.
Streaming tool calling.
FetchFrom#
Predefined model.
Remote model.
LLMMode#
Text completion.
Chat.
ParameterRule#
Actual parameter name used in the model call.
Template to use.
Five parameter templates are predefined:
temperaturetop_pfrequency_penaltypresence_penaltymax_tokens
Set one of these names in use_template to inherit the default configuration from entities.defaults.PARAMETER_RULE_TEMPLATE; you then only need name and use_template. Any additional parameters you set override the template defaults. See openai/llm/gpt-3.5-turbo.yaml and the examples in Creating a New Model Provider.
Whether the parameter is required. Defaults to False.
Default value.
Minimum value. Numeric types only.
Maximum value. Numeric types only.
Number of decimal places to keep. Numeric types only.
Dropdown option values. Only applies when type is string. If not set or null, values are unrestricted.
PriceConfig#
Input (prompt) unit price.
Output (returned content) unit price.
Price unit. For example, if pricing is per 1M tokens, the unit token count corresponding to the unit price is 0.000001.
Currency unit.
ProviderCredentialSchema#
Credential form specification.
ModelCredentialSchema#
Credential form specification.
CredentialFormSchema#
Form item variable name.
Form item type.
Whether the form item is required.
Default value.
Dropdown content. Specific to the select and radio types.
Maximum input length. Specific to the text-input type. 0 means no limit.
Show this item only when other form item values meet the given conditions. Empty means always show.
FormType#
Text input component.
Password input component.
Single-select dropdown.
Radio component.
Switch component. Only supports true and false.
FormOption#
Dropdown option value.
Show this option only when other form item values meet the given conditions. Empty means always show.
FormShowOnObject#
Variable name of the other form item.
Variable value of the other form item.
Related Resources#
- Model Architecture Details—architecture specifications for model plugins
- Quickly Integrate a New Model—apply these rules to add new models
- General Specifications—plugin manifest configuration
- Create a New Model Provider—develop a new model provider plugin