ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 5/5

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.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/dagangtj/oc-cost-analyzer
Or

What 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.md or SOUL.md configurations.
  • 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

  1. "Analyze my token usage over the last 30 days and tell me which agent is the most expensive to run."
  2. "Show me today's cost breakdown and suggest which of my current active tasks I should downgrade to a cheaper model."
  3. "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-optimizer skill to achieve the best balance between performance and price. Use the provided command node scripts/cost_analyzer.js analyze for 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

Author@dagangtj
Stars3409
Views0
Updated2026-03-25
View Author Profile
AI Skill Finder

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 skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-dagangtj-oc-cost-analyzer": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#cost-optimization#token-management#efficiency#analysis#dev-tools
Safety Score: 5/5

Flags: file-read