ERNIE Model Integration
Complete guide for adding Baidu ERNIE 5.0 (Qianfan) models to Clawdbot.
Overview
ERNIE 5.0 is Baidu's latest large language model with deep thinking capabilities:
- - ERNIE 5.0 (
ernie-5.0-thinking-preview) - Advanced reasoning model with 128K context window via OpenAI-compatible API
Prerequisites
- - Clawdbot installed and configured
- API key from Baidu Qianfan platform (see Getting API Key section)
Getting API Key
Baidu Qianfan Platform
- 1. Visit https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application
- Register a Baidu Cloud account if you don't have one
- Navigate to the API Keys section
- Create a new API key
- Copy the key (format:
bce-v3/ALTAK-...)
Note: The API key uses Baidu's BCE authentication format.
Integration Steps
Step 1: Set environment variable
Add to ~/.bashrc or ~/.zshrc for persistence:
CODEBLOCK0
Security note: Never commit API keys to version control. Rotate keys regularly on the Qianfan console.
Step 2: Add provider configuration
Edit your clawdbot.json config:
CODEBLOCK1
Step 3: Restart Clawdbot
CODEBLOCK2
Step 4: Verify integration
CODEBLOCK3
You should see ERNIE models in the list.
Step 5: Use the model
Set as default:
CODEBLOCK4
Or use model alias in chat:
CODEBLOCK5
Model Parameters
ERNIE 5.0 Specifications
| Parameter | Value |
|---|
| Model ID | INLINECODE5 |
| Context Window |
128K tokens |
| Max Input | 119K tokens |
| Max Output | 1 - 65536 tokens |
| RPM (Rate Per Minute) | 60 |
| TPM (Tokens Per Minute) | 150,000 |
Supported Request Parameters
| Parameter | Type | Description |
|---|
| INLINECODE6 | string | Model ID (required) |
| INLINECODE7 |
array | Chat context messages (required) |
|
stream | boolean | Enable streaming response |
|
temperature | number | Output randomness (model-specific range) |
|
top_p | number | Nucleus sampling parameter |
|
max_tokens | integer | Maximum output tokens |
|
stop | array | Stop sequences (up to 4 elements) |
|
frequency_penalty | number | Frequency-based repetition penalty |
|
presence_penalty | number | Presence-based repetition penalty |
Thinking Mode Parameters
ERNIE 5.0 supports deep thinking mode:
| Parameter | Type | Description |
|---|
| INLINECODE15 | boolean | Enable thinking mode |
| INLINECODE16 |
integer | Max thinking chain tokens (default: 16384) |
|
thinking_strategy | string |
short_think or
chain_of_draft |
|
reasoning_effort | string |
low,
medium (default), or
high |
Troubleshooting
Model not appearing in list
Check config syntax:
CODEBLOCK6
Verify API key is set:
CODEBLOCK7
Authentication errors
- - Verify API key format is INLINECODE24
- Check key is valid on Qianfan console
- Ensure correct base URL: INLINECODE25
Connection issues
Test API endpoint directly:
CODEBLOCK8
Rate limit errors
ERNIE 5.0 has the following rate limits:
- - RPM: 60 requests per minute
- TPM: 150,000 tokens per minute
If you hit rate limits, reduce request frequency or apply for higher quotas on Qianfan console.
Model Recommendations
- - ERNIE 5.0 (
ernie/ernie-5.0-thinking-preview) - Best for complex reasoning tasks, deep analysis, and tasks requiring extensive thinking
References
- - Baidu Qianfan Docs: https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html
- Qianfan API Reference: https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Fm2vrveyu
- Clawdbot Model Providers: https://docs.openclaw.ai/concepts/model-providers
ERNIE 模型集成
将百度ERNIE 5.0(千帆)模型添加到Clawdbot的完整指南。
概述
ERNIE 5.0是百度最新的大型语言模型,具备深度思考能力:
- - ERNIE 5.0(ernie-5.0-thinking-preview)——通过兼容OpenAI的API提供128K上下文窗口的高级推理模型
前提条件
- - 已安装并配置Clawdbot
- 来自百度千帆平台的API密钥(参见获取API密钥部分)
获取API密钥
百度千帆平台
- 1. 访问 https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application
- 如果没有百度云账号,请注册一个
- 导航至API密钥部分
- 创建新的API密钥
- 复制密钥(格式:bce-v3/ALTAK-...)
注意: API密钥使用百度的BCE认证格式。
集成步骤
步骤1:设置环境变量
添加到~/.bashrc或~/.zshrc以持久化:
bash
export ERNIEAPIKEY=bce-v3/ALTAK-your-key-here
source ~/.zshrc # 或 source ~/.bashrc
安全提示: 切勿将API密钥提交到版本控制。定期在千帆控制台轮换密钥。
步骤2:添加提供商配置
编辑您的clawdbot.json配置:
json5
{
agents: {
defaults: {
model: {
primary: ernie/ernie-5.0-thinking-preview
},
models: {
ernie/ernie-5.0-thinking-preview: {
alias: ernie-5.0
}
}
}
},
models: {
mode: merge,
providers: {
ernie: {
baseUrl: https://qianfan.baidubce.com/v2,
apiKey: ${ERNIEAPIKEY},
api: openai-completions,
models: [
{
id: ernie-5.0-thinking-preview,
name: ERNIE 5.0,
contextWindow: 128000,
maxTokens: 65536
}
]
}
}
}
}
步骤3:重启Clawdbot
bash
clawdbot gateway restart
步骤4:验证集成
bash
clawdbot models list
您应该会在列表中看到ERNIE模型。
步骤5:使用模型
设置为默认模型:
bash
clawdbot models set ernie/ernie-5.0-thinking-preview
或在聊天中使用模型别名:
bash
/model ernie-5.0
模型参数
ERNIE 5.0规格
| 参数 | 值 |
|---|
| 模型ID | ernie-5.0-thinking-preview |
| 上下文窗口 |
128K tokens |
| 最大输入 | 119K tokens |
| 最大输出 | 1 - 65536 tokens |
| RPM(每分钟请求数) | 60 |
| TPM(每分钟令牌数) | 150,000 |
支持的请求参数
| 参数 | 类型 | 描述 |
|---|
| model | string | 模型ID(必填) |
| messages |
array | 聊天上下文消息(必填) |
| stream | boolean | 启用流式响应 |
| temperature | number | 输出随机性(模型特定范围) |
| top_p | number | 核采样参数 |
| max_tokens | integer | 最大输出令牌数 |
| stop | array | 停止序列(最多4个元素) |
| frequency_penalty | number | 基于频率的重复惩罚 |
| presence_penalty | number | 基于存在性的重复惩罚 |
思考模式参数
ERNIE 5.0支持深度思考模式:
| 参数 | 类型 | 描述 |
|---|
| enablethinking | boolean | 启用思考模式 |
| thinkingbudget |
integer | 最大思考链令牌数(默认:16384) |
| thinking
strategy | string | shortthink 或 chain
ofdraft |
| reasoning_effort | string | low、medium(默认)或 high |
故障排除
模型未出现在列表中
检查配置语法:
bash
clawdbot gateway config.get | grep -A 20 ernie
验证API密钥是否已设置:
bash
echo $ERNIEAPIKEY
认证错误
- - 验证API密钥格式是否为bce-v3/ALTAK-...
- 在千帆控制台检查密钥是否有效
- 确保正确的base URL:https://qianfan.baidubce.com/v2
连接问题
直接测试API端点:
bash
curl -X POST https://qianfan.baidubce.com/v2/chat/completions \
-H Authorization: Bearer $ERNIEAPIKEY \
-H Content-Type: application/json \
-d {model: ernie-5.0-thinking-preview, messages: [{role: user, content: test}]}
速率限制错误
ERNIE 5.0有以下速率限制:
- - RPM:每分钟60次请求
- TPM:每分钟150,000个令牌
如果达到速率限制,请降低请求频率或在千帆控制台申请更高配额。
模型推荐
- - ERNIE 5.0(ernie/ernie-5.0-thinking-preview)——最适合复杂推理任务、深度分析和需要大量思考的任务
参考
- - 百度千帆文档:https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html
- 千帆API参考:https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Fm2vrveyu
- Clawdbot模型提供商:https://docs.openclaw.ai/concepts/model-providers