Community编程与开发github.com

添加模型提供商

通过非交互式一键配置添加并实时验证模型提供商,无需暴露凭据。

添加模型提供商 是什么?

该技能用于在 OpenClaw 网关中安全地添加并验证新的模型提供商(如 OpenAI)。它强制使用 SecretRef(环境变量或文件源)来管理凭据,确保密钥永不打印或持久化。所有配置修改必须通过 `openclaw config` 命令进行,以保证验证和审计,禁止直接编辑配置文件。该技能涵盖了从收集现有配置、写入新提供商、运行诊断修复,到通过实际推理测试进行验证的完整流程。它适用于所有 OpenClaw 编排环境,包括单智能体和多智能体名单(multi-agent rosters),并特别指出 OpenAI 路由需要 codex 插件支持。最终报告会提供配置的路径、测试结果(模型 ID 和延迟)以及默认模型是否变更,若测试失败则给出具体错误和下一步建议。

兼容平台✓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 执行,以确保经过验证和审计。每次运行结束时,要么显示可观察的验证结果,要么精确解释为何无法通过验证。

会话内的 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>     # 在包含多智能体的名单中,--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),以免验证步骤因此卡住;插件启用会被网关热加载所识别。

确定认证契约: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,然后重新运行收集阶段的读取命令。

验证

适用于任何名单的安全测试(在任何设置中均有效;请使用您自己的智能体 ID 或任何已配置的智能体):

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

单智能体安装可以使用更轻量的补全测试代替——该测试没有 --agent 标志,但在多智能体名单上会因 "no explicit owner" 而失败,所以不要在那里重试:

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.

相关技能