Files

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Model 插件
---



{/* 
  贡献者注意:
  ----------------
  本文档为旧版文档,即将弃用。
  请勿对此版本进行更改。
  所有更新应指向新版本:
  /plugin-dev-zh/0411-model-plugin-introduction
*/}

<Card title="本文档即将弃用" icon="circle-exclamation" href="/plugin-dev-zh/0411-model-plugin-introduction">
  <p>作为我们文档重组的一部分,此页面正在逐步淘汰。</p>
  
  <p><u><b>点击此卡片</b></u>跳转到包含最新信息的更新版本。</p>
  
  <p>如果您在新的文档中发现任何差异或需要改进的地方,请使用页面底部的“报告问题”按钮。</p>
</Card>

Model 模型插件使 Dify 平台能够调用该模型供应商下的所有 LLM。例如安装 OpenAI 模型插件后Dify 平台即可调用 OpenAI 提供的 `GPT-4`、`GPT-4o-2024-05-13` 等模型。

### 模型插件结构

为了便于理解在开发模型插件过程中可能涉及的概念,以下是模型插件内的结构简介:

* **模型供应商**:大模型的开发公司,例如 **OpenAI、Anthropic、Google** 等;
* **模型分类**根据模型供应商的不同存在大语言模型LLM、文本嵌入模型Text embedding、语音转文字Speech2text等分类
* **具体模型**`claude-3-5-sonnet`、`gpt-4-turbo` 等。

插件项目中的代码层级结构:

```bash
- 模型供应商
    - 模型分类
        - 具体模型
```

以 **Anthropic** 为例,模型插件的示例结构如下:

```bash
- Anthropic
    - llm
        claude-3-5-sonnet-20240620 
        claude-3-haiku-20240307
        claude-3-opus-20240229 
        claude-3-sonnet-20240229 
        claude-instant-1.2 
        claude-instant-1
```

以 OpenAI 为例,因为它支持多种模型类型,所以存在多层模型分类,结构如下:

```bash
├── models
│   ├── llm
│   │   ├── chatgpt-4o-latest
│   │   ├── gpt-3.5-turbo
│   │   ├── gpt-4-0125-preview
│   │   ├── gpt-4-turbo
│   │   ├── gpt-4o
│   │   ├── llm
│   │   ├── o1-preview
│   │   └── text-davinci-003
│   ├── moderation
│   │   ├── moderation
│   │   └── text-moderation-stable
│   ├── speech2text
│   │   ├── speech2text
│   │   └── whisper-1
│   ├── text_embedding
│   │   ├── text-embedding-3-large
│   │   └── text_embedding
│   └── tts
│       ├── tts-1-hd
│       ├── tts-1
│       └── tts
```

### 开始开发模型插件

请参考以下顺序阅读文档,了解如何开发一个模型插件。

1. [创建模型供应商](/zh-hans/plugins/quick-start/develop-plugins/model-plugin/create-model-providers)
2. 接入[预定义](/zh-hans/guides/model-configuration/predefined-model) / [自定义](/zh-hans/plugins/quick-start/develop-plugins/model-plugin/customizable-model)模型
3. [调试插件](/zh-hans/plugins/quick-start/debug-plugin)

{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}

---

[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/plugins/quick-start/develop-plugins/model-plugin/README.mdx) | [提交问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)