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, identify high-cost sessions, and get actionable strategies to lower your monthly LLM API bills without sacrificing quality.

skill-install — Terminal

Install via CLI (Recommended)

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

What 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

  1. 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.
  2. 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.
  3. 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.
  4. Migration Planning: Evaluate whether shifting specific workflows from Claude Opus to Sonnet or DeepSeek would provide sufficient quality while drastically reducing costs.

Example Prompts

  1. "Analyze my token usage for the last 30 days and generate a cost optimization report."
  2. "Show me a quick summary of today's costs and identify the most expensive session currently in my memory logs."
  3. "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

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-openclaw-cost-analyzer": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#cost-management#token-optimizer#llm-audit#developer-tools#session-analysis
Safety Score: 5/5

Flags: file-read, file-write