跳到正文
Skillpedia
智能体394k · #10

add-model-provider

它能做什么

它指导 AI 智能体使用设置命令,而不是手动编辑文件,为 OpenClaw 接入新的模型提供商。它适合想在 OpenClaw 中运行其他 AI 模型的人。

适用场景

  • ✓想为你的 OpenClaw 接入新的 AI 模型提供商的时候。
  • ✓需要检查 OpenClaw 中已经设置好了哪些模型和登录方式的时候。
  • ✓想在依赖新模型提供商之前,通过实时测试确认它能正常工作的时候。

技能链接

https://github.com/openclaw/openclaw/blob/main/custodian-skills/add-model-provider/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/openclaw/openclaw/blob/main/custodian-skills/add-model-provider/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我为 OpenClaw 添加一个新的 AI 模型提供商,并测试它能否正常回复。”

每周 5 个新技能,1 分钟读完。

工作原理

技能先检查你当前的模型设置和插件,然后用 OpenClaw 自带的命令添加提供商。密钥以对某个密钥来源的引用形式保存,而不是明文,设置最后会进行一次实时测试。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Add a model provider

Never print or persist secret values; credentials enter config only as SecretRefs (env or file source). Never hand-edit config files on disk — every mutation goes through openclaw config so it is validated and audited. Every run ends with the observable Prove result or an exact explanation of why it could not be proven.

In-session config_set/config_set_ref tool actions are policy-blocked for models.* and secrets.*; use the trusted shell (exec) for the commands below. set_default_model is the one in-session action allowed to change the default route — it live-tests before saving.

Gather

openclaw config get models --json          # "Config path not found" is normal before first setup
openclaw models list --agent <agentId>     # --agent is required in multi-agent rosters
openclaw models auth list --agent <agentId>
openclaw config schema --json | jq '.properties.models'   # confirm exact provider paths before writing
openclaw plugins list   # OpenAI routes need the codex harness plugin; enable/install NOW, not mid-proof

If the harness plugin for the target provider is missing or disabled, remediate here (openclaw plugins enable codex or openclaw plugins install @openclaw/codex) so the Prove step does not stall on it later; plugin enable is picked up by gateway hot-reload.

Decide the auth contract: API-key providers take a SecretRef on models.providers.<id>.apiKey; subscription/OAuth providers (ChatGPT/Codex, Claude subscriptions) use openclaw models auth login --provider <id> instead and must not be given an API key path.

Mutate

API-key example (OpenAI), key staged by the operator in a 0600 file — validate first with --dry-run, then write:

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

Env-var alternative when the gateway process env carries the key:

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

To change a default model, use the in-session set_default_model action (with agentId for a non-default agent); it live-tests the route before saving. Do not change defaults with raw config writes.

Repair

openclaw doctor --lint

doctor --lint can exit 1 for findings: read the report and continue the remaining checks. Ordinary doctor and doctor --non-interactive can write config/state; do not use them for diagnosis before approval. If a repair is needed, get explicit approval, run openclaw doctor --fix --non-interactive, then re-run the Gather reads.

Prove

Roster-safe test (works in every setup; use your own agent id or any configured agent):

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

Single-agent installs can use the lighter completion test instead — it has no --agent flag and fails with "no explicit owner" on multi-agent rosters, so do not retry it there:

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

Expect the exact requested reply; record model id and wall time. Known dependency: OpenAI routes need the codex harness plugin at runtime — if the test reports the runtime unavailable, run openclaw plugins install @openclaw/codex and restart the gateway, then test again.

Report

State the provider added, the SecretRef path written (never the value), the test result with model id and latency, and whether the default model changed. If the test failed, report the exact error and the next command to try.

Further reference: https://docs.openclaw.ai/providers/models and https://docs.openclaw.ai/providers/openai

常见问题

我的 API 密钥会以明文保存吗?

不会。技能将凭证保存为对环境变量或文件的引用,因此密钥本身不会写入配置。

为什么要用命令,而不直接编辑配置文件?

命令会检查每项更改,并保留审计记录,有助于避免设置出错。

如果缺少必需的插件怎么办?

技能在设置过程中会检查该插件,并在测试运行前启用或安装它。

详情

作者的原始描述

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

repo: openclaw/openclaw

热度

GitHub 星标
394k
排名
#10
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能