配置
OpenClaw,
透過 CoreAPI
將 CoreAPI 用作 OpenClaw 的自訂模型提供商:一個 API、豐富的模型目錄,價格與官方一致。本指南對應最新 OpenClaw 接入流程(2026.3.8+),涵蓋安裝、提供商配置、驗證和模型切換。
# 僅供參考——請在生產環境前根據您的 OpenClaw 版本驗證
{
"agents": {
"defaults": {
"model": {
"primary": "coreapi-claude/claude-sonnet-4-5-20250929"
}
}
},
"models": {
"mode": "merge",
"providers": {
"coreapi-openai": {
"baseUrl": "https://unixcore.io/v1",
"apiKey": "${COREAPI_KEY}",
"api": "openai-completions",
"models": [{ "id": "deepseek-flash", "name": "DeepSeek Flash" }]
},
"coreapi-claude": {
"baseUrl": "https://unixcore.io",
"apiKey": "${COREAPI_KEY}",
"api": "anthropic-messages",
"models": [{ "id": "claude-sonnet-4-5-20250929", "name": "Claude Sonnet 4.5" }]
}
}
}
}指南範圍
與前置條件
透過 CoreAPI 配置 OpenClaw
將 CoreAPI 用作 OpenClaw 的自訂模型提供商,透過一個 API 以官方標價存取模型目錄。本頁對應最新 OpenClaw 接入流程(2026.3.8+)。
前置條件
需要 Node.js >= 22 和 CoreAPI API 金鑰。對於常駐程式安裝,請將 COREAPI_KEY 存放在 ~/.openclaw/.env 中,以便 openclaw.json 透過 $COREAPI_KEY 引用而無需硬式編碼。
openclaw onboard --install-daemon openclaw gateway status openclaw dashboard printf 'COREAPI_KEY=%s\n' 'your_coreapi_key' >> ~/.openclaw/.env chmod 600 ~/.openclaw/.env
新增 ~/.openclaw/.env 或編輯提供商設定後,使用 openclaw gateway restart重啟一次,然後執行診斷。在所有指令和工作階段中使用完整的 provider/model 引用。版本升級後請重新檢查 設定參考.
為什麼一個 CoreAPI 金鑰
需要兩個提供商
安裝、引導、設定、
驗證、切換
OpenClaw 使用 ~/.openclaw/openclaw.json 作為您編輯的來源設定檔。自訂提供商將被實體化為每個 agent 的 models.json 檔案,位於 ~/.openclaw/agents/<agentId>/下。升級後請使用 設定參考 和 環境變數 指南重新檢查金鑰和行為。CoreAPI 的 base URL 僅以 即時檔案中的定義為準。
{
"agents": {
"defaults": {
"model": {
"primary": "coreapi-claude/claude-sonnet-4-5-20250929"
}
}
},
"models": {
"mode": "merge",
"providers": {
"coreapi-openai": {
"baseUrl": "https://unixcore.io/v1",
"apiKey": "${COREAPI_KEY}",
"api": "openai-completions",
"models": [{ "id": "deepseek-flash", "name": "DeepSeek Flash" }]
},
"coreapi-claude": {
"baseUrl": "https://unixcore.io",
"apiKey": "${COREAPI_KEY}",
"api": "anthropic-messages",
"models": [{ "id": "claude-sonnet-4-5-20250929", "name": "Claude Sonnet 4.5" }]
}
}
}
}基礎設定無需手動建立 auth-profiles.json。在提供商中使用 ${COREAPI_KEY} ,並透過 ~/.openclaw/.env、shell 或服務管理器注入變數。
即時費率以
CoreAPI 官網為準
下表使用示意性的每百萬 Token 價格。模型目錄、定價和 SLA 以 CoreAPI 目前條款為準。 CoreAPI 檔案與主控台 當前顯示的資料為準。
整合前請先
查看這些問題
此設定需要 auth-profiles.json 嗎?
基礎設定不需要。OpenClaw 可以透過 $COREAPI_KEY 從 models.providers.*.apiKey 解析提供商 apiKey。僅在需要按配置檔案存放金鑰或金鑰輪換時才使用 auth-profiles.json。
為什麼一個供應商需要 2 個提供商條目?
OpenClaw 按 API 格式相容性路由。請為 openai-completions 和 anthropic-messages 保持獨立條目。
設定實際在哪裡編輯和實體化?
編輯 ~/.openclaw/openclaw.json。自訂提供商在同步/載入後會實體化為 ~/.openclaw/agents/<agentId>/ 下每個 agent 的 models.json。
本指南使用哪些模型 ID?
deepseek-flash、claude-sonnet-4-5-20250929。您可以將 CoreAPI 模型頁面上的任意模型新增到對應的提供商區塊中。