smart-model-switcher-v3

Universal Smart Model Switcher V3 - Multi-Provider, Multi-Model intelligent switching. Automatically selects the best model from ALL your purchased API plans (Bailian/Qwen, MiniMax, GLM, Kimi, etc.). Zero-latency runtime switching, no restart required. Supports 50+ models across all providers with advanced task classification and fallback logic.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "smart-model-switcher-v3" with this command: npx skills add davidme6/openclaw@smart-model-switcher-v3

🧠 Smart Model Switcher V3 (Universal Multi-Provider)

全平台多模型智能切换 • 零延迟 • 无需重启 • 自动 fallback

🎯 V3 核心升级

特性V2V3
支持 provider仅 Bailian/Qwen全平台 (Bailian/MiniMax/GLM/Kimi/等)
模型数量~5 个50+ 个
API Key 验证❌ 无✅ 自动验证
套餐检测❌ 无✅ 自动检测已购套餐
跨 provider 切换❌ 不支持✅ 支持
成本优化❌ 无✅ 优先使用性价比高的模型
多 key 管理❌ 单 key✅ 多 provider key 管理

支持的 Provider 和模型

百炼 (Bailian) - Qwen 系列

模型适用场景Context优先级
qwen3.5-plus写作/长文档/翻译1M⭐⭐⭐
qwen3-coder-plus编程/Debug100K⭐⭐⭐
qwen3-max-2026-01-23复杂推理/数学100K⭐⭐⭐
qwen3.5-397b-a17b通用任务262K⭐⭐
qwen-plus日常对话/快速任务131K
qwen-turbo简单任务/低成本32K

MiniMax 系列

模型适用场景Context优先级
MiniMax-M2.5通用/对话256K⭐⭐⭐
MiniMax-Text-01长文本处理1M⭐⭐

智谱 (GLM) 系列

模型适用场景Context优先级
glm-5通用/推理128K⭐⭐⭐
glm-4.7快速任务128K⭐⭐

月之暗面 (Kimi) 系列

模型适用场景Context优先级
kimi-k2.5长文档/分析200K+⭐⭐⭐

🚀 核心功能

1. 全平台模型支持

  • ✅ Bailian (Qwen 系列)
  • ✅ MiniMax
  • ✅ GLM (智谱)
  • ✅ Kimi (月之暗面)
  • ✅ 自动扩展新 provider

2. API Key 自动验证

启动时自动检测:
├── bailian API Key → ✅ 有效/❌ 无效
├── minimax API Key → ✅ 有效/❌ 无效
├── glm API Key → ✅ 有效/❌ 无效
└── kimi API Key → ✅ 有效/❌ 无效

3. 套餐检测

已购套餐检测:
├── Bailian → qwen3.5-plus, qwen3-coder-plus, ...
├── MiniMax → MiniMax-M2.5, ...
├── GLM → glm-5, glm-4.7, ...
└── Kimi → kimi-k2.5, ...

4. 智能任务分类 (增强版)

任务类型关键词首选模型备选 1备选 2
编程代码/编程/python/js/函数/debug/bugqwen3-coder-plusglm-5MiniMax-M2.5
写作小说/故事/文章/写作/创作qwen3.5-pluskimi-k2.5qwen3.5-397b
推理推理/数学/逻辑/证明/计算qwen3-maxglm-5qwen3.5-plus
分析分析/数据/报告/总结/对比qwen3.5-pluskimi-k2.5glm-5
翻译翻译/英文/中文/语言qwen3.5-plusglm-5MiniMax-M2.5
长文档长文档/万字/10 万/1M/长篇qwen3.5-pluskimi-k2.5MiniMax-Text-01
对话聊天/你好/在吗/帮助MiniMax-M2.5qwen-plusglm-4.7
快速简单/快速/马上/立刻qwen-turboqwen-plusglm-4.7

5. 成本优化策略

选择逻辑:
1. 任务匹配 → 找到最适合的模型
2. 可用性检查 → 确认 API Key 有效且有套餐
3. 成本优化 → 同等级别优先使用性价比高的
4. Fallback → 主模型不可用时自动降级

6. 零延迟切换

  • ⚡ 无需重启 gateway
  • ⚡ 运行时模型选择 (<100ms)
  • ⚡ 连接池预加载
  • ⚡ 用户无感知切换

📊 架构图

┌─────────────────────────────────────────────────────────┐
│                   用户请求                               │
└─────────────────────────────────────────────────────────┘
                          ↓
┌─────────────────────────────────────────────────────────┐
│           API Key 验证器 (启动时)                        │
│  • bailian API Key → 验证                                │
│  • minimax API Key → 验证                                │
│  • glm API Key → 验证                                    │
│  • kimi API Key → 验证                                   │
│  • 生成可用模型列表                                      │
└─────────────────────────────────────────────────────────┘
                          ↓
┌─────────────────────────────────────────────────────────┐
│              任务分析器 (50ms)                           │
│  • 多语言关键词匹配                                     │
│  • 上下文分析                                           │
│  • 置信度评分                                           │
│  • 任务类型识别                                         │
└─────────────────────────────────────────────────────────┘
                          ↓
┌─────────────────────────────────────────────────────────┐
│           可用模型注册表 (预加载)                        │
│  • bailian/qwen3.5-plus (Ready) ✅                       │
│  • bailian/qwen3-coder-plus (Ready) ✅                   │
│  • bailian/qwen3-max (Ready) ✅                          │
│  • bailian/MiniMax-M2.5 (Ready) ✅                       │
│  • bailian/glm-5 (Ready) ✅                              │
│  • bailian/kimi-k2.5 (Ready) ✅                          │
│  • ... (所有已购模型)                                    │
└─────────────────────────────────────────────────────────┘
                          ↓
┌─────────────────────────────────────────────────────────┐
│          模型选择器 (30ms)                               │
│  • 根据任务类型选择最佳模型                              │
│  • 检查模型可用性 (API Key + 套餐)                       │
│  • 成本优化 (同等级别选性价比高的)                        │
│  • 应用 fallback 逻辑                                    │
└─────────────────────────────────────────────────────────┘
                          ↓
┌─────────────────────────────────────────────────────────┐
│              模型 API 调用                                │
│  • 直接 API 调用 (无需改配置)                             │
│  • 连接池                                               │
│  • 自动重试                                             │
└─────────────────────────────────────────────────────────┘
                          ↓
┌─────────────────────────────────────────────────────────┐
│                  响应                                    │
│  • 返回结果                                             │
│  • 记录性能                                             │
│  • 更新统计                                             │
└─────────────────────────────────────────────────────────┘

⚡ 性能指标

指标V2V3提升
支持模型数550+10x
支持 Provider14+4x
切换时间<100ms<80ms20% 更快
API Key 验证新功能
套餐检测新功能
成本优化新功能
内存占用+20%+25%可接受

🎯 使用示例

示例 1: 编程任务

用户:"帮我写个 Python 爬虫"
Agent: "🧠 已切换到 qwen3-coder-plus (最适合编程,Bailian)"
[完成任务]

示例 2: 写作任务

用户:"帮我写一本科幻小说"
Agent: "🧠 已切换到 qwen3.5-plus (最适合写作,1M 上下文)"
[完成任务]

示例 3: 跨 Provider 切换

用户:"这道数学题怎么做?"
Agent: "🧠 已切换到 qwen3-max (最适合推理,Bailian)"
[如果 qwen3-max 不可用]
Agent: "⚠️ qwen3-max 不可用,切换到 glm-5 (最佳备选)"
[完成任务]

示例 4: 长文档处理

用户:"帮我分析这个 10 万字的文档"
Agent: "🧠 已切换到 kimi-k2.5 (最适合长文档,200K+ 上下文)"
[完成任务]

示例 5: 成本优化

用户:"简单的问题,1+1 等于几"
Agent: "🧠 已切换到 qwen-turbo (快速任务,低成本)"
[完成任务]

🔧 配置

openclaw.json 配置

{
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://dashscope.aliyuncs.com/v1",
        "apiKey": "sk-bailian-xxx",
        "api": "openai-completions"
      },
      "minimax": {
        "baseUrl": "https://api.minimax.chat/v1",
        "apiKey": "sk-minimax-xxx",
        "api": "openai-completions"
      },
      "glm": {
        "baseUrl": "https://open.bigmodel.cn/api/paas/v4",
        "apiKey": "sk-glm-xxx",
        "api": "openai-completions"
      },
      "kimi": {
        "baseUrl": "https://api.moonshot.cn/v1",
        "apiKey": "sk-kimi-xxx",
        "api": "openai-completions"
      }
    }
  }
}

环境变量方式

# Bailian
export BAILIAN_API_KEY="sk-bailian-xxx"

# MiniMax
export MINIMAX_API_KEY="sk-minimax-xxx"

# GLM
export GLM_API_KEY="sk-glm-xxx"

# Kimi
export KIMI_API_KEY="sk-kimi-xxx"

📊 模型选择矩阵 (完整版)

任务类型首选 (Provider)备选 1 (Provider)备选 2 (Provider)延迟
编程qwen3-coder-plus (Bailian)glm-5 (GLM)MiniMax-M2.5 (MiniMax)<50ms
写作qwen3.5-plus (Bailian)kimi-k2.5 (Kimi)qwen3.5-397b (Bailian)<50ms
推理qwen3-max (Bailian)glm-5 (GLM)qwen3.5-plus (Bailian)<50ms
分析qwen3.5-plus (Bailian)kimi-k2.5 (Kimi)glm-5 (GLM)<50ms
翻译qwen3.5-plus (Bailian)glm-5 (GLM)MiniMax-M2.5 (MiniMax)<30ms
长文档qwen3.5-plus (Bailian)kimi-k2.5 (Kimi)MiniMax-Text-01 (MiniMax)<50ms
对话MiniMax-M2.5 (MiniMax)qwen-plus (Bailian)glm-4.7 (GLM)<30ms
快速qwen-turbo (Bailian)qwen-plus (Bailian)glm-4.7 (GLM)<20ms

⚠️ 限制

限制说明
套餐限制仅使用已购套餐内的模型
API Key 有效需要正确配置各 provider 的 API Key
网络要求需要能访问各 provider API
内存预加载占用约 25% 额外内存

🔍 技术细节

API Key 验证流程

1. 读取配置文件中的各 provider API Key
2. 对每个 provider 发送测试请求
3. 记录验证结果 (✅ 有效 / ❌ 无效)
4. 生成可用模型列表
5. 启动时完成,不影响运行时性能

套餐检测流程

1. 调用各 provider 的套餐查询 API
2. 解析返回的可用模型列表
3. 与本地模型注册表比对
4. 标记可用/不可用模型
5. 定期刷新 (默认 24h)

成本优化算法

1. 同任务类型有多个模型可选时
2. 比较各模型成本 (tokens/价格)
3. 选择性价比最高的
4. 用户可配置"优先质量"或"优先成本"

📈 优势

优势影响
全平台支持可使用所有已购模型
零延迟无需重启,瞬间切换
智能 fallback主模型不可用自动降级
成本优化自动选择性价比高的模型
自动验证启动时检查 API Key 有效性
套餐感知仅使用已购套餐内模型

📝 安装

# 克隆仓库
git clone https://github.com/davidme6/openclaw.git

# 复制 skill 到工作区
cp -r openclaw/skills/smart-model-switcher-v3 ~/.openclaw/workspace/skills/

# 或使用 ClawHub
npx skills add davidme6/openclaw@smart-model-switcher-v3

# 重启 Gateway (一次性)
openclaw gateway restart

🔧 使用

无需额外配置!Skill 会自动:

  1. 检测配置的 API Keys
  2. 验证各 provider 连接
  3. 查询已购套餐
  4. 生成可用模型列表
  5. 运行时智能切换

🆘 故障排除

Q: 为什么没有切换到某模型? A: 检查日志,可能该模型的 API Key 无效或套餐未购买。

Q: 如何查看可用模型列表? A: 运行 node scripts/check-availability.js 查看。

Q: 如何手动覆盖选择? A: 直接指定模型名称,skill 会使用该模型。

Q: 如何切换优先模式? A: 配置 priority: "quality"priority: "cost"

📞 支持


版本: 3.0.0 (Universal Multi-Provider) 作者: davidme6 许可: MIT 发布日期: 2026-03-10

🌟 V3 核心亮点

  1. 全平台支持 - Bailian/MiniMax/GLM/Kimi 等所有 provider
  2. API Key 验证 - 启动时自动验证所有 key
  3. 套餐检测 - 仅使用已购套餐内模型
  4. 成本优化 - 自动选择性价比高的模型
  5. 50+ 模型 - 支持所有主流大模型
  6. 零延迟 - 80ms 切换,无需重启

升级到 V3,解锁全平台模型智能切换! 🚀

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Chinese LLM Router

Route OpenClaw chats to top Chinese LLMs with smart model selection, auto-fallback, cost tracking, and unified OpenAI-compatible API access.

Registry SourceRecently Updated
9850Profile unavailable
General

Smart Model Switcher V2

智能模型自动切换 V5.0.2 - 多模态感知,自动识别图片/视频/音频/代码/文本任务,切换到最适合的模型。支持图片理解(qwen3-vl-plus)、视频音频(qwen3.5-plus)、代码(glm-5)、Office文档(MiniMax-M2.5)、推理等场景。零感知切换,无需手动操作。

Registry SourceRecently Updated
3520Profile unavailable
General

Bailian TTS

百炼 TTS 语音合成,支持多种音色切换,生成高质量中文语音,需配置百炼 API Key。

Registry SourceRecently Updated
1170Profile unavailable
Coding

Alibaba Cloud Bailian Qwen Image 2.0 image generation. Supports text-to-image and image-to-image (reference image + text). For product promotion image generation, e-commerce image editing, marketing material creation. Provides Python API, CLI tool, and ComfyUI custom nodes.

Alibaba Cloud Bailian Qwen Image 2.0 image generation. Supports text-to-image and image-to-image (reference image + text). For product promotion image genera...

Registry SourceRecently Updated
4101Profile unavailable