openclaw-cost-optimizer
分析 OpenClaw 的 token 使用和成本,识别高消耗场景(长对话、频繁 cron、大 context),给出具体优化建议(模型降级、context 压缩、cron 频率调整)。纯 Node.js,无外部依赖。输出清晰的成本报告。
Why use this skill?
Analyze your OpenClaw token usage and costs with this native tool. Get actionable advice on model downgrades, context optimization, and cron frequency to save money.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/dagangtj/oc-cost-analyzerWhat This Skill Does
The openclaw-cost-optimizer is a specialized audit and utility tool designed for OpenClaw users to gain complete visibility into their AI infrastructure spending. As AI agents handle more complex tasks, token consumption can spike unexpectedly due to long-running conversations, expansive context files, or inefficient model choices. This skill parses your local session logs and memory files to generate a granular breakdown of your costs. It categorizes spending by model, session, and timeframe, identifying specific 'hotspots' that contribute to high bills. Beyond mere reporting, the tool provides actionable insights, such as recommending model downgrades to cheaper yet capable alternatives like DeepSeek or Sonnet, flagging bloated context files that exceed 50k tokens, and suggesting modifications to cron job frequencies to minimize recurring overhead.
Installation
To integrate this utility into your OpenClaw environment, use the primary package manager command from your CLI:
clawhub install openclaw/skills/skills/dagangtj/oc-cost-analyzer
This installation is lightweight, requiring no external dependencies, as it runs as a pure Node.js script. Once installed, ensure you have read permissions to your ~/.openclaw/workspace/memory directory, as the analyzer needs to index your session history to calculate usage statistics.
Use Cases
- Monthly Budget Audits: Generate a comprehensive report at the end of each month to track ROI on agentic workflows.
- Performance Tuning: Identify specific sessions where context usage is excessively high, enabling you to optimize your
AGENTS.mdorSOUL.mdconfigurations. - Model Selection Validation: Determine if you are overpaying for simple tasks by using high-end models like Claude-Opus-4-6 when a more economical model would suffice.
- System Housekeeping: Identify and purge stale memory logs while adjusting cron jobs to ensure system efficiency.
Example Prompts
- "Analyze my token usage over the last 30 days and tell me which agent is the most expensive to run."
- "Show me today's cost breakdown and suggest which of my current active tasks I should downgrade to a cheaper model."
- "Identify any long-running cron jobs that are consuming too many tokens and suggest a lower frequency for them."
Tips & Limitations
- Tips: Run the analyzer weekly to stay ahead of cost creep. Combine the recommendations with the
openclaw-token-optimizerskill to achieve the best balance between performance and price. Use the provided commandnode scripts/cost_analyzer.js analyzefor a full deep-dive report that can be saved for your internal records. - Limitations: The tool relies on existing local logs; if logs are manually deleted or rotated frequently by system policies, historical data for those periods will be unavailable. It does not control actual API billing; it estimates costs based on standard pricing patterns and provided usage data.
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-oc-cost-analyzer": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read
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.