← Back to Skills Marketplace
larios613-hub

Model Routing Middleware

by larios613-hub · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ pending
50
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install model-routing-middleware
Description
Intelligent model selection middleware for AI agents. Route tasks to the best model, manage context, and cut API costs 40-70%.
README (SKILL.md)

Model Routing — Intelligent Model Selection Middleware

Automatically select the best LLM model and think mode based on task type, context size, and response confidence. Cut API costs 40-70% by routing simple tasks to fast models and complex tasks to capable ones.

How It Works

User message → Task Classifier → Model Router → Best Model → Response
                                     ↓
                          Low confidence? → Escalate to stronger model

Quick Start

# config.yaml
models:
  casual_chat:
    model: qwen3-14b
    think: false
  coding:
    model: qwen-coder
    think: true
  reasoning:
    model: deepseek-r1
    think: true
  long_context:
    model: glm-5.1
    think: false
from router import get_router

router = get_router()
result = await router.route("Write a Python web scraper")
# → Routes to qwen-coder with think=True

Features

  • Task-type classification (coding, reasoning, chat, summarization)
  • Per-model think mode configuration
  • Confidence-based escalation (retry with stronger model)
  • Context management and compaction at 55% threshold
  • Hot-reload configuration (no restart needed)
  • 83 tests passing

Cost Savings

Task Type Without Routing With Routing Savings
Casual chat GPT-4 ($0.03/1K) Qwen3-14B (local) ~100%
Coding GPT-4 ($0.03/1K) Qwen-Coder (local) ~95%
Hard reasoning GPT-4 ($0.03/1K) DeepSeek-R1 (local) ~90%

License

MIT

How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install model-routing-middleware
  3. After installation, invoke the skill by name or use /model-routing-middleware
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release - intelligent model selection, cost optimization, confidence escalation
Metadata
Slug model-routing-middleware
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Model Routing Middleware?

Intelligent model selection middleware for AI agents. Route tasks to the best model, manage context, and cut API costs 40-70%. It is an AI Agent Skill for Claude Code / OpenClaw, with 50 downloads so far.

How do I install Model Routing Middleware?

Run "/install model-routing-middleware" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Model Routing Middleware free?

Yes, Model Routing Middleware is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Model Routing Middleware support?

Model Routing Middleware is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Model Routing Middleware?

It is built and maintained by larios613-hub (@larios613-hub); the current version is v1.0.0.

💬 Comments