← 返回
开发者工具 中文

AI Task Router Auto-Route Prompts by Complexity (Local/Cloud)

Regex-based routing sends simple tasks to local AI, medium to mid-tier, complex to premium — saving 60%+ on API costs.
正则路由将简单任务分流至本地AI,中等任务至中端模型,复杂任务至高级模型,节省60%以上的API成本。
theshadowrose theshadowrose 来源
开发者工具 clawhub v1.0.0 1 版本 99873.6 Key: 无需
★ 0
Stars
📥 790
下载
💾 8
安装
1
版本
#auto-routing#complexity-detection#cost-optimization#latest#ollama#smart-dispatch#task-routing

概述

AI Task Router — Auto-Route Prompts by Complexity (Local/Cloud)

Regex-based routing sends simple tasks to local AI, medium to mid-tier, complex to premium — saving 60%+ on API costs.


Automatically routes prompts to the cheapest model that can handle them.

How It Works

Pattern matching classifies tasks into tiers:

Task TypeExampleRouted ToCost
-------------------------------------
Simple"hi", "thanks", "what time is it"Local (Ollama)$0
Moderate"write an email", "analyze this"Mid-tier (Sonnet)$
Complex"debug this codebase", "write a chapter"Premium (Opus)$$$

Usage

const { TaskRouter } = require('./src/task-router');

const router = new TaskRouter({
  defaultModel: 'local',
  escalationModel: 'sonnet',
  heavyModel: 'opus'
});

const result = router.route('analyze the sales data from Q3');
// { model: 'sonnet', reason: 'Analysis task', confidence: 0.8 }

Custom Rules

Add your own routing patterns:

router.addRule({
  name: 'code-review',
  pattern: /\b(review|refactor|debug|optimize)\b.*\b(code|function|class)\b/i,
  model: 'opus',
  reason: 'Code review needs deep reasoning'
});

Cost Savings

Typical usage pattern routes ~70% of tasks to free local models, ~25% to mid-tier, and ~5% to premium. With Opus at $15/M tokens vs Ollama at $0, this saves 60-80% on API costs.


⚠️ Disclaimer

This software is provided "AS IS", without warranty of any kind, express or implied.

USE AT YOUR OWN RISK.

  • The author(s) are NOT liable for any damages, losses, or consequences arising from

the use or misuse of this software — including but not limited to financial loss,

data loss, security breaches, business interruption, or any indirect/consequential damages.

  • This software does NOT constitute financial, legal, trading, or professional advice.
  • Users are solely responsible for evaluating whether this software is suitable for

their use case, environment, and risk tolerance.

  • No guarantee is made regarding accuracy, reliability, completeness, or fitness

for any particular purpose.

  • The author(s) are not responsible for how third parties use, modify, or distribute

this software after purchase.

By downloading, installing, or using this software, you acknowledge that you have read

this disclaimer and agree to use the software entirely at your own risk.

DATA DISCLAIMER: This software processes and stores data locally on your system.

The author(s) are not responsible for data loss, corruption, or unauthorized access

resulting from software bugs, system failures, or user error. Always maintain

independent backups of important data. This software does not transmit data externally

unless explicitly configured by the user.


Support & Links

------
🐛 Bug ReportsTheShadowyRose@proton.me
Ko-fiko-fi.com/theshadowrose
🛒 Gumroadshadowyrose.gumroad.com
🐦 Twitter@TheShadowyRose
🐙 GitHubgithub.com/TheShadowRose
🧠 PromptBasepromptbase.com/profile/shadowrose

Built with OpenClaw — thank you for making this possible.


🛠️ Need something custom? Custom OpenClaw agents & skills starting at $500. If you can describe it, I can build it. → Hire me on Fiverr

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 16:55 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

suspicious
查看报告

🔗 相关推荐

ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,082 📥 811,346
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,380 📥 320,585
content-creation

SocialPack Multi-Platform Social Media Generator

theshadowrose
通过单一简报生成多平台社交媒体帖子。支持Twitter话题串、LinkedIn、Instagram和Reddit。一次输入,覆盖所有平台。
★ 0 📥 2,004