我是用 quickStart 方式,配置完成了Clawdbot,但是給機(jī)器人發(fā)消息,一直收到空回復(fù),然后我讓claude code幫我解決問題,大概20分鐘后問題解決,這篇文檔也是讓claude code生成的!
如果你也想解決這個(gè)問題,直接把這篇文章發(fā)給claude code,讓他直接操作即可
?? 問題概述
Clawdbot 配置 MiniMax M2.1 模型后,在 Telegram 上發(fā)送消息時(shí)返回空回復(fù),無法獲得 AI 響應(yīng)。
環(huán)境信息:
- Clawdbot 版本: 2026.1.24-3
- 系統(tǒng): macOS 26.2 (arm64)
- 模型: MiniMax M2.1
- 通信渠道: Telegram
?? 問題現(xiàn)象
1. 初始表現(xiàn)
- Telegram bot 能接收消息
- Agent 狀態(tài)顯示
bootstrapping - Sessions 顯示 0 tokens
- 返回空響應(yīng)或錯(cuò)誤
2. 錯(cuò)誤日志
TypeError: fetch failed
404 404 page not found
401 authentication error: invalid api key
3. Agent 狀態(tài)異常
Agents: 1 · 1 bootstrapping · 0 active
Tokens: 0.0k/200k (0%)
?? 排查過程
步驟 1: 檢查基本狀態(tài)
clawdbot status --all
發(fā)現(xiàn):
- Agent 一直處于
bootstrapping狀態(tài) - Gateway 正常運(yùn)行
- Telegram 通道連接正常
- 但無實(shí)際 token 消耗
步驟 2: 查看錯(cuò)誤日志
clawdbot logs --follow
tail -f ~/.clawdbot/logs/gateway.err.log
發(fā)現(xiàn)多個(gè)錯(cuò)誤:
-
TypeError: fetch failed- 網(wǎng)絡(luò)請求失敗 -
404 page not found- API endpoint 不存在 -
401 invalid api key- API key 認(rèn)證失敗
步驟 3: 檢查會(huì)話日志
ls -lt ~/.clawdbot/agents/main/sessions/*.jsonl | head -1 | awk '{print $NF}' | xargs tail -30
會(huì)話內(nèi)容顯示:
{
"message": {
"role": "assistant",
"content": [],
"stopReason": "error",
"errorMessage": "404 404 page not found"
}
}
步驟 4: 驗(yàn)證 API 配置
cat ~/.clawdbot/clawdbot.json | jq '.models.providers.minimax'
原始錯(cuò)誤配置:
{
"baseUrl": "https://api.minimax.io/anthropic",
"api": "anthropic-messages"
}
步驟 5: 測試 API 端點(diǎn)
測試不同的 endpoint:
# 測試 1: 原始配置(失敗)
curl -X POST https://api.minimax.io/anthropic/v1/messages \
-H "x-api-key: sk-cp-..." \
-d '{"model":"MiniMax-M2.1",...}'
# 結(jié)果: 401 invalid api key
# 測試 2: 使用 .chat 域名的原生 API(成功)
curl -X POST https://api.minimax.chat/v1/text/chatcompletion_v2 \
-H "Authorization: Bearer sk-cp-..." \
-d '{"model":"MiniMax-M2.1",...}'
# 結(jié)果: ? 成功返回響應(yīng)
# 測試 3: 使用 .chat 域名的 Anthropic 兼容 API(成功)
curl -X POST https://api.minimax.chat/anthropic/v1/messages \
-H "x-api-key: sk-cp-..." \
-d '{"model":"MiniMax-M2.1",...}'
# 結(jié)果: ? 成功返回響應(yīng)
# 測試 4: 使用錯(cuò)誤的路徑(失?。?curl -X POST https://api.minimax.chat/v1/messages \
-H "x-api-key: sk-cp-..." \
-d '{"model":"MiniMax-M2.1",...}'
# 結(jié)果: 404 page not found
?? 根本原因
問題 1: BaseURL 域名錯(cuò)誤
-
錯(cuò)誤配置:
https://api.minimax.io/anthropic -
正確配置:
https://api.minimax.chat/anthropic -
原因:
.io域名的 API endpoint 不支持用戶的 API key
問題 2: URL 路徑不完整
-
問題: Clawdbot 使用
api: "anthropic-messages"時(shí),會(huì)在 baseUrl 后添加/v1/messages -
實(shí)際調(diào)用:
https://api.minimax.chat/v1/messages? -
正確調(diào)用:
https://api.minimax.chat/anthropic/v1/messages? -
原因: baseUrl 缺少
/anthropic路徑段
問題 3: API Key 未在 Provider 配置中指定
-
問題: 僅在
auth-profiles.json中配置,未在models.providers.minimax中指定 - 影響: 某些場景下無法正確讀取 API key
? 解決方案
方案實(shí)施步驟
1. 更新 MiniMax Provider 配置
編輯配置文件:
vim ~/.clawdbot/clawdbot.json
或使用命令行:
clawdbot config set models.providers.minimax.baseUrl "https://api.minimax.chat/anthropic"
2. 添加 API Key 到 Provider 配置
在配置文件中添加 apiKey 字段:
{
"models": {
"mode": "merge",
"providers": {
"minimax": {
"baseUrl": "https://api.minimax.chat/anthropic",
"apiKey": "<API-KEY>",
"api": "anthropic-messages",
"models": [
{
"id": "MiniMax-M2.1",
"name": "MiniMax M2.1",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 15,
"output": 60,
"cacheRead": 2,
"cacheWrite": 10
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}
}
3. 重啟 Gateway
clawdbot gateway restart
4. 清除舊會(huì)話(可選)
如果會(huì)話文件包含錯(cuò)誤的配置,建議清除:
rm ~/.clawdbot/agents/main/sessions/sessions.json
clawdbot gateway restart
5. 驗(yàn)證配置
# 檢查狀態(tài)
clawdbot status
# 查看 Agent 狀態(tài)
clawdbot status | grep -A 5 "Agents"
# 查看 Tokens 使用
clawdbot status | grep "Tokens"
預(yù)期結(jié)果:
Agents: 1 · 1 active · sessions 1
Tokens: > 0 tokens (顯示實(shí)際使用量)
? 驗(yàn)證結(jié)果
成功指標(biāo)
-
Agent 狀態(tài)正常
Agents: 1 · 1 active · sessions 1 -
Token 使用正常
Tokens: 12k/200k (6%) -
會(huì)話日志顯示成功響應(yīng)
{ "type": "message", "message": { "role": "assistant", "content": [ { "type": "text", "text": "回復(fù)內(nèi)容..." } ], "stopReason": "stop", "usage": { "input": 16, "output": 160, "totalTokens": 11839 } } } -
Telegram Bot 正?;貜?fù)
- 發(fā)送消息后能收到 AI 響應(yīng)
- 響應(yīng)內(nèi)容完整且有意義
測試命令
# 實(shí)時(shí)查看日志
clawdbot logs --follow
# 查看最新會(huì)話
ls -lt ~/.clawdbot/agents/main/sessions/*.jsonl | head -1 | awk '{print $NF}' | xargs tail -20
# 完整狀態(tài)檢查
clawdbot status --all
?? 完整配置參考
clawdbot.json (MiniMax 部分)
{
"auth": {
"profiles": {
"minimax:default": {
"provider": "minimax",
"mode": "api_key"
}
}
},
"models": {
"mode": "merge",
"providers": {
"minimax": {
"baseUrl": "https://api.minimax.chat/anthropic",
"apiKey": "sk-cp-YOUR_API_KEY_HERE",
"api": "anthropic-messages",
"models": [
{
"id": "MiniMax-M2.1",
"name": "MiniMax M2.1",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 15,
"output": 60,
"cacheRead": 2,
"cacheWrite": 10
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "minimax/MiniMax-M2.1"
}
}
}
}
auth-profiles.json
{
"version": 1,
"profiles": {
"minimax:default": {
"type": "api_key",
"provider": "minimax",
"key": "sk-cp-YOUR_API_KEY_HERE"
}
},
"lastGood": {
"minimax": "minimax:default"
}
}
?? 故障排查技巧
常用命令
# 1. 檢查 Gateway 狀態(tài)
clawdbot gateway status
# 2. 查看 Agent 狀態(tài)
clawdbot status
# 3. 實(shí)時(shí)日志
clawdbot logs --follow
# 4. 查看 Gateway 日志
tail -f ~/.clawdbot/logs/gateway.log
# 5. 查看錯(cuò)誤日志
tail -f ~/.clawdbot/logs/gateway.err.log
# 6. 測試模型列表
clawdbot models list
# 7. 測試模型狀態(tài)
clawdbot models status
# 8. 運(yùn)行診斷
clawdbot doctor
clawdbot doctor --fix
# 9. 深度健康檢查
clawdbot status --deep
# 10. 測試 API 連接
curl -v -X POST https://api.minimax.chat/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{"model":"MiniMax-M2.1","max_tokens":100,"messages":[{"role":"user","content":"hi"}]}'
常見錯(cuò)誤及解決
| 錯(cuò)誤信息 | 原因 | 解決方案 |
|---|---|---|
fetch failed |
BaseURL 錯(cuò)誤或網(wǎng)絡(luò)問題 | 檢查 baseUrl 配置,測試網(wǎng)絡(luò)連接 |
404 page not found |
API endpoint 路徑錯(cuò)誤 | 確保 baseUrl 包含 /anthropic
|
401 invalid api key |
API key 錯(cuò)誤或位置不對 | 檢查 apiKey 字段和 auth-profiles.json
|
Agent bootstrapping |
Agent 無法啟動(dòng) | 檢查日志,清除舊會(huì)話 |
Tokens: 0.0k |
無實(shí)際 API 調(diào)用 | 檢查配置和日志 |
?? 參考資源
官方文檔
相關(guān) Issues
API 端點(diǎn)測試
-
MiniMax 原生 API:
https://api.minimax.chat/v1/text/chatcompletion_v2 -
MiniMax Anthropic 兼容:
https://api.minimax.chat/anthropic/v1/messages
?? 經(jīng)驗(yàn)總結(jié)
關(guān)鍵要點(diǎn)
-
BaseURL 必須包含完整路徑
- 錯(cuò)誤:
https://api.minimax.chat - 正確:
https://api.minimax.chat/anthropic
- 錯(cuò)誤:
-
API Key 需要在兩處配置
models.providers.minimax.apiKeyauth-profiles.json
-
不同域名的用途不同
-
api.minimax.io- 官方文檔推薦,但可能需要特殊 key -
api.minimax.chat- 實(shí)際可用的 endpoint
-
-
測試 API 是關(guān)鍵
- 使用 curl 測試 endpoint 可驗(yàn)證配置
- 從錯(cuò)誤日志中獲取實(shí)際調(diào)用的 URL
-
清除舊會(huì)話很重要
- 錯(cuò)誤配置的會(huì)話會(huì)緩存
- 刪除
sessions.json可以強(qiáng)制重新初始化
最佳實(shí)踐
- 配置修改后總是重啟 gateway
- 使用
clawdbot status --all獲取完整診斷 - 定期查看
clawdbot logs --follow了解運(yùn)行狀態(tài) - 保留配置文件的備份
- 先用 curl 測試 API,再配置 Clawdbot
?? 變更歷史
| 日期 | 版本 | 變更內(nèi)容 |
|---|---|---|
| 2026-01-27 | 1.0 | 初始版本,完整解決方案 |
文檔創(chuàng)建時(shí)間: 2026-01-27
最后更新: 2026-01-27
適用版本: Clawdbot 2026.1.24-3
作者: AI Assistant (Claude)