model-fallback
模型自动降级与故障切换。当主模型请求失败、超时、达到速率限制或配额耗尽时,自动切换到备用模型,确保服务连续性。支持多供应商、多优先级的智能模型选择,提供健康监控、自动重试和错误恢复机制。
npx skills add majiayu000/claude-skill-registry --skill model-fallback-aaaaqwq-agi-super-skills --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 模型自动降级与故障切换 ## 概述 本技能提供完整的模型自动降级和故障切换解决方案,确保在主模型不可用时自动切换到备用模型,维持 AI 助手的持续服务能力。 ## 核心功能 ### 1. 智能模型选择 根据任务类型和模型状态智能选择最合适的模型: ```yaml 优先级顺序: 1. anapi/opus-4.5 # 最强能力,最高优先级 2. zai/glm-4.7 # 中文优化,性价比高 3. openrouter-vip/gpt-5.2-codex # 编码专用 4. github-copilot/claude-sonnet-4-5 # 免费备用 ``` ### 2. 故障检测与处理 自动检测以下故障并触发切换: - **超时错误** (timeout): 请求超过设定时间 - **速率限制** (rate_limit): API 调用频率超限 - **配额耗尽** (quota_exceeded): token 配额用尽 - **认证错误** (authentication): API 密钥失效 - **服务不可用** (service_unavailable): 供应商服务故障 - **网络错误** (network_error): 连接失败 ### 3. 重试机制 智能重试策略: ```yaml 重试配置: 最大重试次数: 3 初始延迟: 1000ms 最大延迟: 10000ms 退避倍数: 2.0 使用备用模型: true ``` 重试时间线: ``` 第1次失败 → 等待 1s → 重试 第2次失败 → 等待 2s → 重试 第3次失败 → 等待 4s → 切换模型 ``` ### 4. 健康监控 持续监控所有模型供应商的健康状态: ```bash # 每5分钟检查一次 检查项目: - API 端点连通性 - 响应时间 - 错误率 - 配额使用情况 ``` ## 快速开始 ### 1. 配置模型降级 配置文件:`~/.openclaw/agents/main/agent/agent.json` ```json { "model": "anapi/opus-4.5", "modelFallback": [ "zai/glm-4.7", "openrouter-vip/gpt-5.2-codex", "github-copilot/claude-sonnet-4-5" ], "retry": { "maxAttempts": 3, "initialDelayMs": 1000, "maxDelayMs": 10000, "backoffMultiplier": 2.0, "useFallbackOnFailure": true } } ``` ### 2. 启动监控 ```bash # 启动后台监控 ~/.openclaw/scripts/mo
- 概述
- 核心功能
- 1. 智能模型选择
- 2. 故障检测与处理
- 3. 重试机制
- 4. 健康监控
- 快速开始
- 1. 配置模型降级
- 2. 启动监控
- 3. 手动触发切换
- 工作流程
- 正常请求流程
- 故障切换流程
- 监控流程
tail -f ~/.openclaw/logs/model-fallback.log tail -f ~/.openclaw/logs/model-monitor.log tail -f ~/.openclaw/logs/*.log JSON 格式状态 cat ~/.openclaw/logs/model-status.json | python3 -m json.tool cat ~/.openclaw/agents/main/agent/agent.json | grep modelFallback tail -20 ~/.openclaw/logs/model-fallback.log ps aux | grep monitor-models cat ~/.openclaw/logs/model-monitor.pid cat ~/.openclaw/agents/main/agent/auth-profiles.json
What does the model-fallback skill do?
模型自动降级与故障切换。当主模型请求失败、超时、达到速率限制或配额耗尽时,自动切换到备用模型,确保服务连续性。支持多供应商、多优先级的智能模型选择,提供健康监控、自动重试和错误恢复机制。
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill model-fallback-aaaaqwq-agi-super-skills --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
