Openclaw Model Switch

👤 williamwg2025 📦 v0.1.3 ⭐ 4.2 ⬇️ 1.1K 下載
🤖 AI-Agent 免費 🔑 需 API Key

📖 技能介紹


name: openclaw-model-switch displayName: OpenClaw Model Switch - AI 模型切換 version: 1.0.1 description: | OpenClaw AI 模型切換技能 - 用自然語言切換和新增 AI 模型。 支援 9+ 預置提供商(Gemini/GPT/Claude/Qwen/Kimi 等),智慧判斷模型特性,一鍵配置 API Key。 自動備份配置,安全重啟閘道器。 關鍵詞:openclaw, model, switch, ai, multi-model, configuration, api license: MIT-0 acceptLicenseTerms: true tags: - openclaw - model - switch - multi-model - configuration - api-management - ai-providers - gemini - gpt - claude


Model Switch 技能

用自然語言指令切換和新增 AI 模型。

功能

切換模型

  • use <model> - 切換到指定模型
  • 切換模型 - 進入互動式引導
  • 當前模型 - 檢視當前模型

新增模型(最佳化版)

  • 新增模型 - 進入最佳化後的新增流程
  • 智慧判斷模型特性
  • 一鍵配置 API Key
  • 自動儲存配置

🚀 安裝

cd ~/.openclaw/workspace/skills
# 技能已安裝在:~/.openclaw/workspace/skills/model-switch
chmod +x model-switch/scripts/*.py

就這麼簡單!所有指令碼已包含,無需外部克隆。


📖 使用

# 切換模型
python3 scripts/switch-model.py gemini

# 新增模型(最佳化版)
python3 scripts/add-model-guide.py

# 檢視模型列表
python3 scripts/check-status.py

預置提供商

  1. Google (Gemini)
  2. OpenAI (GPT)
  3. Anthropic (Claude)
  4. Qwen (通義千問)
  5. Moonshot (Kimi)
  6. MiniMax
  7. GLM (智譜)
  8. DeepSeek
  9. Custom Provider

最佳化特性

  • ✅ 智慧判斷模型特性(圖片/推理支援)
  • ✅ 預置預設引數(contextWindow/maxTokens)
  • ✅ 簡化操作流程(一輪對話完成)
  • ✅ 自動配置 API Key
  • ✅ Endpoint compatibility 支援

🔒 安全說明

配置修改 ⚠️

本技能會修改 OpenClaw 配置檔案:

讀取: - ~/.openclaw/openclaw.json - 主配置檔案 - ~/.openclaw/workspace/skills/model-switch/config/models.json - 模型預設

寫入: - ~/.openclaw/openclaw.json - 更新模型配置和 API Key - ~/.openclaw/openclaw.json.bak - 自動備份(切換前)

系統操作 ⚠️

本技能會執行系統命令: - openclaw gateway restart - 重啟閘道器(應用新配置) - openclaw gateway status - 檢查閘道器狀態

影響: - 重啟期間服務短暫不可用(約 5-10 秒) - 正在進行的會話可能中斷

來源於7w4.net。

API 金鑰儲存 ⚠️

API Key 儲存方式: - 位置: ~/.openclaw/openclaw.json - 格式: 明文儲存(未加密) - 許可權: 取決於檔案許可權(建議 chmod 600

安全建議: 1. 備份配置檔案:cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak 2. 設定檔案許可權:chmod 600 ~/.openclaw/openclaw.json 3. 不要將配置檔案提交到 Git 4. 如需要更安全的儲存,手動編輯 openclaw.json 並使用外部金鑰管理

網路訪問

  • 指令碼呼叫 OpenClaw CLI - 執行 openclaw gateway restart 會觸發網路請求
  • 閘道器重啟後 - OpenClaw 會連線配置的模型 API(這是預期行為)
  • 不直接聯網 - 指令碼本身不直接傳送 HTTP 請求

資料安全

  • 不上傳: 不傳送資料到外部伺服器(除模型 API 呼叫外)
  • 本地儲存: 所有配置儲存在本地

使用建議

  1. 備份配置: 執行前備份 ~/.openclaw/openclaw.json
  2. 測試環境: 先在測試環境驗證
  3. 檢查配置: 新增模型後檢查 openclaw.json 確認配置正確
  4. 許可權控制: 確保 openclaw.json 許可權正確(chmod 600

作者: @williamwg2025
版本: 1.0.1
許可證: MIT-0

🤖 AI 評測

這是一款實用的模型切換工具,能幫助使用者快速在 Gemini、GPT、Claude 等模型間切換,配有詳細的中文文件和安全提示。它的一大亮點是會自動備份配置、驗證閘道器狀態,用起來比較放心。不過實際支援的模型數量比宣傳的少一些,而且缺少自動化測試,長遠使用可能存在隱患。適合需要頻繁換模型、對配置有一定了解的使用者。

📊 多維度評分

適應性4.2
規範性4.2
有效性4.2
可靠性4
可信度4.8

📁 包含檔案 (9 個)

📄 README.md 3.2 KB
📄 README_EN.md 2 KB
📄 SKILL.md 3.7 KB
📄 _meta.json 142 B
📄 config/models.json 1.4 KB
📄 scripts/add-model-guide.py 9.9 KB
📄 scripts/check-status.py 1.4 KB
📄 scripts/list.py 3.4 KB
📄 scripts/switch-model.py 5.4 KB