Model Hierarchy Routing Skill
Routes each task to the cheapest capable model by complexity, cutting AI agent token spend by roughly 10x.
Pure advisory prompt skill: no permissions requested, no external actions, no sensitive-data handling; minimal attack surface. Deducted for: model-switch/sub-agent suggestions lack explicit user-confirmation and rollback norms, and cost claims read as marketing.
SKILL.md pseudocode (vision override first) is inconsistent with test_classification.py (escalation first, no vision rule); tests/scenarios. is absent from source files so key paths cannot be statically reproduced. Deducted for: fragile keyword heuristics ('why', 'production' can misfire) and thin failure-feedback design.
Triggers, classification examples, and non-fit boundaries (text-only models excluded from vision) are clearly stated, and GLM/Kimi inclusion helps Chinese users. Deducted for: prices dated Feb 2026 (unverifiable/stale) and core value depending on reachability of OpenRouter and overseas APIs.
MIT license, versioned pyproject (0.1.0), author metadata, and well-layered docs. Deducted for: no CHANGELOG, no stated maintenance/update path, and README-referenced scenarios./examples not present in provided sources.
Rules, decision algorithm, and integration snippets are directly copy-usable and offer marginal value over manual routing. Deducted for: the 10x savings claim rests on unverified 80/15/5 assumptions, pricing may be outdated, and static review cannot confirm realized routing benefit.
Test code and cost functions are auditable and the cost math is independently recomputable. Deducted for: missing scenarios. data, no CI or third-party execution evidence, and price/savings claims resting on author assertions only.
- Model prices are dated Feb 2026; verify against current official pricing before use.
- Classification rule ordering differs between SKILL.md pseudocode (vision override first) and test code (escalation first) — reconcile before implementing.
- tests/scenarios. and README-referenced examples/ are not present in the provided sources and cannot be statically verified.
- Keyword heuristics risk false escalation ('why', 'production' jump straight to Tier 3), which could raise costs.
- Users relying on OpenRouter/overseas APIs (including mainland-China users) should confirm network reachability first.
What does this skill do, and when should you use it?
model-hierarchy is an OpenClaw skill built on one claim: 80% of agent tasks — file reads, status checks, formatting, simple Q&A — don't need expensive models. It ships a three-tier model price table (cheap, mid, premium), a routine/moderate/complex task classification rubric, and a decision algorithm that steers each task to the cheapest model that can handle it. Under an 80/15/5 task split, estimated monthly cost drops from ~$225 (pure Opus) to ~$19. The skill is pure Markdown instruction with no scripts, so it drops into any Agent Skills-compatible client.
When a task arrives, the skill instructs the agent to: (1) classify it as routine, moderate, or complex based on features like single-step operations and judgment requirements; (2) check whether the task needs image input and, if so, rule out text-only models like GLM 5 in favor of vision-capable ones such as Kimi K2.5; (3) select a model tier using keyword signals (debug, security, etc.) and an escalation rule after failures; (4) suggest downgrades for routine work or spawn sub-agents on cheap models, and request explicit upgrades when stuck; (5) force heartbeats and scheduled tasks onto Tier 1 models. It executes no code itself — everything works through prompt instructions.
- Teams running many OpenClaw agents where heartbeats and cron jobs burn tokens daily — pin monitoring tasks to cheap models like DeepSeek.
- Claude Code developers who want a CLAUDE.md rule that background sub-agents use Haiku for file ops while Sonnet is reserved for code generation and analysis.
- OpenRouter users juggling multiple models who need to distinguish text-only models (GLM 5) from multimodal ones (Kimi K2.5) for screenshot-heavy tasks.
- Budget-conscious individual agent users who want the agent to proactively suggest a cheaper model on routine work instead of silently overspending.
- Engineers building their own agent frameworks who can reuse the keyword-signal classification approach from get_model_for_task().
What are this skill's strengths and limitations?
- Concrete three-tier price table plus an 80/15/5 cost breakdown gives the routing decisions a quantified basis.
- Explicit vision-capability exceptions prevent image tasks being misassigned to text-only models.
- Pure Markdown instructions with no scripts or runtime dependencies — portable to any Agent Skills-compatible environment.
- Integration examples for OpenClaw, Claude Code, and generic Python make adoption paths clear.
- Prices are labeled as of Feb 2026 and the skill itself says to check provider docs — rates may be stale.
- The 10x savings figure is an estimate assuming 100K tokens/day; the repo offers no measured validation.
- Complexity classification relies on keyword signals and heuristics, which can misroute deep-reasoning tasks as routine.
- Coverage centers on OpenClaw and Claude Code; other agent systems get only a generic example with no full install docs.
How do you install this skill?
OpenClaw: copy SKILL.md to ~/.openclaw/skills/model-hierarchy/SKILL.md, then run openclaw gateway restart. Claude Code / Codex: add the Model Routing section from the README to your CLAUDE.md or project instructions. The repo also includes tests/ (test_classification.py, scenarios.) and examples/ directories; run tests with python -m pytest tests/ -v. Installation steps for other agent systems are not documented.
How do you use this skill?
Once installed, the skill activates on triggers like "model routing", "cost optimization", "which model", "too expensive", or "spawn agent". In normal operation the agent classifies tasks automatically and suggests model changes; you can also switch manually in an OpenClaw session with /model opus (upgrade for complex tasks), /model deepseek (downgrade for routine), or spawn a sub-agent with sessions_spawn set to model: deepseek. Sample phrasing: "This looks like routine file work. Want me to spawn a sub-agent on DeepSeek for this? Same result, fraction of the cost."