feat: add custom model provider

This commit is contained in:
zhayujie
2026-04-15 12:26:05 +08:00
parent 83f778fec9
commit 3830f76729
13 changed files with 238 additions and 18 deletions

View File

@@ -82,7 +82,8 @@
"models/openai",
"models/deepseek",
"models/linkai",
"models/coding-plan"
"models/coding-plan",
"models/custom"
]
}
]
@@ -257,7 +258,8 @@
"en/models/openai",
"en/models/deepseek",
"en/models/linkai",
"en/models/coding-plan"
"en/models/coding-plan",
"en/models/custom"
]
}
]
@@ -432,7 +434,8 @@
"ja/models/openai",
"ja/models/deepseek",
"ja/models/linkai",
"ja/models/coding-plan"
"ja/models/coding-plan",
"ja/models/custom"
]
}
]

62
docs/en/models/custom.mdx Normal file
View File

@@ -0,0 +1,62 @@
---
title: Custom
description: Custom provider for third-party APIs and local models
---
For models accessed via OpenAI-compatible APIs, such as:
- **Third-party API proxies**: Use a unified API Base to call multiple models
- **Local models**: Models deployed locally via Ollama, vLLM, LocalAI, etc.
- **Private deployments**: Self-hosted model services within your organization
<Note>
Unlike the `openai` provider, switching models under the Custom provider will not auto-switch the provider type. Your custom API address is always preserved.
</Note>
## Configuration
### Third-party API Proxy
```json
{
"bot_type": "custom",
"model": "deepseek-chat",
"custom_api_key": "YOUR_API_KEY",
"custom_api_base": "https://{your-proxy.com}/v1"
}
```
| Parameter | Description |
| --- | --- |
| `bot_type` | Must be set to `custom` |
| `model` | Model name, any model supported by your proxy service |
| `custom_api_key` | API key provided by your proxy service |
| `custom_api_base` | API base URL, must be OpenAI-compatible |
### Local Models
Local models typically don't require an API key — just set the API base:
```json
{
"bot_type": "custom",
"model": "qwen3.5:27b",
"custom_api_base": "http://localhost:11434/v1"
}
```
Common local deployment tools and their default addresses:
| Tool | Default API Base |
| --- | --- |
| [Ollama](https://ollama.com) | `http://localhost:11434/v1` |
| [vLLM](https://docs.vllm.ai) | `http://localhost:8000/v1` |
| [LocalAI](https://localai.io) | `http://localhost:8080/v1` |
## Switching Models
Under the Custom provider, switching models only changes `model` without affecting `bot_type` or the API address:
```
/config model qwen3.5:27b
```

62
docs/ja/models/custom.mdx Normal file
View File

@@ -0,0 +1,62 @@
---
title: カスタム
description: サードパーティAPIやローカルモデル向けのカスタムプロバイダー設定
---
OpenAI互換プロトコルでアクセスするモデルサービスに適用します
- **サードパーティAPIプロキシ**統一APIベースで複数モデルを呼び出し
- **ローカルモデル**Ollama、vLLM、LocalAIなどでローカルにデプロイされたモデル
- **プライベートデプロイ**:組織内でホストされたモデルサービス
<Note>
`openai` プロバイダーとの違い:カスタムプロバイダーでは `/config model` でモデルを切り替えてもプロバイダータイプは自動切り替えされず、カスタムAPIアドレスが常に保持されます。
</Note>
## 設定方法
### サードパーティAPIプロキシ
```json
{
"bot_type": "custom",
"model": "deepseek-chat",
"custom_api_key": "YOUR_API_KEY",
"custom_api_base": "https://{your-proxy.com}/v1"
}
```
| パラメータ | 説明 |
| --- | --- |
| `bot_type` | `custom` に設定必須 |
| `model` | モデル名、プロキシサービスがサポートする任意のモデル名 |
| `custom_api_key` | プロキシサービスが提供するAPIキー |
| `custom_api_base` | APIアドレス、OpenAI互換プロトコルが必要 |
### ローカルモデル
ローカルモデルは通常APIキー不要で、APIベースのみ設定します
```json
{
"bot_type": "custom",
"model": "qwen3.5:27b",
"custom_api_base": "http://localhost:11434/v1"
}
```
一般的なローカルデプロイツールとデフォルトアドレス:
| ツール | デフォルトAPIベース |
| --- | --- |
| [Ollama](https://ollama.com) | `http://localhost:11434/v1` |
| [vLLM](https://docs.vllm.ai) | `http://localhost:8000/v1` |
| [LocalAI](https://localai.io) | `http://localhost:8080/v1` |
## モデル切り替え
カスタムプロバイダーではモデル切り替え時に `model` のみ変更され、`bot_type` やAPIアドレスは変わりません
```
/config model qwen3.5:27b
```

62
docs/models/custom.mdx Normal file
View File

@@ -0,0 +1,62 @@
---
title: 自定义
description: 自定义厂商配置,适用于第三方 API 代理和本地模型
---
适用于通过 OpenAI 兼容协议接入的第三方模型服务或本地部署的模型,例如:
- **第三方 API 代理**:使用统一的 API Base 调用多种模型
- **本地模型**:通过 Ollama、vLLM、LocalAI 等工具在本地部署的模型
- **私有化部署**:企业内部部署的模型服务
<Note>
与 `openai` 厂商的区别:选择自定义厂商后,通过 `/config model` 切换模型时,不会自动切换厂商类型,始终使用自定义的 API 地址。
</Note>
## 配置方式
### 第三方 API 代理
```json
{
"bot_type": "custom",
"model": "deepseek-chat",
"custom_api_key": "YOUR_API_KEY",
"custom_api_base": "https://{your-proxy.com}/v1"
}
```
| 参数 | 说明 |
| --- | --- |
| `bot_type` | 必须设为 `custom` |
| `model` | 模型名称,可填写代理服务支持的任意模型名 |
| `custom_api_key` | API 密钥,由代理服务提供 |
| `custom_api_base` | API 地址,由代理服务提供,需兼容 OpenAI 协议 |
### 本地模型
本地模型通常不需要 API Key只需填写 API Base 即可:
```json
{
"bot_type": "custom",
"model": "qwen3.5:27b",
"custom_api_base": "http://localhost:11434/v1"
}
```
常见的本地部署工具及默认地址:
| 工具 | 默认 API Base |
| --- | --- |
| [Ollama](https://ollama.com) | `http://localhost:11434/v1` |
| [vLLM](https://docs.vllm.ai) | `http://localhost:8000/v1` |
| [LocalAI](https://localai.io) | `http://localhost:8080/v1` |
## 切换模型
自定义厂商下切换模型时,只会修改 `model`,不会改变 `bot_type` 和 API 地址:
```
/config model qwen3.5:27b
```

View File

@@ -53,6 +53,9 @@ CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在
<Card title="LinkAI" href="/models/linkai">
多模型统一接口 + 知识库
</Card>
<Card title="自定义" href="/models/custom">
第三方代理、本地模型等
</Card>
</CardGroup>