openclaw-cost-optimizer
分析 OpenClaw 的 token 使用和成本,识别高消耗场景(长对话、频繁 cron、大 context),给出具体优化建议(模型降级、context 压缩、cron 频率调整)。纯 Node.js,无外部依赖。输出清晰的成本报告。
Why use this skill?
Analyze your OpenClaw token usage, identify high-cost sessions, and get actionable strategies to lower your monthly LLM API bills without sacrificing quality.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/dagangtj/openclaw-cost-analyzerWhat This Skill Does
The openclaw-cost-optimizer is a specialized audit and optimization agent for OpenClaw. It monitors your LLM consumption patterns by scanning session logs, categorizing token usage by model, session, and time. It proactively identifies 'expensive' behaviors such as bloated context windows exceeding 50k tokens, inefficiently frequent cron job execution, and the overuse of high-cost models (like Claude Opus) for trivial tasks. The tool provides a structured markdown report with actionable insights, model migration paths, and estimated cost savings, helping you keep your AI operations within budget.
Installation
To install this skill, use the following command in your terminal:
clawhub install openclaw/skills/skills/dagangtj/openclaw-cost-analyzer
Once installed, you can trigger the analysis directly via node:
node scripts/cost_analyzer.js analyze [days]
Use Cases
- Monthly Budget Auditing: At the end of each month, generate a report to see exactly which agents or specific conversation threads contributed most to your LLM API bills.
- Proactive Context Management: Use the tool to detect if your SOUL.md or AGENTS.md files have grown too large, causing the agent to ingest excessive tokens in every turn.
- Cron Job Efficiency: Identify scheduled tasks that are running too frequently and consuming expensive compute cycles, allowing you to downsample them or switch them to smaller, locally hosted models.
- Migration Planning: Evaluate whether shifting specific workflows from Claude Opus to Sonnet or DeepSeek would provide sufficient quality while drastically reducing costs.
Example Prompts
- "Analyze my token usage for the last 30 days and generate a cost optimization report."
- "Show me a quick summary of today's costs and identify the most expensive session currently in my memory logs."
- "Based on my current usage, which specific cron jobs should I switch to a local model to save money?"
Tips & Limitations
- Proactive Cleaning: Regularly purge old session logs using the suggested find commands to keep your filesystem clean and analysis faster.
- Model Fallbacks: Always define fallback models in your OpenClaw settings to ensure continuity even when the primary model is throttled or excessively expensive.
- Lazy Loading: If your AGENTS.md is huge, consider splitting it into modular files and using the tool's recommendations to implement lazy loading patterns.
- Limitations: This tool performs offline analysis on local logs. It cannot track costs occurring on remote API accounts directly; it calculates estimates based on log data and known pricing tiers.
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-dagangtj-openclaw-cost-analyzer": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, file-write
Related Skills
Binance Trading Assistant
Skill by dagangtj
Crypto Price Alerts
Skill by dagangtj
Multi Bounty Scanner
Skill by dagangtj
Multi Channel Income Tracker
Skill by dagangtj
profit-engine
7x24 automated profit opportunity scanner for AI agents. Scans ClawTasks, Moltbook, Polymarket, Airdrops, GitHub Bounties, and toku.agency for earning opportunities. Use when you need to find and monitor money-making opportunities across multiple platforms automatically.