Agent Skillsopenclaw/openclaw › add-model-provider

add-model-provider

GitHub

指导通过CLI安全配置AI模型提供商,包括收集信息、设置密钥引用、修复配置及执行连通性证明,确保凭证不落地且操作可审计。

custodian-skills/add-model-provider/SKILL.md openclaw/openclaw

Trigger Scenarios

需要添加新的AI模型提供商 配置AI模型认证信息 验证模型连接状态

Install

npx skills add openclaw/openclaw --skill add-model-provider -g -y
More Options

Non-standard path

npx skills add https://github.com/openclaw/openclaw/tree/main/custodian-skills/add-model-provider -g -y

Use without installing

npx skills use openclaw/openclaw@add-model-provider

指定 Agent (Claude Code)

npx skills add openclaw/openclaw --skill add-model-provider -a claude-code -g -y

安装 repo 全部 skill

npx skills add openclaw/openclaw --all -g -y

预览 repo 内 skill

npx skills add openclaw/openclaw --list

SKILL.md

Frontmatter
{
    "name": "add-model-provider",
    "description": "Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials."
}

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 --non-interactive

If it reports a config repair, get approval, run openclaw doctor --fix --non-interactive, then re-run the Gather reads.

Prove

Roster-safe probe (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 probe 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 probe string; record model id and wall time. Known dependency: OpenAI routes need the codex harness plugin at runtime — if the probe reports the runtime unavailable, run openclaw plugins install @openclaw/codex and restart the gateway, then re-probe.

Report

State the provider added, the SecretRef path written (never the value), the probe result with model id and latency, and whether the default model changed. If the probe 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

Version History

  • 3374458 Current 2026-08-20 13:30

Same Skill Collection

.agents/skills/agent-transcript/SKILL.md
.agents/skills/auto-qa/SKILL.md
.agents/skills/autoreview/SKILL.md
.agents/skills/channel-message-flows/SKILL.md
.agents/skills/claw-score/SKILL.md
.agents/skills/clawdtributor/SKILL.md
.agents/skills/clawsweeper/SKILL.md
.agents/skills/control-ui-e2e/SKILL.md
.agents/skills/crabbox/SKILL.md
.agents/skills/deslop/SKILL.md
.agents/skills/discord-clawd/SKILL.md
.agents/skills/discord-user-post/SKILL.md
.agents/skills/discrawl/SKILL.md
.agents/skills/gitcrawl/SKILL.md
.agents/skills/graincrawl/SKILL.md
.agents/skills/notcrawl/SKILL.md
.agents/skills/openclaw-changelog-update/SKILL.md
.agents/skills/openclaw-ci-limits/SKILL.md
.agents/skills/openclaw-debugging/SKILL.md
.agents/skills/openclaw-docker-e2e-authoring/SKILL.md
.agents/skills/openclaw-ghsa-maintainer/SKILL.md
.agents/skills/openclaw-live-updater/SKILL.md
.agents/skills/openclaw-parallels-smoke/SKILL.md
.agents/skills/openclaw-pr-maintainer/SKILL.md
.agents/skills/openclaw-qa-testing/SKILL.md
.agents/skills/openclaw-refactor-docs/SKILL.md
.agents/skills/openclaw-release-validation/SKILL.md
.agents/skills/openclaw-repair-sweep/SKILL.md
.agents/skills/openclaw-secret-scanning-maintainer/SKILL.md
.agents/skills/openclaw-test-heap-leaks/SKILL.md
.agents/skills/openclaw-test-performance/SKILL.md
.agents/skills/openclaw-testing/SKILL.md
.agents/skills/parallels-discord-roundtrip/SKILL.md
.agents/skills/prototype-openclaw-tui/SKILL.md
.agents/skills/release-openclaw-announcement/SKILL.md
.agents/skills/release-openclaw-ci/SKILL.md
.agents/skills/release-openclaw-mac/SKILL.md
.agents/skills/release-openclaw-maintainer/SKILL.md
.agents/skills/release-openclaw-nightly/SKILL.md
.agents/skills/release-openclaw-plugin-testing/SKILL.md
.agents/skills/security-triage/SKILL.md
.agents/skills/slacrawl/SKILL.md
.agents/skills/tag-duplicate-prs-issues/SKILL.md
.agents/skills/technical-documentation/SKILL.md
.agents/skills/telegram-crabbox-e2e-proof/SKILL.md
.agents/skills/test-audit/SKILL.md
.agents/skills/verify-release/SKILL.md
custodian-skills/cloud-image-bake/SKILL.md
custodian-skills/configure-channel/SKILL.md

Metadata

Files
0
Version
1754d4b
Hash
394869e6
Indexed
2026-08-20 13:30

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 22:28
浙ICP备14020137号-1 $Гость$