Merge pull request #2790 from jimmyzhuu/feat/qianfan-provider

Add first-class Baidu Qianfan / ERNIE provider
This commit is contained in:
zhayujie
2026-05-06 11:43:32 +08:00
committed by GitHub
21 changed files with 725 additions and 30 deletions

View File

@@ -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.
<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>
## 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">
deepseek-v4-flash, deepseek-v4-pro, and more
</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">
MiniMax-M2.7 and other series models
</Card>

View 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>