Auto Model Router Skill
You have intelligent model routing. For every substantive task, follow this procedure.
Task Categories
Classify tasks into one of these categories:
| Category | When to use |
|---|
| INLINECODE0 | Writing code, debugging, implementing features, architecture |
| INLINECODE1 |
Reviewing existing code, security/performance analysis |
|
math_reasoning | Math problems, logic puzzles, quantitative analysis |
|
writing_long | Articles, reports, essays, long documents |
|
writing_short | Titles, slogans, social posts, short copy |
|
translation | Translating between languages |
|
summarization | Summarizing long texts, meeting notes |
|
data_analysis | Analyzing data, writing SQL, interpreting charts |
|
image_understanding | Analyzing or describing images |
|
daily_chat | Casual Q&A, simple questions, general assistance |
Procedure
Check whether AUTO_MODEL_ROUTER_URL is set to determine which mode to use.
Mode A — Local (default, no router needed)
Use this when AUTO_MODEL_ROUTER_URL is NOT set.
Step 1 — Classify the task yourself
Read the user's task and determine the best category from the table above.
Be decisive — pick one category.
Step 2 — Call the model
CODEBLOCK0
Exit codes:
- -
3 — API key missing: tell the user which env var to set - INLINECODE13 — Config not found: tell the user to run INLINECODE14
- INLINECODE15 — No routes configured at all: tell the user to run INLINECODE16
Step 3 — Present the result
Show the response naturally. Add a subtle footer:
_[auto-model-router: used {category} → {model}]_
Mode B — Router (with learning)
Use this when AUTO_MODEL_ROUTER_URL is set.
Privacy note: Task text and an anonymous session ID are sent to the router
at AUTO_MODEL_ROUTER_URL. This URL is always set by the user — the skill has
no built-in remote endpoint. If the user has not explicitly set this variable,
always use Mode A.
Step 1 — Get recommendation
CODEBLOCK1
- - Capture stdout as the model response.
- Extract
TASK_ID from stderr (line starting with TASK_ID=).
Exit codes:
- -
2 — Router offline: fall back to Mode A automatically - INLINECODE23 — API key missing: tell the user which env var to set
Step 2 — Present the result
Same as Mode A Step 3.
Step 3 — Collect feedback
Ask once after presenting the result:
"Was this response helpful? Reply 👍, 👎, or skip."
If 👍:
CODEBLOCK2
If 👎:
CODEBLOCK3
If skip, do nothing.
Changing Model Assignments
When the user says things like "switch to GPT-4o for translation" or "use DeepSeek for coding":
CODEBLOCK4
Examples:
CODEBLOCK5
Confirm to the user: "Done, {category} tasks will now use {model}."
First-time Setup
If config is missing, tell the user to run:
CODEBLOCK6
Manual Invocation
INLINECODE24
自动模型路由技能
您拥有智能模型路由功能。对于每项实质性任务,请遵循以下流程。
任务分类
将任务归类到以下类别之一:
| 类别 | 使用场景 |
|---|
| coding | 编写代码、调试、实现功能、架构设计 |
| code_review |
审查现有代码、安全/性能分析 |
| math_reasoning | 数学问题、逻辑谜题、定量分析 |
| writing_long | 文章、报告、论文、长文档 |
| writing_short | 标题、标语、社交帖子、短文案 |
| translation | 语言之间的翻译 |
| summarization | 总结长文本、会议记录 |
| data_analysis | 分析数据、编写SQL、解读图表 |
| image_understanding | 分析或描述图像 |
| daily_chat | 日常问答、简单问题、一般性帮助 |
流程
检查是否设置了 AUTOMODELROUTER_URL 以确定使用哪种模式。
模式 A — 本地(默认,无需路由器)
当 AUTOMODELROUTER_URL 未设置时使用此模式。
步骤 1 — 自行分类任务
阅读用户的任务,从上方表格中确定最佳类别。
果断选择——只选一个类别。
步骤 2 — 调用模型
python3 ~/.claude/skills/auto-model-router/scripts/call_model.py <类别> <用户任务文本>
退出码:
- - 3 — API密钥缺失:告知用户需要设置哪个环境变量
- 4 — 配置未找到:告知用户运行 python3 scripts/setup.py
- 5 — 未配置任何路由:告知用户运行 python3 scripts/setup.py
步骤 3 — 展示结果
自然地展示回复。添加一个微小的页脚:
[自动模型路由:使用了 {类别} → {模型}]
模式 B — 路由器(带学习功能)
当设置了 AUTOMODELROUTER_URL 时使用此模式。
隐私说明: 任务文本和匿名会话ID将发送到
AUTOMODELROUTER_URL 的路由器。此URL始终由用户设置——该技能
没有内置的远程端点。如果用户未明确设置此变量,
始终使用模式A。
步骤 1 — 获取推荐
python3 ~/.claude/skills/auto-model-router/scripts/recommend.py <用户任务文本> <用户ID>
- - 捕获标准输出作为模型回复。
- 从标准错误输出中提取 TASKID(以 TASKID= 开头的行)。
退出码:
- - 2 — 路由器离线:自动回退到模式A
- 3 — API密钥缺失:告知用户需要设置哪个环境变量
步骤 2 — 展示结果
与模式A步骤3相同。
步骤 3 — 收集反馈
在展示结果后询问一次:
这个回复有帮助吗?请回复 👍、👎 或跳过。
如果 👍:
python3 ~/.claude/skills/auto-model-router/scripts/feedback.py 1 <用户ID>
如果 👎:
python3 ~/.claude/skills/auto-model-router/scripts/feedback.py -1 <用户ID>
如果跳过,则不执行任何操作。
更改模型分配
当用户说将翻译切换到GPT-4o或编码使用DeepSeek时:
python3 ~/.claude/skills/auto-model-router/scripts/update_route.py <类别> <提供商> <模型>
示例:
python3 ~/.claude/skills/auto-model-router/scripts/update_route.py translation openai gpt-4o
python3 ~/.claude/skills/auto-model-router/scripts/update_route.py coding deepseek deepseek-chat
python3 ~/.claude/skills/auto-model-router/scripts/updateroute.py dailychat google gemini-2.0-flash
向用户确认:已完成,{类别}任务现在将使用{模型}。
首次设置
如果配置缺失,告知用户运行:
python3 ~/.claude/skills/auto-model-router/scripts/setup.py
手动调用
/auto-model-router <您的任务>