# unknown - Author: vajih - Repository: vajih/openclaw-smartmeter - Version: 20260207203704 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-08 - Source: https://github.com/vajih/openclaw-smartmeter - Web: https://mule.run/skillshub/@@vajih/openclaw-smartmeter~unknown:20260207203704 ---
AI cost optimization for OpenClaw
Analyze your AI usage patterns. Generate optimized configs. Cut costs by 48%+.
--- ## What is SmartMeter? SmartMeter is a cost optimization skill for [OpenClaw](https://openclaw.ai) that analyzes your AI agent usage and generates optimized configurations to reduce API spending — without sacrificing quality. It parses your session logs, classifies tasks by type, identifies which models are overkill for routine work, and generates a tuned `openclaw.json` that routes the right tasks to the right models. ### Real-World Results Tested on live OpenClaw data (288 tasks across 9 sessions): | Metric | Value | |---|---| | Current monthly projection | $59.97 | | Optimized monthly projection | $31.14 | | **Potential savings** | **$28.82/month (48.1%)** | | Models analyzed | DeepSeek Chat, Claude Sonnet 4.5, Claude Opus 4.5 | | Confidence | Optimistic (2 days of data; improves with 14+ days) | The key insight: DeepSeek Chat handled 69% of tasks at 1/5th the cost of premium models, while Opus was only needed for 15% of complex work. ## Features - **Usage Analysis** — Parse JSONL session logs, extract model usage, token counts, costs, and cache performance across all agents - **Task Classification** — Automatically categorize tasks into code, writing, research, config, and other using keyword-based classification - **Cost Optimization** — Identify where expensive models are being used for simple tasks and recommend cheaper alternatives - **Config Generation** — Generate production-ready `openclaw.json` with primary model, fallback chains, specialized agents, budget controls, and caching settings - **Live Dashboard** — Interactive web dashboard deployed to OpenClaw Canvas with auto-refresh, charts, and actionable recommendations - **Safe Rollback** — Every config change creates a timestamped backup; one command to roll back - **CLI Interface** — 8 commands covering the full workflow from analysis to deployment ## Installation ```bash git clone https://github.com/vajih/openclaw-smartmeter.git cd openclaw-smartmeter npm install ``` To make the `smartmeter` command available globally: ```bash npm link ``` ## Quick Start ### 1. Analyze your usage ```bash # Analyze default OpenClaw data (~/.openclaw) smartmeter analyze # Or point to a specific data directory smartmeter analyze --data-dir ~/my-openclaw-data ``` Output: ``` Analysis: 2026-02-04 to 2026-02-05 (2 days) Total tasks 288 Total cost $4.00 Monthly cost (projected) $59.97 Optimized monthly cost $31.14 Potential savings $28.82/month (48.1%) Confidence optimistic ``` ### 2. Preview recommended changes ```bash smartmeter preview --data-dir ~/my-openclaw-data ``` ``` Proposed changes: - Primary model: (none) -> deepseek/deepseek-chat - Fallback chain: delivery-mirror -> anthropic/claude-sonnet-4.5 -> anthropic/claude-opus-4.5 - New agents: code-reviewer - Budget: $2.40/day, $16.80/week ``` ### 3. View the full generated config ```bash smartmeter show --data-dir ~/my-openclaw-data ``` ### 4. Apply the optimized config ```bash smartmeter apply --data-dir ~/my-openclaw-data ``` This creates a backup of your current config before writing the new one. ### 5. Launch the dashboard ```bash smartmeter dashboard ``` Opens an interactive web dashboard in your browser with: - Cost savings overview with confidence indicators - Model usage breakdown (bar chart) - Task classification distribution (doughnut chart) - Actionable recommendations with impact estimates - Auto-refresh every 5 seconds ### 6. Roll back if needed ```bash smartmeter rollback ``` ## CLI Reference | Command | Description | |---|---| | `smartmeter analyze` | Run full analysis pipeline and save results | | `smartmeter show` | Display the generated optimized config as JSON | | `smartmeter preview` | Show what would change without applying | | `smartmeter apply` | Apply optimized config (creates backup first) | | `smartmeter rollback` | Restore the most recent backup config | | `smartmeter status` | Show current optimization status from stored analysis | | `smartmeter report` | Detailed breakdown: models, categories, temporal, caching | | `smartmeter dashboard` | Deploy and open the web dashboard | **Global options** for commands that run analysis: - `-d, --data-dir