Chuyển đến nội dung
Skillpedia
Agent394k · #10

add-model-provider

Skill này làm gì

Skill hướng dẫn một agent AI kết nối một nhà cung cấp mô hình mới với OpenClaw bằng các lệnh thiết lập thay vì sửa file bằng tay. Nó dành cho những ai muốn chạy một mô hình AI khác trong cài đặt OpenClaw của mình.

Khi nào nên dùng

  • ✓Khi bạn muốn kết nối một nhà cung cấp mô hình AI mới vào cài đặt OpenClaw.
  • ✓Khi bạn cần kiểm tra mô hình và cách đăng nhập nào đã được thiết lập trong OpenClaw.
  • ✓Khi bạn muốn chạy thử trực tiếp để xác nhận nhà cung cấp mới hoạt động trước khi dựa vào nó.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/openclaw/openclaw/blob/main/custodian-skills/add-model-provider/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Giúp tôi thêm một nhà cung cấp mô hình AI mới vào OpenClaw và kiểm tra xem nó có phản hồi không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill kiểm tra cài đặt mô hình và plugin hiện tại của bạn, sau đó thêm nhà cung cấp bằng chính các lệnh của OpenClaw. Khóa được lưu dưới dạng tham chiếu tới một nguồn bí mật, không phải văn bản thuần, và việc thiết lập kết thúc bằng một bài kiểm tra trực tiếp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Câu hỏi thường gặp

API key của tôi có bị lưu dạng văn bản thuần không?

Không. Skill lưu thông tin xác thực dưới dạng tham chiếu tới một biến môi trường hoặc file, nên giá trị bí mật không bị ghi vào cấu hình.

Tại sao dùng lệnh thay vì sửa file cấu hình?

Lệnh kiểm tra từng thay đổi và giữ lại nhật ký, giúp tránh cài đặt bị hỏng.

Điều gì xảy ra nếu thiếu một plugin cần thiết?

Skill kiểm tra điều này trong lúc thiết lập và bật hoặc cài plugin cần thiết trước khi chạy bài kiểm tra.

Chi tiết

Mô tả gốc của tác giả

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

repo: openclaw/openclaw

Độ phổ biến

Sao GitHub
394k
Vị trí xếp hạng
#10
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự