> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-docs-new-agent-experience.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Specs

> Reference for the entities that define a Dify model plugin, including Provider, AIModelEntity, model types, configuration methods, parameter rules, and credential schemas

A model plugin describes itself with two entities: a [Provider](#provider) that handles authentication and lists supported models, and one [AIModelEntity](#aimodelentity) per model declaring its type, features, and parameters.

<Note>
  All entities below are `Pydantic BaseModel` subclasses from the `dify_plugin.entities.model` module.
</Note>

## Quick Decision

<CardGroup cols={2}>
  <Card title="Authentication only: predefined models" icon="key">
    User pastes an API key, gets your full model list. Set `configurate_methods: [predefined-model]` and define each model's AIModelEntity in YAML.
  </Card>

  <Card title="User-supplied models" icon="user-pen">
    User configures their own model name and base URL (OpenAI-compatible endpoints, custom deployments). Use `configurate_methods: [customizable-model]` and see [Customizable Model](/en/develop-plugin/features-and-specs/advanced-development/customizable-model).
  </Card>

  <Card title="Mixed" icon="layer-group">
    Built-in catalog plus user-added custom models. Combine both `configurate_methods` values.
  </Card>

  <Card title="Walkthrough" icon="route">
    For an end-to-end example, see [Creating a New Model Provider](/en/develop-plugin/dev-guides-and-walkthroughs/creating-new-model-provider).
  </Card>
</CardGroup>

## Provider

<ParamField path="provider" type="string">
  Provider identifier, for example `openai`.
</ParamField>

<ParamField path="label" type="object">
  Provider display name (i18n). Supports `en_US` (English) and `zh_Hans` (Chinese).

  <ParamField path="zh_Hans" type="string">
    Chinese label. Falls back to `en_US` if not set.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English label
  </ParamField>
</ParamField>

<ParamField path="description" type="object">
  Provider description (i18n).

  <ParamField path="zh_Hans" type="string">
    Chinese description.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English description.
  </ParamField>
</ParamField>

<ParamField path="icon_small" type="object">
  Small provider icon, stored in the `_assets` directory under the provider implementation directory.

  <ParamField path="zh_Hans" type="string">
    Chinese icon.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English icon.
  </ParamField>
</ParamField>

<ParamField path="icon_large" type="object">
  Large provider icon, stored in the `_assets` directory under the provider implementation directory.

  <ParamField path="zh_Hans" type="string">
    Chinese icon.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English icon.
  </ParamField>
</ParamField>

<ParamField path="background" type="string">
  Background color value, for example `#FFFFFF`. If empty, the frontend default color is used.
</ParamField>

<ParamField path="help" type="object">
  Help information.

  <ParamField path="title" type="object">
    Help title (i18n).

    <ParamField path="zh_Hans" type="string">
      Chinese title.
    </ParamField>

    <ParamField path="en_US" type="string" required>
      English title.
    </ParamField>
  </ParamField>

  <ParamField path="url" type="object">
    Help link (i18n).

    <ParamField path="zh_Hans" type="string">
      Chinese link.
    </ParamField>

    <ParamField path="en_US" type="string" required>
      English link.
    </ParamField>
  </ParamField>
</ParamField>

<ParamField path="supported_model_types" type="array[ModelType]" required>
  Supported model types.
</ParamField>

<ParamField path="configurate_methods" type="array[ConfigurateMethod]" required>
  Configuration methods.
</ParamField>

<ParamField path="provider_credential_schema" type="ProviderCredentialSchema" required>
  Provider credential specification.
</ParamField>

<ParamField path="model_credential_schema" type="ModelCredentialSchema">
  Model credential specification.
</ParamField>

## AIModelEntity

<ParamField path="model" type="string" required>
  Model identifier, for example `gpt-3.5-turbo`.
</ParamField>

<ParamField path="label" type="object">
  Model display name (i18n). Supports `en_US` (English) and `zh_Hans` (Chinese).

  <ParamField path="zh_Hans" type="string">
    Chinese label.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English label.
  </ParamField>
</ParamField>

<ParamField path="model_type" type="ModelType" required>
  Model type.
</ParamField>

<ParamField path="features" type="array[ModelFeature]">
  Supported features.
</ParamField>

<ParamField path="model_properties" type="object" required>
  Model properties.

  <ParamField path="mode" type="LLMMode">
    Mode (model type `llm`).
  </ParamField>

  <ParamField path="context_size" type="integer">
    Context size (model types `llm` and `text-embedding`).
  </ParamField>

  <ParamField path="max_chunks" type="integer">
    Maximum number of chunks (model types `text-embedding` and `moderation`).
  </ParamField>

  <ParamField path="file_upload_limit" type="integer">
    Maximum file upload size in MB (model type `speech2text`).
  </ParamField>

  <ParamField path="supported_file_extensions" type="string">
    Supported file extensions, for example `mp3,mp4` (model type `speech2text`).
  </ParamField>

  <ParamField path="default_voice" type="string">
    Default voice; one of `alloy`, `echo`, `fable`, `onyx`, `nova`, `shimmer` (model type `tts`).
  </ParamField>

  <ParamField path="voices" type="array">
    Available voices (model type `tts`).

    <ParamField path="mode" type="string">
      Voice model.
    </ParamField>

    <ParamField path="name" type="string">
      Voice model display name.
    </ParamField>

    <ParamField path="language" type="string">
      Languages the voice model supports.
    </ParamField>
  </ParamField>

  <ParamField path="word_limit" type="integer">
    Word limit per conversion; defaults to splitting by paragraph (model type `tts`).
  </ParamField>

  <ParamField path="audio_type" type="string">
    Supported audio file extensions, for example `mp3,wav` (model type `tts`).
  </ParamField>

  <ParamField path="max_workers" type="integer">
    Number of concurrent text-to-audio conversion tasks (model type `tts`).
  </ParamField>

  <ParamField path="max_characters_per_chunk" type="integer">
    Maximum characters per chunk (model type `moderation`).
  </ParamField>
</ParamField>

<ParamField path="parameter_rules" type="array[ParameterRule]">
  Rules for model call parameters.
</ParamField>

<ParamField path="pricing" type="PriceConfig">
  Pricing information.
</ParamField>

<ParamField path="deprecated" type="boolean">
  Whether the model is deprecated. Deprecated models no longer appear in the model list, but existing configurations keep working. Defaults to `False`.
</ParamField>

## ModelType

<ParamField path="llm" type="string">
  Text generation model.
</ParamField>

<ParamField path="text-embedding" type="string">
  Text embedding model.
</ParamField>

<ParamField path="rerank" type="string">
  Rerank model.
</ParamField>

<ParamField path="speech2text" type="string">
  Speech to text.
</ParamField>

<ParamField path="tts" type="string">
  Text to speech.
</ParamField>

<ParamField path="moderation" type="string">
  Content moderation.
</ParamField>

## ConfigurateMethod

<ParamField path="predefined-model" type="string">
  Predefined model. The user configures unified provider credentials once to use all predefined models under the provider.
</ParamField>

<ParamField path="customizable-model" type="string">
  Customizable model. The user adds a credential configuration for each model.
</ParamField>

<ParamField path="fetch-from-remote" type="string">
  Fetch from remote. Like `predefined-model`, only unified provider credentials are needed, but the model list is fetched from the provider using those credentials.
</ParamField>

## ModelFeature

<ParamField path="agent-thought" type="string">
  Agent reasoning. Generally, models over 70B have chain-of-thought capabilities.
</ParamField>

<ParamField path="vision" type="string">
  Vision (image understanding).
</ParamField>

<ParamField path="tool-call" type="string">
  Tool calling.
</ParamField>

<ParamField path="multi-tool-call" type="string">
  Multiple tool calling.
</ParamField>

<ParamField path="stream-tool-call" type="string">
  Streaming tool calling.
</ParamField>

## FetchFrom

<ParamField path="predefined-model" type="string">
  Predefined model.
</ParamField>

<ParamField path="fetch-from-remote" type="string">
  Remote model.
</ParamField>

## LLMMode

<ParamField path="completion" type="string">
  Text completion.
</ParamField>

<ParamField path="chat" type="string">
  Chat.
</ParamField>

## ParameterRule

<ParamField path="name" type="string" required>
  Actual parameter name used in the model call.
</ParamField>

<ParamField path="use_template" type="string">
  Template to use.
</ParamField>

Five parameter templates are predefined:

* `temperature`
* `top_p`
* `frequency_penalty`
* `presence_penalty`
* `max_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](/en/develop-plugin/dev-guides-and-walkthroughs/creating-new-model-provider).

<ParamField path="label" type="object">
  Label (i18n).

  <ParamField path="zh_Hans" type="string">
    Chinese label.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English label.
  </ParamField>
</ParamField>

<ParamField path="type" type="string">
  Parameter type.

  <ParamField path="int" type="string">
    Integer.
  </ParamField>

  <ParamField path="float" type="string">
    Floating point.
  </ParamField>

  <ParamField path="string" type="string">
    String.
  </ParamField>

  <ParamField path="boolean" type="string">
    Boolean.
  </ParamField>
</ParamField>

<ParamField path="help" type="object">
  Help information (i18n).

  <ParamField path="zh_Hans" type="string">
    Chinese help text.
  </ParamField>

  <ParamField path="en_US" type="string" required>
    English help text.
  </ParamField>
</ParamField>

<ParamField path="required" type="boolean">
  Whether the parameter is required. Defaults to `False`.
</ParamField>

<ParamField path="default" type="int/float/string/boolean">
  Default value.
</ParamField>

<ParamField path="min" type="int/float">
  Minimum value. Numeric types only.
</ParamField>

<ParamField path="max" type="int/float">
  Maximum value. Numeric types only.
</ParamField>

<ParamField path="precision" type="integer">
  Number of decimal places to keep. Numeric types only.
</ParamField>

<ParamField path="options" type="array[string]">
  Dropdown option values. Only applies when `type` is `string`. If not set or null, values are unrestricted.
</ParamField>

## PriceConfig

<ParamField path="input" type="float">
  Input (prompt) unit price.
</ParamField>

<ParamField path="output" type="float">
  Output (returned content) unit price.
</ParamField>

<ParamField path="unit" type="float">
  Price unit. For example, if pricing is per 1M tokens, the unit token count corresponding to the unit price is `0.000001`.
</ParamField>

<ParamField path="currency" type="string">
  Currency unit.
</ParamField>

## ProviderCredentialSchema

<ParamField path="credential_form_schemas" type="array[CredentialFormSchema]" required>
  Credential form specification.
</ParamField>

## ModelCredentialSchema

<ParamField path="model" type="object" required>
  Model identifier. The default variable name is `model`.

  <ParamField path="label" type="object" required>
    Display name of the model form item.

    <ParamField path="en_US" type="string" required>
      English.
    </ParamField>

    <ParamField path="zh_Hans" type="string">
      Chinese.
    </ParamField>
  </ParamField>

  <ParamField path="placeholder" type="object" required>
    Placeholder text for the model form item.

    <ParamField path="en_US" type="string" required>
      English.
    </ParamField>

    <ParamField path="zh_Hans" type="string">
      Chinese.
    </ParamField>
  </ParamField>
</ParamField>

<ParamField path="credential_form_schemas" type="array[CredentialFormSchema]" required>
  Credential form specification.
</ParamField>

## CredentialFormSchema

<ParamField path="variable" type="string" required>
  Form item variable name.
</ParamField>

<ParamField path="label" type="object" required>
  Form item label.

  <ParamField path="en_US" type="string" required>
    English.
  </ParamField>

  <ParamField path="zh_Hans" type="string">
    Chinese.
  </ParamField>
</ParamField>

<ParamField path="type" type="FormType" required>
  Form item type.
</ParamField>

<ParamField path="required" type="boolean">
  Whether the form item is required.
</ParamField>

<ParamField path="default" type="string">
  Default value.
</ParamField>

<ParamField path="options" type="array[FormOption]">
  Dropdown content. Specific to the `select` and `radio` types.
</ParamField>

<ParamField path="placeholder" type="object">
  Form item placeholder. Specific to the `text-input` type.

  <ParamField path="en_US" type="string" required>
    English.
  </ParamField>

  <ParamField path="zh_Hans" type="string">
    Chinese.
  </ParamField>
</ParamField>

<ParamField path="max_length" type="integer">
  Maximum input length. Specific to the `text-input` type. `0` means no limit.
</ParamField>

<ParamField path="show_on" type="array[FormShowOnObject]">
  Show this item only when other form item values meet the given conditions. Empty means always show.
</ParamField>

### FormType

<ParamField path="text-input" type="string">
  Text input component.
</ParamField>

<ParamField path="secret-input" type="string">
  Password input component.
</ParamField>

<ParamField path="select" type="string">
  Single-select dropdown.
</ParamField>

<ParamField path="radio" type="string">
  Radio component.
</ParamField>

<ParamField path="switch" type="string">
  Switch component. Only supports `true` and `false`.
</ParamField>

### FormOption

<ParamField path="label" type="object" required>
  Label.

  <ParamField path="en_US" type="string" required>
    English.
  </ParamField>

  <ParamField path="zh_Hans" type="string">
    Chinese.
  </ParamField>
</ParamField>

<ParamField path="value" type="string" required>
  Dropdown option value.
</ParamField>

<ParamField path="show_on" type="array[FormShowOnObject]">
  Show this option only when other form item values meet the given conditions. Empty means always show.
</ParamField>

### FormShowOnObject

<ParamField path="variable" type="string" required>
  Variable name of the other form item.
</ParamField>

<ParamField path="value" type="string" required>
  Variable value of the other form item.
</ParamField>

## Related Resources

* [Model Architecture Details](/en/develop-plugin/features-and-specs/plugin-types/model-schema)—architecture specifications for model plugins
* [Quickly Integrate a New Model](/en/develop-plugin/dev-guides-and-walkthroughs/creating-new-model-provider)—apply these rules to add new models
* [General Specifications](/en/develop-plugin/features-and-specs/plugin-types/general-specifications)—plugin manifest configuration
* [Create a New Model Provider](/en/develop-plugin/dev-guides-and-walkthroughs/creating-new-model-provider)—develop a new model provider plugin
