Smart Model Switching
Three-tier z.ai (GLM) routing: Flash → Standard → Plus / 32B
Start with the cheapest model. Escalate only when needed. Designed to minimize API cost without sacrificing correctness.
The Golden Rule
If a human would need more than 30 seconds of focused thinking, escalate from Flash to Standard.
If the task involves architecture, complex tradeoffs, or deep reasoning, escalate to Plus / 32B.
Model Reality (Relative)
| Tier |
Example Models |
Purpose |
| Flash |
GLM-4.5-Flash, GLM-4.7-Flash |
Fastest & cheapest |
| Standard |
GLM-4.6, GLM-4.7 |
Strong reasoning & code |
| Plus / 32B |
GLM-4-Plus, GLM-4-32B-128K |
Heavy reasoning & architecture |
Bottom line: Wrong model selection wastes money OR time. Flash for simple, Standard for normal work, Plus/32B for complex decisions.
💚 FLASH — Default for Simple Tasks
Stay on Flash for:
- Factual Q&A — “what is X”, “who is Y”, “when did Z”
- Quick lookups — definitions, unit conversions, short translations
- Status checks — monitoring, file reads, session state
- Heartbeats — periodic checks, OK responses
- Memory & reminders
- Casual conversation — greetings, acknowledgments
- Simple file ops — read, list, basic writes
- One-liner tasks — anything answerable in 1–2 sentences
- Cron jobs (always Flash by default)
NEVER do these on Flash
- ❌ Write code longer than 10 lines
- ❌ Create comparison tables
- ❌ Write more than 3 paragraphs
- ❌ Do multi-step analysis
- ❌ Write reports or proposals
💛 STANDARD — Core Workhorse
Escalate to Standard for:
Code & Technical
- Code generation — functions, scripts, features
- Debugging — normal bug investigation
- Code review — PRs, refactors
- Documentation — README, comments, guides
Analysis & Planning
- Comparisons and evaluations
- Planning — roadmaps, task breakdowns
- Research synthesis
- Multi-step reasoning
Writing & Content
- Long-form writing (>3 paragraphs)
- Summaries of long documents
- Structured output — tables, outlines
Most real user conversations belong here.
❤️ PLUS / 32B — Complex Reasoning Only
Escalate to Plus / 32B for:
Architecture & Design
- System and service architecture
- Database schema design
- Distributed or multi-tenant systems
- Major refactors across multiple files
Deep Analysis
- Complex debugging (race conditions, subtle bugs)
- Security reviews
- Performance optimization strategy
- Root cause analysis
Strategic & Judgment-Based Work
- Strategic planning
- Nuanced judgment and ambiguity
- Deep or multi-source research
- Critical production decisions
🔄 Implementation
For Subagents
// Routine monitoring
sessions_spawn(task="Check backup status", model="GLM-4.5-Flash")
// Standard code work
sessions_spawn(task="Build the REST API endpoint", model="GLM-4.7")
// Architecture decisions
sessions_spawn(task="Design the database schema for multi-tenancy", model="GLM-4-Plus")
For Cron Jobs
json
Copy code
{
"payload": {
"kind": "agentTurn",
"model": "GLM-4.5-Flash"
}
}
Always use Flash for cron unless the task genuinely needs reasoning.
📊 Quick Decision Tree
pgsql
Copy code
Is it a greeting, lookup, status check, or 1–2 sentence answer?
YES → FLASH
NO ↓
Is it code, analysis, planning, writing, or multi-step?
YES → STANDARD
NO ↓
Is it architecture, deep reasoning, or a critical decision?
YES → PLUS / 32B
NO → Default to STANDARD, escalate if struggling
📋 Quick Reference Card
less
Copy code
┌─────────────────────────────────────────────────────────────┐
│ SMART MODEL SWITCHING │
│ Flash → Standard → Plus / 32B │
├─────────────────────────────────────────────────────────────┤
│ 💚 FLASH (cheapest) │
│ • Greetings, status checks, quick lookups │
│ • Factual Q&A, reminders │
│ • Simple file ops, 1–2 sentence answers │
├─────────────────────────────────────────────────────────────┤
│ 💛 STANDARD (workhorse) │
│ • Code > 10 lines, debugging │
│ • Analysis, comparisons, planning │
│ • Reports, long writing │
├─────────────────────────────────────────────────────────────┤
│ ❤️ PLUS / 32B (complex) │
│ • Architecture decisions │
│ • Complex debugging, multi-file refactoring │
│ • Strategic planning, deep research │
├─────────────────────────────────────────────────────────────┤
│ 💡 RULE: >30 sec human thinking → escalate │
│ 💰 START CHEAP → SCALE ONLY WHEN NEEDED │
└─────────────────────────────────────────────────────────────┘
Built for z.ai (GLM) setups.
1---
2name: smart-model-switching-glm
3description: >-
4 Auto-route tasks to the cheapest z.ai (GLM) model that works correctly.
5 Three-tier progression: Flash → Standard → Plus/32B. Classify before responding.
6
7 FLASH (default): factual Q&A, greetings, reminders, status checks, lookups,
8 simple file ops, heartbeats, casual chat, 1–2 sentence tasks, cron jobs.
9
10 ESCALATE TO STANDARD: code >10 lines, analysis, comparisons, planning, reports,
11 multi-step reasoning, tables, long writing >3 paragraphs, summarization,
12 research synthesis, most user conversations.
13
14 ESCALATE TO PLUS/32B: architecture decisions, complex debugging, multi-file
15 refactoring, strategic planning, nuanced judgment, deep research, critical
16 production decisions.
17
18 Rule: If a human needs >30 seconds of focused thinking, escalate.
19 If Standard struggles with complexity, go to Plus/32B.
20 Save major API costs by starting cheap and escalating only when needed.
21
22author: "OpenClaw Community"
23version: 1.0.0
24homepage: https://clawhub.com
25metadata:
26 source: https://skillmd.com/skills/modbender/smart-model-switching-glm
27 openclaw:
28 emoji: "💰"
29 provider: "z.ai (GLM)"
30---
31
32# Smart Model Switching
33
34**Three-tier z.ai (GLM) routing: Flash → Standard → Plus / 32B**
35
36Start with the cheapest model. Escalate only when needed. Designed to minimize API cost without sacrificing correctness.
37
38---
39
40## The Golden Rule
41
42> If a human would need more than 30 seconds of focused thinking, escalate from Flash to Standard.
43> If the task involves architecture, complex tradeoffs, or deep reasoning, escalate to Plus / 32B.
44
45---
46
47## Model Reality (Relative)
48
49| Tier | Example Models | Purpose |
50|-----|----------------|---------|
51| Flash | GLM-4.5-Flash, GLM-4.7-Flash | Fastest & cheapest |
52| Standard | GLM-4.6, GLM-4.7 | Strong reasoning & code |
53| Plus / 32B | GLM-4-Plus, GLM-4-32B-128K | Heavy reasoning & architecture |
54
55**Bottom line:** Wrong model selection wastes money OR time. Flash for simple, Standard for normal work, Plus/32B for complex decisions.
56
57---
58
59## 💚 FLASH — Default for Simple Tasks
60
61**Stay on Flash for:**
62- Factual Q&A — “what is X”, “who is Y”, “when did Z”
63- Quick lookups — definitions, unit conversions, short translations
64- Status checks — monitoring, file reads, session state
65- Heartbeats — periodic checks, OK responses
66- Memory & reminders
67- Casual conversation — greetings, acknowledgments
68- Simple file ops — read, list, basic writes
69- One-liner tasks — anything answerable in 1–2 sentences
70- Cron jobs (always Flash by default)
71
72### NEVER do these on Flash
73- ❌ Write code longer than 10 lines
74- ❌ Create comparison tables
75- ❌ Write more than 3 paragraphs
76- ❌ Do multi-step analysis
77- ❌ Write reports or proposals
78
79---
80
81## 💛 STANDARD — Core Workhorse
82
83**Escalate to Standard for:**
84
85### Code & Technical
86- Code generation — functions, scripts, features
87- Debugging — normal bug investigation
88- Code review — PRs, refactors
89- Documentation — README, comments, guides
90
91### Analysis & Planning
92- Comparisons and evaluations
93- Planning — roadmaps, task breakdowns
94- Research synthesis
95- Multi-step reasoning
96
97### Writing & Content
98- Long-form writing (>3 paragraphs)
99- Summaries of long documents
100- Structured output — tables, outlines
101
102**Most real user conversations belong here.**
103
104---
105
106## ❤️ PLUS / 32B — Complex Reasoning Only
107
108**Escalate to Plus / 32B for:**
109
110### Architecture & Design
111- System and service architecture
112- Database schema design
113- Distributed or multi-tenant systems
114- Major refactors across multiple files
115
116### Deep Analysis
117- Complex debugging (race conditions, subtle bugs)
118- Security reviews
119- Performance optimization strategy
120- Root cause analysis
121
122### Strategic & Judgment-Based Work
123- Strategic planning
124- Nuanced judgment and ambiguity
125- Deep or multi-source research
126- Critical production decisions
127
128---
129
130## 🔄 Implementation
131
132### For Subagents
133```javascript
134// Routine monitoring
135sessions_spawn(task="Check backup status", model="GLM-4.5-Flash")
136
137// Standard code work
138sessions_spawn(task="Build the REST API endpoint", model="GLM-4.7")
139
140// Architecture decisions
141sessions_spawn(task="Design the database schema for multi-tenancy", model="GLM-4-Plus")
142For Cron Jobs
143json
144Copy code
145{
146 "payload": {
147 "kind": "agentTurn",
148 "model": "GLM-4.5-Flash"
149 }
150}
151Always use Flash for cron unless the task genuinely needs reasoning.
152
153📊 Quick Decision Tree
154pgsql
155Copy code
156Is it a greeting, lookup, status check, or 1–2 sentence answer?
157 YES → FLASH
158 NO ↓
159
160Is it code, analysis, planning, writing, or multi-step?
161 YES → STANDARD
162 NO ↓
163
164Is it architecture, deep reasoning, or a critical decision?
165 YES → PLUS / 32B
166 NO → Default to STANDARD, escalate if struggling
167📋 Quick Reference Card
168less
169Copy code
170┌─────────────────────────────────────────────────────────────┐
171│ SMART MODEL SWITCHING │
172│ Flash → Standard → Plus / 32B │
173├─────────────────────────────────────────────────────────────┤
174│ 💚 FLASH (cheapest) │
175│ • Greetings, status checks, quick lookups │
176│ • Factual Q&A, reminders │
177│ • Simple file ops, 1–2 sentence answers │
178├─────────────────────────────────────────────────────────────┤
179│ 💛 STANDARD (workhorse) │
180│ • Code > 10 lines, debugging │
181│ • Analysis, comparisons, planning │
182│ • Reports, long writing │
183├─────────────────────────────────────────────────────────────┤
184│ ❤️ PLUS / 32B (complex) │
185│ • Architecture decisions │
186│ • Complex debugging, multi-file refactoring │
187│ • Strategic planning, deep research │
188├─────────────────────────────────────────────────────────────┤
189│ 💡 RULE: >30 sec human thinking → escalate │
190│ 💰 START CHEAP → SCALE ONLY WHEN NEEDED │
191└─────────────────────────────────────────────────────────────┘
192Built for z.ai (GLM) setups.