Everything currently in flight
Intelligent model routing — select models by capability, quota, cost, and task profile across all agents, prioritising free-tier providers to reduce DeepSeek spend.
Notes
Merged from: free-tier-models + model-strategy-engine (2026-05-11)
Previous locations:
projects/free-tier-models/PROJECT.md — active, provider-focusedprojects/free-tier-models/ARCHITECTURE.md — architecture doc (now merged into projects/model-strategy-engine/ARCHITECTURE.md)projects/model-strategy-engine/PROJECT.md — planning, strategy-focused"Instead of configuring fallback per agent, define a global strategy where we classify what to use based on the models' capabilities. Agents can switch when relevant, depending on quota left, complexity, and importance. Keep some models reserved for manual selection. End of day: use remaining quota for extra thinking, strategic or cleaning tasks. Monitor, configure, and track optimizations."
Key operational goal: Leverage free tiers from Google Gemini, Groq, and GitHub Models to save on paid DeepSeek calls while expanding agent capabilities (vision, speed, alternative quality). All routing is configurable — Maxime decides what to activate and in what order.
lib/strategy-engine.ts, lib/switch-engine.ts, etc.) are built but not wired into the dispatch pipeline| Provider | Free Tier Limit | Best For | Registration Status |
|---|---|---|---|
| Google Gemini 2.0/2.5 Flash | 1,500 req/day, 30 RPM | Vision/screenshots, general text, fallback from DeepSeek | ✅ Registered (11 models) |
| Groq (Llama 3, Mixtral, Gemma) | 30 req/min, ~9k tok/min, 500 tok/s | Lightweight cron ops, speedy responses, Debbie/Oscar tasks | ❌ Not configured |
| GitHub Models (GPT-4o-mini, GPT-4o, Phi-4, DeepSeek-R1, Grok-3) | Per-model rate limits (8–150 req/day) | Code review (Vera), QC (Kelly), lightweight ops, prototyping | ❌ Not configured (needs models:read PAT) |
| DeepSeek Chat | Unlimited (paid) | Default fallback | ✅ Active |
| DeepSeek Pro | Unlimited (paid) | Hard problems | ✅ Active |
| Qwen 7B local | Unlimited (free) | Privacy-sensitive, batch | ✅ Active |
GitHub Models note: Uses GitHub PAT with
models:readscope. Free tier is genuinely free (no credit card) but rate-limited per model. The playground AND API share the same limits — once hit, must wait for daily reset.Source: GitHub Docs — Rate limits
| Tier | Req/min | Req/day | Example Models |
|---|---|---|---|
| Low | 15 | 150 | GPT-4o mini, GPT-4.1-mini/nano, Phi-4, Phi-4-mini/multimodal, Llama-3.2-11B-Vision, Mistral Small, Codestral, Cohere Command-A/R |
| High | 10 | 50 | GPT-4o, GPT-4.1, Llama-3.3-70B, Llama-4-Maverick/Scout, Llama-3.1-405B, Llama-3.2-90B-Vision, DeepSeek-V3-0324, Cohere Command R+, Jamba 1.5 Large |
| Embedding | 15 | 150 | text-embedding-3-small/large |
| DeepSeek-R1 | 1 | 8 | DeepSeek-R1, DeepSeek-R1-0528, MAI-DS-R1 |
| xAI Grok | 1 | 15 | Grok-3, Grok-3-Mini |
See ARCHITECTURE.md for full architecture, provider tiers, built components, data flow, and gap analysis.
Quick summary: Task dispatched → Strategy Engine (classifier + selector + switch engine) → Fallback chain (Gemini → Groq → GitHub → DeepSeek → Qwen) → Agent runs → Model Tracker logs usage → End-of-day drain at 23:00 SGT.
Without data, we can't optimise.
.strategy-routing/YYYY-MM-DD.jsonlGET /api/models/routing-history)Make the strategy engine control routing.
/api/tasks/[id]/run calls selectModel()Central UI for strategy management.
/models/strategy page with:
.model-optimization/YYYY-MM-DD.jsonl logging| ID | Task | Depends On | Assignee | Priority | Phase |
|---|---|---|---|---|---|
| t-3307 | Design review: Model Strategy Engine | — | main | done ✅ | — |
| t-3328 | MSE Phase 1: Routing history log + monitoring | Providers registered | chris | P0 | 1 |
| t-3329 | MSE Phase 2: Agent dispatch integration | t-3328 | chris | P0 | 2 |
| t-3330 | MSE Phase 3: Strategy dashboard page | t-3329 | chris | P0 | 3 |
| t-3339 | Add GitHub Models provider | PAT with models:read scope | chris | P1 | Setup |
| t-3340 | Add xAI Grok provider | XAI_API_KEY from console.x.ai | chris | P1 | Setup |
| t-3341 | Add Mistral AI provider | MISTRAL_API_KEY from console.mistral.ai | chris | P2 | Setup |
| t-3342 | Add Groq provider | GROQ_API_KEY from console.groq.com | chris | P2 | Setup |
| t-3343 | Wire up fallback routing for all agents | t-3328, t-3339–3342 | chris | P0 | Setup |
ℹ️ The original
free-tier-modelsproject had placeholder task IDs (t-332 to t-339). These were never created as real task files. The actual tasks above (t-3307, t-3328–3330, t-3339–3343) are the real implementation tasks.
~/.openclaw/strategy-config.json)#{
"global": {
"enabled": true,
"defaultStrategy": "reserve-balanced",
"taskClassification": "auto",
"quotaCheckInterval": "realtime",
"drainEnabled": true,
"drainTime": "23:00",
"drainTaskQueue": ["reflections", "stale_review", "doc_audit", "reindex"],
"fallbackOnReserved": false,
"logRouting": true,
"logOptimization": true
},
"complexityMapping": {
"trivial": "none",
"simple": "basic",
"moderate": "moderate",
"complex": "deep",
"critical": "frontier"
},
"importanceSpeedPreference": {
"low": ["realtime", "fast", "moderate", "slow"],
"normal": ["fast", "moderate", "realtime", "slow"],
"high": ["moderate", "fast", "slow", "realtime"],
"critical": ["moderate", "slow", "fast", "realtime"]
},
"costBudget": {
"dailyCap": 5.00,
"monthlyCap": 100.00,
"priorityBudget": 1.00,
"reserveBudget": 0.50
},
"reserveModels": {
"deepseek-v4-pro": "manual_only",
"claude-sonnet-4-6": "manual_only",
"claude-opus-4-7": "last_resort"
}
}
~/.openclaw/switch-config.json)#{
"chris": {
"strategy": "reserve-balanced",
"fallbacks": ["gemini-2.5-flash", "groq-llama", "qwen"],
"tier": "code",
"drainEnabled": false
},
"debbie": {
"strategy": "fallback",
"fallbacks": ["groq-llama", "qwen"],
"tier": "analysis",
"drainEnabled": true
},
"oscar": {
"strategy": "fallback",
"fallbacks": ["qwen"],
"tier": "simple",
"drainEnabled": true
}
}
╔══════════════════════════════════════════════════════════════════╗
║ ⚙️ STRATEGY ENGINE ● Active ● 9.4k routed today ║
║ 💰 $1.42 spent today (cap $5.00) 📊 71% free-tier utilized ║
║ 🔄 Dispatching in 2/6 agents 🗑️ Drain pending at 23:00 ║
╚══════════════════════════════════════════════════════════════════╝
┌─────────┬──────────────┬──────────────┬────────────────┬────────────┐
│ Agent │ Primary │ Current │ Reason │ Savings │
├─────────┼──────────────┼──────────────┼────────────────┼────────────┤
│ Chris │ deepseek-chat│ gemini-2.5-flash │ free quota avail │ $0.42 │
│ Debbie │ deepseek-chat│ qwen (local) │ local → free │ $0.00 │
│ Kelly │ deepseek-reasoner │ deepseek-reasoner │ primary (manual) │ $0.00 │
│ Oscar │ qwen (local) │ qwen (local) │ local only │ $0.00 │
│ Vera │ deepseek-chat│ deepseek-chat│ primary avail │ $0.00 │
│ Robbie │ deepseek-reasoner │ deepseek-reasoner │ high-importance │ $0.00 │
└─────────┴──────────────┴──────────────┴────────────────┴────────────┘
┌────────────────────┬───────┬──────┬───────────┬────────┐
│ Model │ Quota │ Used │ Remaining │ % │
├────────────────────┼───────┼──────┼───────────┼────────┤
│ gemini-2.5-flash │ 10000 │ 2841 │ 7159 │ 28% ██│
│ gemini-2.0-flash │ 1500 │ 520 │ 980 │ 35% ██│
│ gemma-4-31b-it │ ∞ │ 12 │ ∞ │ — │
│ qwen (local) │ ∞ │ 47 │ ∞ │ — │
│ deepseek-chat │ $budget│ $0.84│ $3.16 │ 21% █│
│ deepseek-reasoner │ $budget│ $0.42│ $3.74 │ 10% ░│
└────────────────────┴──────────────┴───────────┴────────┘
[09:42] t-3327 → deepseek-chat (complexity: moderate, importance: normal)
[10:15] t-3328 → gemini-2.5-flash (free tier, saved $0.14)
[11:03] t-3329 → qwen-coder (local, code task)
[12:30] t-3330 → deepseek-reasoner (manual override, high importance)
📊 Today: 4 routed | $0.42 estimated savings | 2 models avoided
🗑️ End-of-Day Drain @ 23:00 SGT
- Models with remaining quota: gemini-2.5-flash (7,159), gemini-2.0-flash (980)
- Drainable tasks: 3 (reflections, stale review, doc audit)
- Estimated drain: ~100 requests
- ⏱️ Manual drain available: [Drain Now] [Dry Run]
ARCHITECTURE.md — full architecture, provider tiers, built components, data flow, integration pointsapp/api/models/route.ts — model registry API (MODEL_META entries with dailyFreeQuota)app/api/models/strategy/route.ts — strategy APIcomponents/ModelsClient.tsx — model listing UI with free tier togglecomponents/FinanceClient.tsx — cost/finance UIlib/strategy-engine.ts — core selection algorithmlib/switch-engine.ts — quota-aware fallback routinglib/switch-config.ts — per-agent switch configlib/drain-scheduler.ts — end-of-day drainlib/model-tracker.ts — usage logginglib/model-recommender.ts — usage-based recommendations~/.openclaw/workspace/docs/global-model-strategy.md — workspace-level model strategyapp/api/models/route.ts#freeTierModels — GitHub Models MODEL_META entries with freeTier and dailyFreeQuota9/9
tasks done
Tasks (9)
View in board →Timeline