mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
docs: add qianfan provider guide
This commit is contained in:
32
README.md
32
README.md
@@ -115,7 +115,7 @@ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
|
|||||||
|
|
||||||
项目支持国内外主流厂商的模型接口,可选模型及配置说明参考:[模型说明](#模型说明)。
|
项目支持国内外主流厂商的模型接口,可选模型及配置说明参考:[模型说明](#模型说明)。
|
||||||
|
|
||||||
> 注:Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、glm-5.1、kimi-k2.6、qwen3.5-plus、claude-sonnet-4-6、gemini-3.1-pro-preview、gpt-5.4、gpt-5.4-mini
|
> 注:Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、glm-5.1、kimi-k2.6、qwen3.5-plus、claude-sonnet-4-6、gemini-3.1-pro-preview、gpt-5.4、gpt-5.4-mini、ernie-4.5-turbo-128k
|
||||||
|
|
||||||
同时支持使用 **LinkAI 平台** 接口,支持上述全部模型,并支持知识库、工作流、插件等 Agent 技能,参考 [接口文档](https://docs.link-ai.tech/platform/api)。
|
同时支持使用 **LinkAI 平台** 接口,支持上述全部模型,并支持知识库、工作流、插件等 Agent 技能,参考 [接口文档](https://docs.link-ai.tech/platform/api)。
|
||||||
|
|
||||||
@@ -597,33 +597,37 @@ API Key 创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>百度文心</summary>
|
<summary>百度千帆 / ERNIE</summary>
|
||||||
方式一:官方 SDK 接入,配置如下:
|
|
||||||
|
方式一:官方接入(推荐),配置如下:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"model": "wenxin-4",
|
"model": "ernie-4.5-turbo-128k",
|
||||||
"baidu_wenxin_api_key": "IajztZ0bDxgnP9bEykU7lBer",
|
"qianfan_api_key": "",
|
||||||
"baidu_wenxin_secret_key": "EDPZn6L24uAS9d8RWFfotK47dPvkjD6G"
|
"qianfan_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
- `model`: 可填 `wenxin`和`wenxin-4`,对应模型为 文心-3.5 和 文心-4.0
|
|
||||||
- `baidu_wenxin_api_key`:参考 [千帆平台-access_token鉴权](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/dlv4pct3s) 文档获取 API Key
|
- `model`: 推荐填写 `ernie-4.5-turbo-128k`,也可填写 `ernie-4.5-turbo-32k`、`ernie-x1-turbo-32k`
|
||||||
- `baidu_wenxin_secret_key`:参考 [千帆平台-access_token鉴权](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/dlv4pct3s) 文档获取 Secret Key
|
- `qianfan_api_key`: 百度千帆 API Key,通常以 `bce-v3/` 开头,可在百度智能云控制台创建
|
||||||
|
- `qianfan_api_base`: 可选,默认为 `https://qianfan.baidubce.com/v2`
|
||||||
|
|
||||||
|
兼容说明:旧配置 `model: "wenxin"`、`model: "wenxin-4"`、`baidu_wenxin_api_key`、`baidu_wenxin_secret_key` 仍可继续使用。
|
||||||
|
|
||||||
方式二:OpenAI 兼容方式接入,配置如下:
|
方式二:OpenAI 兼容方式接入,配置如下:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"bot_type": "openai",
|
"bot_type": "openai",
|
||||||
"model": "ERNIE-4.0-Turbo-8K",
|
"model": "ernie-4.5-turbo-128k",
|
||||||
"open_ai_api_base": "https://qianfan.baidubce.com/v2",
|
"open_ai_api_base": "https://qianfan.baidubce.com/v2",
|
||||||
"open_ai_api_key": "bce-v3/ALTxxxxxxd2b"
|
"open_ai_api_key": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
- `bot_type`: OpenAI 兼容方式
|
- `bot_type`: OpenAI 兼容方式
|
||||||
- `model`: 支持官方所有模型,参考[模型列表](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Wm9cvy6rl)
|
- `model`: 支持千帆平台上的 ERNIE 模型
|
||||||
- `open_ai_api_base`: 百度文心 API 的 BASE URL
|
- `open_ai_api_base`: 百度千帆 OpenAI 兼容 API 的 BASE URL
|
||||||
- `open_ai_api_key`: 百度文心的 API-KEY,参考 [官方文档](https://cloud.baidu.com/doc/qianfan-api/s/ym9chdsy5) ,在 [控制台](https://console.bce.baidu.com/iam/#/iam/apikey/list) 创建 API Key
|
- `open_ai_api_key`: 百度千帆 API Key
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ description: Supported models and recommended choices for CowAgent
|
|||||||
CowAgent supports mainstream LLMs from domestic and international providers. Model interfaces are implemented in the project's `models/` directory.
|
CowAgent supports mainstream LLMs from domestic and international providers. Model interfaces are implemented in the project's `models/` directory.
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
For Agent mode, the following models are recommended based on quality and cost: deepseek-v4-flash, MiniMax-M2.7, claude-sonnet-4-6, gemini-3.1-pro-preview, glm-5.1, qwen3.6-plus, kimi-k2.6
|
For Agent mode, the following models are recommended based on quality and cost: deepseek-v4-flash, MiniMax-M2.7, claude-sonnet-4-6, gemini-3.1-pro-preview, glm-5.1, qwen3.6-plus, kimi-k2.6, ernie-4.5-turbo-128k
|
||||||
</Note>
|
</Note>
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
@@ -21,6 +21,9 @@ You can also use the [LinkAI](https://link-ai.tech) platform interface to flexib
|
|||||||
<Card title="DeepSeek" href="/en/models/deepseek">
|
<Card title="DeepSeek" href="/en/models/deepseek">
|
||||||
deepseek-v4-flash, deepseek-v4-pro, and more
|
deepseek-v4-flash, deepseek-v4-pro, and more
|
||||||
</Card>
|
</Card>
|
||||||
|
<Card title="Baidu Qianfan / ERNIE" href="/en/models/qianfan">
|
||||||
|
ernie-4.5-turbo-128k, ernie-x1-turbo-32k, and more
|
||||||
|
</Card>
|
||||||
<Card title="MiniMax" href="/en/models/minimax">
|
<Card title="MiniMax" href="/en/models/minimax">
|
||||||
MiniMax-M2.7 and other series models
|
MiniMax-M2.7 and other series models
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
43
docs/en/models/qianfan.mdx
Normal file
43
docs/en/models/qianfan.mdx
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
title: Baidu Qianfan / ERNIE
|
||||||
|
description: Baidu Qianfan ERNIE model configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
Option 1: Native integration (recommended):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "ernie-4.5-turbo-128k",
|
||||||
|
"qianfan_api_key": "",
|
||||||
|
"qianfan_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| Parameter | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `model` | Recommended: `ernie-4.5-turbo-128k`; also supports `ernie-4.5-turbo-32k` and `ernie-x1-turbo-32k` |
|
||||||
|
| `qianfan_api_key` | Qianfan API key, usually starting with `bce-v3/` |
|
||||||
|
| `qianfan_api_base` | Optional, defaults to `https://qianfan.baidubce.com/v2` |
|
||||||
|
|
||||||
|
## Model Selection
|
||||||
|
|
||||||
|
| Model | Use Case |
|
||||||
|
| --- | --- |
|
||||||
|
| `ernie-4.5-turbo-128k` | Default recommendation for long-context and general chat |
|
||||||
|
| `ernie-4.5-turbo-32k` | General chat with a balanced context window and cost |
|
||||||
|
| `ernie-x1-turbo-32k` | Tasks that need stronger reasoning |
|
||||||
|
|
||||||
|
Option 2: OpenAI-compatible configuration:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "ernie-4.5-turbo-128k",
|
||||||
|
"bot_type": "openai",
|
||||||
|
"open_ai_api_key": "",
|
||||||
|
"open_ai_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
Prefer `qianfan_api_key` for new configurations. Existing `wenxin`, `wenxin-4`, `baidu_wenxin_api_key`, and `baidu_wenxin_secret_key` configurations remain supported.
|
||||||
|
</Tip>
|
||||||
@@ -6,7 +6,7 @@ description: CowAgentがサポートするモデルとおすすめの選択肢
|
|||||||
CowAgentは国内外の主要なLLMをサポートしています。モデルインターフェースはプロジェクトの`models/`ディレクトリに実装されています。
|
CowAgentは国内外の主要なLLMをサポートしています。モデルインターフェースはプロジェクトの`models/`ディレクトリに実装されています。
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
Agent モードでは、品質とコストのバランスから以下のモデルをおすすめします: deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6
|
Agent モードでは、品質とコストのバランスから以下のモデルをおすすめします: deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-4.5-turbo-128k
|
||||||
</Note>
|
</Note>
|
||||||
|
|
||||||
## 設定
|
## 設定
|
||||||
@@ -21,6 +21,9 @@ CowAgentは国内外の主要なLLMをサポートしています。モデルイ
|
|||||||
<Card title="DeepSeek" href="/ja/models/deepseek">
|
<Card title="DeepSeek" href="/ja/models/deepseek">
|
||||||
deepseek-v4-flash、deepseek-v4-pro など
|
deepseek-v4-flash、deepseek-v4-pro など
|
||||||
</Card>
|
</Card>
|
||||||
|
<Card title="Baidu Qianfan / ERNIE" href="/ja/models/qianfan">
|
||||||
|
ernie-4.5-turbo-128k、ernie-x1-turbo-32k など
|
||||||
|
</Card>
|
||||||
<Card title="MiniMax" href="/ja/models/minimax">
|
<Card title="MiniMax" href="/ja/models/minimax">
|
||||||
MiniMax-M2.7およびその他のシリーズモデル
|
MiniMax-M2.7およびその他のシリーズモデル
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
43
docs/ja/models/qianfan.mdx
Normal file
43
docs/ja/models/qianfan.mdx
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
title: Baidu Qianfan / ERNIE
|
||||||
|
description: Baidu Qianfan ERNIE モデル設定
|
||||||
|
---
|
||||||
|
|
||||||
|
方法 1: 公式接続(推奨):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "ernie-4.5-turbo-128k",
|
||||||
|
"qianfan_api_key": "",
|
||||||
|
"qianfan_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| パラメータ | 説明 |
|
||||||
|
| --- | --- |
|
||||||
|
| `model` | 推奨は `ernie-4.5-turbo-128k`。`ernie-4.5-turbo-32k` と `ernie-x1-turbo-32k` も利用できます |
|
||||||
|
| `qianfan_api_key` | Qianfan API Key。通常は `bce-v3/` で始まります |
|
||||||
|
| `qianfan_api_base` | 任意。デフォルトは `https://qianfan.baidubce.com/v2` |
|
||||||
|
|
||||||
|
## モデル選択
|
||||||
|
|
||||||
|
| モデル | 用途 |
|
||||||
|
| --- | --- |
|
||||||
|
| `ernie-4.5-turbo-128k` | 長いコンテキストと一般的なチャット向けの推奨モデル |
|
||||||
|
| `ernie-4.5-turbo-32k` | コンテキスト長とコストのバランスが良い一般チャット向け |
|
||||||
|
| `ernie-x1-turbo-32k` | より強い推論が必要なタスク向け |
|
||||||
|
|
||||||
|
方法 2: OpenAI 互換接続:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "ernie-4.5-turbo-128k",
|
||||||
|
"bot_type": "openai",
|
||||||
|
"open_ai_api_key": "",
|
||||||
|
"open_ai_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
新しい設定では `qianfan_api_key` の利用を推奨します。既存の `wenxin`、`wenxin-4`、`baidu_wenxin_api_key`、`baidu_wenxin_secret_key` 設定は引き続き利用できます。
|
||||||
|
</Tip>
|
||||||
@@ -6,7 +6,7 @@ description: CowAgent 支持的模型及推荐选择
|
|||||||
CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在项目的 `models/` 目录下。
|
CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在项目的 `models/` 目录下。
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6
|
Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-4.5-turbo-128k
|
||||||
|
|
||||||
同时支持使用 [LinkAI](https://link-ai.tech) 平台接口,可灵活切换多种模型,并支持知识库、工作流、插件等 Agent 能力。
|
同时支持使用 [LinkAI](https://link-ai.tech) 平台接口,可灵活切换多种模型,并支持知识库、工作流、插件等 Agent 能力。
|
||||||
</Note>
|
</Note>
|
||||||
@@ -26,6 +26,9 @@ CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在
|
|||||||
<Card title="DeepSeek" href="/models/deepseek">
|
<Card title="DeepSeek" href="/models/deepseek">
|
||||||
deepseek-v4-flash、deepseek-v4-pro 等
|
deepseek-v4-flash、deepseek-v4-pro 等
|
||||||
</Card>
|
</Card>
|
||||||
|
<Card title="百度千帆 / ERNIE" href="/models/qianfan">
|
||||||
|
ernie-4.5-turbo-128k、ernie-x1-turbo-32k 等
|
||||||
|
</Card>
|
||||||
<Card title="MiniMax" href="/models/minimax">
|
<Card title="MiniMax" href="/models/minimax">
|
||||||
MiniMax-M2.7 等系列模型
|
MiniMax-M2.7 等系列模型
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
43
docs/models/qianfan.mdx
Normal file
43
docs/models/qianfan.mdx
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
title: 百度千帆 / ERNIE
|
||||||
|
description: 百度千帆 ERNIE 模型配置
|
||||||
|
---
|
||||||
|
|
||||||
|
方式一:官方接入(推荐):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "ernie-4.5-turbo-128k",
|
||||||
|
"qianfan_api_key": "",
|
||||||
|
"qianfan_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| 参数 | 说明 |
|
||||||
|
| --- | --- |
|
||||||
|
| `model` | 推荐使用 `ernie-4.5-turbo-128k`;也可使用 `ernie-4.5-turbo-32k`、`ernie-x1-turbo-32k` |
|
||||||
|
| `qianfan_api_key` | 千帆 API Key,格式通常以 `bce-v3/` 开头 |
|
||||||
|
| `qianfan_api_base` | 可选,默认为 `https://qianfan.baidubce.com/v2` |
|
||||||
|
|
||||||
|
## 模型选择
|
||||||
|
|
||||||
|
| 模型 | 适用场景 |
|
||||||
|
| --- | --- |
|
||||||
|
| `ernie-4.5-turbo-128k` | 默认推荐,适合长上下文和通用对话 |
|
||||||
|
| `ernie-4.5-turbo-32k` | 通用对话,成本和上下文更均衡 |
|
||||||
|
| `ernie-x1-turbo-32k` | 需要更强推理能力的任务 |
|
||||||
|
|
||||||
|
方式二:OpenAI 兼容方式接入:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "ernie-4.5-turbo-128k",
|
||||||
|
"bot_type": "openai",
|
||||||
|
"open_ai_api_key": "",
|
||||||
|
"open_ai_api_base": "https://qianfan.baidubce.com/v2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
新配置推荐使用 `qianfan_api_key`。旧的 `wenxin`、`wenxin-4`、`baidu_wenxin_api_key`、`baidu_wenxin_secret_key` 配置仍保持兼容。
|
||||||
|
</Tip>
|
||||||
@@ -243,5 +243,39 @@ class TestQianfanSurfaces(unittest.TestCase):
|
|||||||
self.assertIn("const.QIANFAN", godcmd_source)
|
self.assertIn("const.QIANFAN", godcmd_source)
|
||||||
|
|
||||||
|
|
||||||
|
class TestQianfanDocs(unittest.TestCase):
|
||||||
|
def _read(self, relative_path):
|
||||||
|
root = os.path.join(os.path.dirname(__file__), "..")
|
||||||
|
with open(os.path.join(root, relative_path), encoding="utf-8") as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
def test_qianfan_docs_exist_in_all_doc_locales(self):
|
||||||
|
for path in (
|
||||||
|
"docs/models/qianfan.mdx",
|
||||||
|
"docs/en/models/qianfan.mdx",
|
||||||
|
"docs/ja/models/qianfan.mdx",
|
||||||
|
):
|
||||||
|
text = self._read(path)
|
||||||
|
self.assertIn("qianfan_api_key", text)
|
||||||
|
self.assertIn("https://qianfan.baidubce.com/v2", text)
|
||||||
|
self.assertIn("ernie-4.5-turbo-128k", text)
|
||||||
|
|
||||||
|
def test_model_indexes_link_qianfan(self):
|
||||||
|
for path in (
|
||||||
|
"docs/models/index.mdx",
|
||||||
|
"docs/en/models/index.mdx",
|
||||||
|
"docs/ja/models/index.mdx",
|
||||||
|
):
|
||||||
|
text = self._read(path)
|
||||||
|
self.assertIn('/models/qianfan', text)
|
||||||
|
|
||||||
|
def test_readme_documents_native_qianfan_provider(self):
|
||||||
|
text = self._read("README.md")
|
||||||
|
|
||||||
|
self.assertIn('"model": "ernie-4.5-turbo-128k"', text)
|
||||||
|
self.assertIn('"qianfan_api_key": ""', text)
|
||||||
|
self.assertIn('"qianfan_api_base": "https://qianfan.baidubce.com/v2"', text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user