token-optimizer
Reduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and multi-provider fallbacks. Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. Includes ready-to-use scripts for task classification, usage monitoring, and optimized heartbeat scheduling.
Why use this skill?
Slash your OpenClaw token costs by 50-80% with smart model routing, automated context loading, and usage tracking. Optimize your agents today.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/dexiaong/token-optimizeriWhat This Skill Does
The token-optimizer skill is a comprehensive toolkit designed to drastically reduce OpenClaw operational costs and token consumption. By implementing smart model routing, automated context selection, and efficient heartbeat management, this skill solves the 'context bloat' issue where agents load excessive files unnecessary for simple tasks. It uses intelligent classification to determine the minimum required context, reducing API overhead by 50-80%.
Installation
To integrate this skill into your environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/dexiaong/token-optimizer
Once installed, ensure you initialize the heartbeat template by copying assets/HEARTBEAT.template.md to your ~/.openclaw/workspace/HEARTBEAT.md file to begin tracking and optimizing your agent's active lifecycle.
Use Cases
This skill is perfect for developers managing agents at scale who are hitting API rate limits or facing high billing costs. It is specifically designed for:
- Large Scale Deployment: Managing multiple agents where minor token savings compound across thousands of calls.
- Cost Control: Capping expenditure for hobbyist or enterprise budgets by switching to lower-cost models like Haiku for casual interactions.
- Performance Optimization: Improving agent response latency by minimizing the volume of data loaded into the prompt context during initialization.
Example Prompts
- 'Run the context optimizer check to see how much I can save on my next session.'
- 'Recommend the minimum files needed to answer: How do I refactor the database module?'
- 'Check my current token budget status and switch to the most cost-effective model for this chat.'
Tips & Limitations
The biggest performance boost comes from running generate-agents to create an optimized AGENTS.md file. Always review the generated optimized files before deploying to production. Note that aggressive context reduction may occasionally lead to missing background information for highly niche, multi-step tasks; use the 'full' context mode when performing complex architectural analysis. Regular updates to your HEARTBEAT.md are required to maintain accurate usage metrics.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-dexiaong-token-optimizeri": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, file-write, code-execution
Related Skills
omnicog
Universal service integration for OpenClaw — connect Reddit, Steam, Spotify, GitHub, Discord, and more with a single API.
chaterimo
AI Customer Service for Shopify & E-commerce - Query conversations, analyze chatbot performance, and manage your Chaterimo AI assistant
lulu-monitor
AI-powered LuLu Firewall companion for macOS. Monitors firewall alerts, analyzes connections with AI, sends Telegram notifications with Allow/Block buttons. Use when setting up LuLu integration, handling firewall callbacks, or troubleshooting LuLu Monitor issues.
gmail-client-PM
Read and send emails via Gmail. Use to list unread messages, read specific emails by ID, or send new emails.
arb-injection
BYOCB ArbInjectionSkill: Scan EVM smart contracts for arbitrary call injection vulnerabilities. Monitor chains in real-time or scan specific addresses.