token-optimizer
بواسطة smartpeopleconnected
Coding Agents & IDEsموجز
Reduce OpenClaw AI costs by 97%.
الوصف
ما الذي تفعله هذه المهارة
Reduces OpenClaw AI API costs by routing most requests to Claude Haiku, offloading heartbeats to local or alternative providers, enabling prompt caching, and trimming loaded context size. All changes preview before writing, and backups are created automatically before any modification.
Combines model routing, multi-provider heartbeat offloading, prompt caching, and config rollback into a single CLI with dry-run preview, rather than requiring manual edits across multiple config files.
متى تستخدمها
- Switching routine coding tasks from Sonnet to Haiku to cut token spend
- Routing OpenClaw heartbeats to a local Ollama instance instead of paid API
- Previewing config diffs before applying changes in a CI pipeline
- Setting daily and monthly spend caps to prevent runaway API bills
- Rolling back to a previous config after an optimization produces unexpected behavior
مثال على سير العمل
User asks: reduce my OpenClaw API costs
- 1
Run
python cli.py analyzeto inspect current model routing and heartbeat configuration - 2
Run
python cli.py optimizeto generate a diff preview of proposed changes - 3
Review the diff showing Haiku as default model, caching enabled, and budget limits added
- 4
Run
python cli.py optimize --applyto write changes to ~/.openclaw/ - 5
Run
python cli.py verifyto confirm the new configuration is active
OpenClaw configured with Haiku as default model, prompt caching enabled, and daily/monthly budget limits set, with a timestamped backup of the previous config saved to ~/.openclaw/backups/
التثبيت
clawhub install smartpeopleconnected/token-optimizerشغّل أمر واجهة سطر الأوامر، أو الصق النص في Claude Code أو Cursor أو Codex أو أي وكيل برمجة تستخدمه.