文件AI 應用
OpenClaw - 自託管 AI 智慧助理
OpenClaw 教學 — 安裝 OpenClaw、串接 New API,快速搭建自託管 AI 助理。開源專案,支援飛書、Discord、Slack 等多渠道整合。
專案介紹
OpenClaw 是一個開源、自託管的個人 AI 助理平台,將訊息應用連接到運行在你自己硬體上的 AI 代理。專為開發者和進階使用者設計,無需交出資料控制權即可擁有自主 AI 助理。
OpenClaw(open claw)完全開源,你可以在 OpenClaw 的 GitHub 儲存庫 瀏覽原始碼、提交 Issue 或參與貢獻。本教學涵蓋安裝、設定,以及將 OpenClaw 串接 New API 的完整步驟。
🌟 核心特性
多渠道整合
- 全平台涵蓋:支援飛書、Discord、Slack、Microsoft Teams 等多種主流即時通訊平台
- 單一 Gateway:透過一個 Gateway 行程統一管理所有渠道
- 語音支援:支援 macOS/iOS/Android 語音互動
- Canvas 介面:可渲染互動式 Canvas 介面
自託管與資料安全
- 完全自託管:運行在你自己的機器或伺服器上
- 開源透明:MIT 開源授權,程式碼完全透明
- 資料在地化:上下文和技能儲存在你的本機電腦,而非雲端
智慧代理能力
- 持續運行:支援背景常駐運行,擁有持久記憶
- 排程任務:支援 cron 定時任務
- 工作階段隔離:依代理/工作區/傳送者隔離工作階段
- 多代理路由:支援多代理協同工作
- 工具呼叫:原生支援工具呼叫和程式碼執行
📦 安裝方式
環境需求
- Node.js 22 或更新版本
- 一個 AI 模型 API 金鑰
npm install -g openclaw@latest安裝完成後執行引導精靈:
openclaw onboard🚀 設定方式
設定檔位置
OpenClaw 的設定檔位於 ~/.openclaw/config.json,可透過引導精靈自動產生,也可以手動編輯。
設定範例
以下是使用 New API 作為模型供應商的完整設定範例:
{
"meta": {
"lastTouchedVersion": "2026.2.1",
"lastTouchedAt": "2026-02-03T12:17:41.559Z"
},
"wizard": {
"lastRunAt": "2026-02-02T21:17:16.011Z",
"lastRunVersion": "2026.2.1",
"lastRunCommand": "onboard",
"lastRunMode": "local"
},
"auth": {
"cooldowns": {
"billingBackoffHoursByProvider": {}
}
},
"models": {
"providers": {
"newapi": {
"baseUrl": "https://api.moleapi.com/v1",
"apiKey": "sk-your-api-key-from-moleapi",
"auth": "api-key",
"api": "openai-completions",
"models": [
{
"id": "gemini-3-flash-preview",
"name": "gemini-3-flash-preview",
"api": "openai-completions",
"reasoning": true,
"input": [
"text",
"image"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 128000,
"maxTokens": 64000
},
{
"id": "kimi-k2.5",
"name": "kimi-k2.5",
"api": "openai-completions",
"reasoning": true,
"input": [
"text",
"image"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 128000,
"maxTokens": 64000
}
]
}
},
"bedrockDiscovery": {
"providerFilter": []
}
},
"agents": {
"defaults": {
"model": {
"primary": "newapi/gemini-3-flash-preview",
"fallbacks": [
"newapi/kimi-k2.5"
]
},
"models": {
"newapi/gemini-3-flash-preview": {
"alias": "gemini-3-flash-preview"
},
"newapi/kimi-k2.5": {
"alias": "kimi-k2.5"
}
},
"workspace": "/home/your-username/.openclaw/workspace",
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
},
"messages": {
"ackReactionScope": "group-mentions"
},
"commands": {
"native": "auto",
"nativeSkills": "auto"
},
"channels": {
"lark": {
"enabled": true,
"dmPolicy": "pairing",
"appId": "your-lark-app-id",
"appSecret": "your-lark-app-secret",
"groupPolicy": "allowlist",
"streamMode": "partial"
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "token",
"token": "your-secure-token"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
"skills": {
"install": {
"nodeManager": "npm"
}
}
}關鍵設定說明
| 設定項 | 說明 |
|---|---|
models.providers.newapi.baseUrl | New API 部署位址,需包含 /v1 |
models.providers.newapi.apiKey | New API Token 金鑰 |
models.providers.newapi.models | 模型清單,可依需求新增多個模型 |
agents.defaults.model.primary | 預設主要模型,格式為 provider/model-id |
agents.defaults.model.fallbacks | 備援模型清單,主要模型不可用時自動切換 |
channels.lark.appId | 飛書應用的 App ID,從飛書開放平台取得 |
channels.lark.appSecret | 飛書應用的 App Secret |
gateway.port | Gateway 監聽連接埠 |
gateway.auth.token | Gateway 存取安全 Token |
啟動服務
設定完成後,啟動 OpenClaw:
openclaw start啟動後即可透過已設定的渠道與 AI 助理進行互動。
這篇文件對您有幫助嗎?
最後更新於