OpenClaw Model Router Skill
Deterministic model routing with a closed-loop production switch pipeline.
Why use this skill
- - Explicit user intent routing (
@codex, @mini) - Time-window model policy (
router.schedule.json) - Safe switch flow with verification and rollback
- Concurrency lock to prevent race conditions
- Structured audit logs for operations and incident review
Core capabilities
1) Prefix routing
- -
@codex → INLINECODE4 - INLINECODE5 → INLINECODE6
- Aliases:
@c, INLINECODE8
2) Scheduler routing
- - Rule-based windows by day/time/priority
- Timezone-aware resolution (
router.schedule.json.timezone) - Supports overnight windows (e.g. 18:00 → 09:00)
3) Production switch loop
- -
schedule apply / INLINECODE11 - Auth gate (
auth.requiredEnv[]) - Switch + readback verify
- Failure classification (
auth_expired, rate_limit, provider_drift, unknown) - Optional rollback (
safety.rollbackOnFailure) - Lock file (
safety.lockPath) to avoid concurrent switching - Audit logs (
router.log.jsonl + rotation)
Quick commands
CODEBLOCK0
Key config files
- -
router.config.json (prefix map, retry, auth, safety, logging, controller) - INLINECODE21 (timezone + rules)
Reliability checklist
- - Deterministic mapping
- Idempotent switching behavior
- Execute only after switch verification
- Observable success/failure events
- Recoverability on failure paths
Tests
CODEBLOCK1
OpenClaw 模型路由技能
具有闭环生产切换管道的确定性模型路由。
为何使用此技能
- - 明确的用户意图路由(@codex、@mini)
- 时间窗口模型策略(router.schedule.json)
- 带验证和回滚的安全切换流程
- 并发锁以防止竞态条件
- 用于操作和事件审查的结构化审计日志
核心能力
1) 前缀路由
- - @codex → openai-codex/gpt-5.3-codex
- @mini → minimax/MiniMax-M2.5
- 别名:@c、@m
2) 调度器路由
- - 基于日/时间/优先级的规则窗口
- 时区感知解析(router.schedule.json.timezone)
- 支持隔夜窗口(例如 18:00 → 09:00)
3) 生产切换循环
- - schedule apply / schedule end
- 认证网关(auth.requiredEnv[])
- 切换 + 回读验证
- 失败分类(authexpired、ratelimit、provider_drift、unknown)
- 可选回滚(safety.rollbackOnFailure)
- 锁文件(safety.lockPath)以避免并发切换
- 审计日志(router.log.jsonl + 轮转)
快速命令
bash
验证配置
node src/cli.js validate
路由检查
node src/cli.js route @codex implement this --json
调度器
node src/cli.js schedule validate
node src/cli.js schedule resolve --at 2026-03-02T10:00:00+01:00 --json
node src/cli.js schedule apply --json
node src/cli.js schedule end --id workday_codex --json
关键配置文件
- - router.config.json(前缀映射、重试、认证、安全、日志记录、控制器)
- router.schedule.json(时区 + 规则)
可靠性检查清单
- - 确定性映射
- 幂等切换行为
- 仅在切换验证后执行
- 可观察的成功/失败事件
- 失败路径的可恢复性
测试
bash
node --test