在前面的測試中, 我已在 Pi 4 中安裝好 OpenClaw 與 Ngrok, 接下來就可以啟動 OpenClaw 進行 Onboading 初始設定了. 本系列全部測試文章索引參考 :
1. 取得 LLM 的 API 金鑰 :
由於本地的 AI 代理幾乎都使用 CUDA 函式庫進行推理, 但 CUDA 並未支援樹莓派的 GPU (僅支援 Nvidia 的 GPU), 只能依賴 CPU 推理, 但那速度非常慢且只能使用量化小模型, 因此在樹莓派上跑 OpenClaw 必須仰賴雲端 LLM.
連線雲端大模型可以使用 OAuth 授權與 API key 連線兩種方式. 前者是以網頁登入訂閱方案的方式來使用模型, 用量會計入方案的額度; API Key 則是按 token 使用量計費, 與訂閱方案無關, 適合無訂閱方案者使用. 因 OAuth 授權並非永久有效, 通常每 10 天須重新驗證, 若因 OpenClaw 頻繁呼叫 LLM 被認為違反平台使用條款而使帳號被停用, 以 Gemini 來說會連帶無法存取整個 Google 服務, 因此還是以 API key 連接較為妥當.
為了避免與測試用的金鑰混用, 我新建了專用於 OpenClaw 的 Gemini 與 OpenAI API key :
(1). 建立 Gemini API Key :
Gemini API Key 可在 Google AI Studio 網站按 Dashboard, 在儀表板頁面上按 "Create API Key" 鈕來建立 OpenClaw 專用的金鑰 :
或直接前往 API key 頁面 :
填寫金鑰名稱勾選所屬專案後按 "Create key" :
建立後要立即按後面的複製鈕, 將金鑰儲存到記事本 (只顯示一次) :
參考 :
首先登入 OpenAI 帳戶 :
按左邊導覽列的 API keys :
按 Create new secrets key 鈕 :
填寫金鑰名稱後按 Create secret key :
複製金鑰貼到記事本中儲存備用 :
當然建立金鑰的前提示必須先儲值, 登入後切換到帳務頁面 (Billing) 輸入信用卡即可 :
參考 :
首先登入 Claude 帳戶 (Claude 是透過 Email 取得驗證碼) :
按左邊導覽列的 API Keys 顯示目前的金鑰列表, 按右上角的 Create key :
這時會跳出視窗, 詢問是否要使用身分聯邦 (Identity Federation) 功能, 這是可讓雲端平台自動核發幾分鐘內就會過期的短期 Token 的功能, 這種方式比產生永久金鑰更安全, 不用擔心金鑰外洩, 但我們是要在本地主機使用金鑰, 故要按底下的 "Continue with an API key" :
在 Name 欄輸入金鑰名稱後按 Add 鈕 :
按 Copy key 複製金鑰貼到記事本中儲存備用 :
參考 :
2. OpenClaw 初始化設定 (Onboarding) :
以下按照 "OpenClaw 超入門" 這本書建議的最小可行原則 (Minimum Viable), 在初始化設定時跳過頻道, 搜尋引擎, Skills 與 Hooks 等設定, 先建立一個可運行的基本系統配置, 利用 Web UI 代理人與 OpenClaw 對話, 透過視覺化介面了解其核心功能與選項用途, 後續再逐步擴充與優化.
Onboarding 是一個互動式的初始化程序, 透過問答式引導精靈 (Setup Wizard) 介面, 協助完成以下系統初始化所需之核心設定 (只需在第一次使用前或日後想整機重新配置時執行) :
- 選擇並綁定 AI 模型大腦
- 配置對外通訊通道 (Channels)
- 設定預設角色與 Agent 權限
- 自動產生組態設定檔 (config.json 或 .env)
開啟樹莓派 OS 終端機, 輸入 openclaw onboard 指令, 發現與書中描述的大不同, 原來我安裝的是新版 Openclaw, :
pi@pi4b:~ $ openclaw onboard
openclaw crestodian - crestodian local - agent crestodian (Crestodian) -
session main
session agent:crestodian:main
Hi, I'm Crestodian — let's hatch your agent.
No menus here: tell me what you want and I'll do the configuring. I looked
around this machine:
- AI: nothing detected yet (no Claude Code or Codex login, no
OPENAI_API_KEY/ANTHROPIC_API_KEY). I'll set up the basics first, then ask
whether you want to configure a model provider with masked credential prompts.
- Workspace: ~/.openclaw/workspace
- Gateway: runs locally, private to this machine (token auth).
Say yes and I'll set all of that up now.
Heads up: your agent gets real access to this machine —
https://docs.openclaw.ai/security
Afterwards: connect discord, connect slack, connect telegram, connect whatsapp
(or channels for the full list), then talk to agent to meet your agent.
local ready | idle
agent crestodian (Crestodian) | session main (Crestodian) | unknown | tokens ?
────────────────────────────────────────────────────────────────────────────────
輸入 yes :
yes
⠧ conjuring… • 3s | local ready
agent crestodian (Crestodian) | session main (Crestodian) | unknown | tokens ?
────────────────────────────────────────────────────────────────────────────────
[crestodian] running: crestodian.setup
Workspace OK: ~/.openclaw/workspace
Sessions OK: ~/.openclaw/agents/main/sessions
Systemd: Linux 安裝預設使用 systemd 使用者服務。沒有 lingering 時,systemd 會在
使用者工作階段退出/閒置後停止工作階段並終止 Gateway。
Enabling lingering now (may require sudo; writes /var/lib/systemd/linger).
Systemd: Enabled systemd lingering for pi.
Gateway 服務執行環境: QuickStart 使用 Node 執行 Gateway 服務(穩定且受支援)。
Gateway 服務
正在準備 Gateway 服務...
正在安裝 Gateway 服務...
Gateway 服務已安裝。
Updated /home/pi/.openclaw/openclaw.json
Workspace: ~/.openclaw/workspace
Gateway: not reachable yet (connect ECONNREFUSED 127.0.0.1:18789) — say gateway
status to check
Default model: not configured yet
[crestodian] done: crestodian.setup
No usable model provider is configured, so the agent cannot answer yet.
Configure a model provider now? Say yes or no.
local ready | idle
agent crestodian (Crestodian) | session main (Crestodian) | unknown | tokens ?
可見 Crestodian 已經自動幫我完成了以下底層配置 :
- 建立工作目錄與工作階段 (~/.openclaw/workspace)
- 啟用了 Linux systemd lingering (確保即便你登出 SSH 終端機, Gateway 服務依然能在背景常駐執行)
- 產生了核心組態檔 ~/.openclaw/openclaw.json。
但系統尚未配置可用的 AI 模型, OpenClaw 目前還無法回答問題, 詢問是否要設定模型來源? 輸入 yes 會列出一份模型清單, 可用上下鍵移動選項後按 Enter 選定, 此處我直接按 Enter 選擇預設的 OpenAI 模型 :
yes
Opening masked model-provider setup in the terminal.
local ready | idle
agent crestodian (Crestodian) | session main (Crestodian) | unknown | tokens ?
────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────
│
◆ Model/auth provider
│ ● OpenAI (ChatGPT/Codex sign-in or API key)
│ ○ Anthropic
│ ○ xAI (Grok)
│ ○ Google
│ ○ OpenRouter
│ ○ Meta
│ ○ More…
│ ○ Skip for now
│ ↑/↓ to navigate • Enter: confirm
└
按向下鍵移動到第二項 OpenAI API Key 後按 Enter :
◇ Model/auth provider
│ OpenAI
│
◆ OpenAI auth method
│ ○ ChatGPT Login
│ ● OpenAI API Key (Use your OpenAI API key directly)
│ ○ Back
│ ↑/↓ to navigate • Enter: confirm
要求輸入 API Key, 將上面專為 OpenClaw 建立的金鑰複製貼上後按 Enter :
◆ Enter OpenAI API key
│ ▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪
▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪
▪▪▪▪▪▪▪_
└
這時會顯示 Installing ... 安裝進度, 初始化程序會透過 npm 下載名為 @openclaw/codex 的適配器套件, 負責封裝 API 請求協定與 Token 處理邏輯, 但似乎從伺服器下載 npm 套件時發生卡頓, 超過了預設的 300 秒上限, OpenClaw 會自動切回標準的 @openclaw/openai-provider (此模組在先前的清單中已經預先內建), 並直接採用標準的通用模型 :
◇ 安裝逾時:Codex
│
◇ 插件安裝 ───────────────────────────────────╮
│ │
│ 安裝 @openclaw/codex 逾時,已等待 5 分鐘。 │
│ 返回選擇。 │
│ │
├──────────────────────────────────────────────╯
Plugin install timed out after 300000ms: @openclaw/codex
│
◇ 模型已設定 ──────────────────────╮
│ │
│ 預設模型已設定為 openai/gpt-5.6 │
│ │
├───────────────────────────────────╯
│
◆ 預設模型
│ ● 保留目前值(openai/gpt-5.6)
│ ○ 手動輸入模型
│ ○ 瀏覽所有模型
│ ↑/↓ to navigate • Enter: confirm
└
直接按 Enter 使用 gpt-5.6 即可 :
openclaw crestodian - crestodian local - agent crestodian (Crestodian) -
session main
session agent:crestodian:main
Hi, I'm Crestodian.
- Start me when setup, config, Gateway, model choice, or agent routing feels
off.
- Using: openai/gpt-5.6 — just tell me what you want.
- Config: valid. Default agent: main.
- Gateway: not reachable at ws://127.0.0.1:18789; I already did the first probe.
I can start debugging with gateway status, or queue restart gateway for
approval.
local ready | idle
agent crestodian (Crestodian) | session main (Crestodian) | openai/gpt-5.6 |
tokens ?
這表示目前已經成功完成出初始化設定, 已進入 Crestodian 的互動對話交談模式, AI 大腦已綁定為 openai/gpt-5.6, 並提示目前 Gateway 服務 (連接埠 18789) 尚未啟動連線, 可在底下輸入 restart gateway 後按 Enter, 讓 Crestodian 啟動網關服務 :
restart gateway
The gateway is currently reachable. Restarting is a persistent action and will
briefly interrupt it. Confirm and I’ll restart it.
local ready | idle
agent crestodian (Crestodian) | session main (Crestodian) | openai/gpt-5.6 |
tokens ?
開頭提示代表 Gateway 服務其實已經在背景自動啟動成功並正常連線中, 如果重啟會短暫中斷服務, 它在確認是否要執行, 既然 Gateway 已在執行中, 那就輸入 no 並按 Enter 取消重啟.
no
Understood—no restart. The gateway is reachable, so I’ll leave it running. Tiny
crab, zero unnecessary button-pushing.
這樣便完成初始化設定了.
可以開啟另一個終端機, 輸入 openclaw status 檢視目前狀態 :
pi@pi4b:~ $ openclaw status
OpenClaw 2026.7.1-2 (0790d9f) — Greetings, Professor Falken
│
◇
OpenClaw status
Overview
Security audit
Skipped in fast status. Full report: openclaw security audit
Deep probe: openclaw status --deep
Channels
No channels configured
Sessions
No sessions
FAQ: https://docs.openclaw.ai/faq
Troubleshooting: https://docs.openclaw.ai/troubleshooting
Next steps:
Need to share? openclaw status --all
Need to debug live? openclaw logs --follow
Need to test channels? openclaw status --deep
從 Overview 表格可知, Gateway 儀錶板 (dashboard) 位址為 http://127.0.0.1:18789, 這在後續用 Webui 來瀏覽儀表板時要用到.
3. 用 Web UI 開啟 OpenClaw 儀表板 :
開啟樹莓派瀏覽器, 在網址列輸入 http://localhost:18789 或 http://127.0.0.1:18789 會開啟 OpenClaw 儀錶板頁面 :
但由於沒有 token 導致無法連線, 連線 token 寫在 ~/.openclaw/openclaw.json 設定檔中, 用 cat 輸出此檔, 從 gateway/auth/token 屬性即可取得 :
pi@pi4b:~ $ cat ~/.openclaw/openclaw.json
將 token 填入 "網關令牌" 欄位後按 "連接" 鈕即可進入儀表板頁面了 :
左上角區域的功能說明 :
左下角區域的功能說明 :
右上角區域的功能說明 :
中間區域的功能說明 :
下方區域的功能說明 :