Community程式設計與開發github.com

add-model-provider

以非互動式單行指令新增並即時驗證模型供應商,不暴露憑證。

add-model-provider 是什麼?

此技能專為開發者與 AI 代理框架(如 Claude Code、Cursor、Codex)設計,用於在 OpenClaw 環境中新增並驗證模型供應商,且全程不輸出或持久化秘密值。所有憑證僅以 SecretRef(環境變數或檔案來源)方式寫入配置,嚴禁直接編輯 config 檔案,所有變更皆經由 `openclaw config` 驗證與稽核。技能支援 API 金鑰與訂閱/OAuth 兩類供應商合約,並提供乾執行(dry-run)模式先行驗證;每次操作後必須展示可觀察的 Prove 結果,若驗證失敗則需提供明確錯誤訊息與下一步指令。此技能適用於單代理或多代理 roster 環境,支援的路由需要特定 harness 外掛(如 codex)在運行時間啟用。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/custodian-skills/add-model-provider

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

新增模型供應商

切勿輸出或持久化秘密值;憑證僅能透過 SecretRef(環境變數或檔案來源)寫入配置。切勿手動編輯磁碟上的配置檔案——所有變更皆須經由 openclaw config 進行,以確保驗證與稽核。每次操作結束時必須呈現可觀察的 Prove 結果,或準確說明無法驗證的原因。

會話內的 config_set / config_set_ref 工具操作對 models.* 與 secrets.* 路徑設有政策封鎖;請使用受信任的 shell(exec)執行以下指令。set_default_model 是唯一允許在會話內變更預設路由的操作——它會在儲存前先進行即時測試。

收集資訊

openclaw config get models --json          # 首次設定前可能顯示 "Config path not found",此為正常現象
openclaw models list --agent <agentId>     # 在多代理 roster 環境中需要指定 --agent
openclaw models auth list --agent <agentId>
openclaw config schema --json | jq '.properties.models'   # 寫入前先確認確切的供應商路徑
openclaw plugins list   # OpenAI 路由需要 codex harness 外掛;立即啟用/安裝,不要在驗證步驟才處理

如果目標供應商的 harness 外掛遺失或停用,請在此處修復(openclaw plugins enable codex 或 openclaw plugins install @openclaw/codex),以免 Prove 步驟延遲;啟用外掛後閘道器會熱重載自動生效。

決定驗證合約類型:API 金鑰供應商需在 models.providers.<id>.apiKey 上設定 SecretRef;訂閱/OAuth 供應商(ChatGPT/Codex、Claude 訂閱)則使用 openclaw models auth login --provider <id>,且不可指定 API 金鑰路徑。

變更配置

API 金鑰範例(OpenAI),金鑰由操作員預先放入權限為 0600 的檔案——先用 --dry-run 驗證,再寫入:

openclaw config set secrets.providers.openai_key_file --provider-source file --provider-path /path/to/openai.key --provider-mode singleValue --dry-run
openclaw config set secrets.providers.openai_key_file --provider-source file --provider-path /path/to/openai.key --provider-mode singleValue
openclaw config set models.providers.openai.apiKey --ref-provider openai_key_file --ref-source file --ref-id value

當閘道器行程環境變數已包含金鑰時的環境變數替代方案:

openclaw config set models.providers.openai.apiKey --ref-provider default --ref-source env --ref-id OPENAI_API_KEY

若要變更預設模型,請使用會話內的 set_default_model 操作(非預設代理需指定 agentId);它會先進行即時測試再儲存。請勿透過原始配置寫入來變更預設值。

修復

openclaw doctor --lint

doctor --lint 可能因發現問題而回傳結束碼 1:請閱讀報告並繼續其他檢查。一般 doctor 與 doctor --non-interactive 會寫入配置/狀態;在獲得批准前請勿用於診斷。若需要修復,請先取得明確許可,執行 openclaw doctor --fix --non-interactive,然後重新執行收集資訊階段的讀取指令。

驗證

適用於所有 roster 環境的測試(使用您自己的代理 ID 或任何已設定的代理):

openclaw agent --agent <agentId> --model openai/gpt-5.4 -m "Reply with exactly: PROVIDER-PROOF-OK"

單代理安裝可使用較輕量的完成測試——此指令沒有 --agent 旗標,在多代理 roster 環境中會因「無明確擁有者」而失敗,請勿在該環境重試:

openclaw infer model run --gateway --model openai/gpt-5.4 --prompt "Reply with exactly: PROVIDER-PROOF-OK"

預期收到完全匹配的回應;記錄模型 ID 與耗時。已知相依性:OpenAI 路由需在運行時依賴 codex harness 外掛——若測試報告運行時不可用,請執行 openclaw plugins install @openclaw/codex 並重新啟動閘道器,然後再次測試。

回報

說明已新增的供應商、寫入的 SecretRef 路徑(不可寫入值)、測試結果(含模型 ID 與延遲),以及預設模型是否已變更。若測試失敗,請回報確切錯誤訊息與應嘗試的下一條指令。

更多參考資訊:https://docs.openclaw.ai/providers/models 與 https://docs.openclaw.ai/providers/openai

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

claw-score

Audit or refresh OpenClaw maturity scorecard docs from root taxonomy, maturity scores, and QA evidence artifacts without using maintainer discrawl data or committed inventory reports.

相關技能