openclaw-smartmeter 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +201 -0
- package/DEPLOYMENT_HANDOFF.md +923 -0
- package/HANDOFF_BRIEF.md +619 -0
- package/README.md +64 -0
- package/SKILL.md +654 -0
- package/canvas-template/app.js +273 -11
- package/canvas-template/index.html +49 -0
- package/canvas-template/styles.css +764 -90
- package/package.json +19 -3
- package/src/analyzer/config-manager.js +92 -0
- package/src/analyzer/openrouter-client.js +112 -0
- package/src/canvas/api-server.js +104 -5
- package/src/canvas/deployer.js +1 -1
- package/src/cli/commands.js +3 -2
- package/src/generator/config-builder.js +7 -2
- package/src/generator/validator.js +7 -7
package/SKILL.md
CHANGED
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: smartmeter
|
|
3
|
+
description: Analyze OpenClaw usage and generate optimized configs to reduce AI costs by 48%+
|
|
4
|
+
version: 0.3.0
|
|
5
|
+
metadata:
|
|
6
|
+
openclaw:
|
|
7
|
+
emoji: "💰"
|
|
8
|
+
category: "productivity"
|
|
9
|
+
requires:
|
|
10
|
+
bins: ["node"]
|
|
11
|
+
node: ">=18.0.0"
|
|
12
|
+
user-invocable: true
|
|
13
|
+
capabilities:
|
|
14
|
+
- cost-analysis
|
|
15
|
+
- config-optimization
|
|
16
|
+
- usage-monitoring
|
|
17
|
+
keywords:
|
|
18
|
+
- cost-optimization
|
|
19
|
+
- ai-costs
|
|
20
|
+
- token-monitoring
|
|
21
|
+
- budget-management
|
|
22
|
+
- config-generation
|
|
23
|
+
author: vajihkhan
|
|
24
|
+
license: Apache-2.0
|
|
25
|
+
repository: https://github.com/vajih/openclaw-smartmeter
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# 💰 SmartMeter
|
|
29
|
+
|
|
30
|
+
**AI cost optimization for OpenClaw** — Analyze usage patterns, generate optimized configs, and cut costs by 48%+ without sacrificing quality.
|
|
31
|
+
|
|
32
|
+
## What It Does
|
|
33
|
+
|
|
34
|
+
SmartMeter helps you save money on AI API costs by:
|
|
35
|
+
|
|
36
|
+
1. **Analyzing** your OpenClaw usage patterns from session logs
|
|
37
|
+
2. **Identifying** tasks that use expensive models unnecessarily
|
|
38
|
+
3. **Classifying** workloads (code, writing, research, config, etc.)
|
|
39
|
+
4. **Generating** optimized `openclaw.json` configurations
|
|
40
|
+
5. **Recommending** specialized agents for different task types
|
|
41
|
+
6. **Monitoring** budget usage with alerts
|
|
42
|
+
|
|
43
|
+
### Real-World Results
|
|
44
|
+
|
|
45
|
+
Tested on live OpenClaw data:
|
|
46
|
+
|
|
47
|
+
- **Current cost:** $59.97/month
|
|
48
|
+
- **Optimized cost:** $31.14/month
|
|
49
|
+
- **Savings:** $28.82/month (48.1%)
|
|
50
|
+
|
|
51
|
+
The key insight: 69% of tasks worked perfectly with cheaper models, while premium models were only needed for 15% of complex work.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
### Via ClawHub (Recommended)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx clawhub@latest install smartmeter
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Via npm
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install -g openclaw-smartmeter
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Manual Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/vajih/openclaw-smartmeter.git
|
|
73
|
+
cd openclaw-smartmeter
|
|
74
|
+
npm install
|
|
75
|
+
npm link
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
### One Command - Dashboard Included! 🚀
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
smartmeter analyze
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This will:
|
|
89
|
+
|
|
90
|
+
- ✅ Analyze your OpenClaw usage logs
|
|
91
|
+
- ✅ Calculate potential savings
|
|
92
|
+
- ✅ Generate recommendations
|
|
93
|
+
- ✅ Launch interactive dashboard automatically
|
|
94
|
+
- ✅ Show real-time cost breakdown
|
|
95
|
+
|
|
96
|
+
The dashboard opens at [http://localhost:8080](http://localhost:8080) with:
|
|
97
|
+
|
|
98
|
+
- Cost savings visualization
|
|
99
|
+
- Model usage breakdown
|
|
100
|
+
- One-click optimization
|
|
101
|
+
- Export reports
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
### Basic Workflow
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 1. Analyze usage (opens dashboard)
|
|
111
|
+
smartmeter analyze [session-file.jsonl]
|
|
112
|
+
|
|
113
|
+
# 2. Preview optimizations (without applying)
|
|
114
|
+
smartmeter preview
|
|
115
|
+
|
|
116
|
+
# 3. Apply optimizations to openclaw.json
|
|
117
|
+
smartmeter apply
|
|
118
|
+
|
|
119
|
+
# 4. Rollback if needed
|
|
120
|
+
smartmeter rollback
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Advanced Commands
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Quick cost evaluation
|
|
127
|
+
smartmeter evaluate examples/sample-session.jsonl
|
|
128
|
+
|
|
129
|
+
# Open dashboard (if already analyzed)
|
|
130
|
+
smartmeter dashboard
|
|
131
|
+
|
|
132
|
+
# Export analysis as JSON
|
|
133
|
+
smartmeter export --format json --output analysis.json
|
|
134
|
+
|
|
135
|
+
# Show current version
|
|
136
|
+
smartmeter --version
|
|
137
|
+
|
|
138
|
+
# Get help
|
|
139
|
+
smartmeter --help
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Features
|
|
145
|
+
|
|
146
|
+
### 📊 Usage Analysis
|
|
147
|
+
|
|
148
|
+
- Parse JSONL session logs from `~/.openclaw/agents/*/sessions/`
|
|
149
|
+
- Extract model usage, token counts, costs, and cache performance
|
|
150
|
+
- Track usage across all agents and time periods
|
|
151
|
+
- Minimum 2 days recommended, 14+ days for best results
|
|
152
|
+
|
|
153
|
+
### 🎯 Task Classification
|
|
154
|
+
|
|
155
|
+
- Automatically categorize tasks: code, writing, research, config, other
|
|
156
|
+
- Keyword-based classification using prompts and tool usage
|
|
157
|
+
- Identify patterns in AI agent behavior
|
|
158
|
+
- Success rate tracking by model and category
|
|
159
|
+
|
|
160
|
+
### 💡 Cost Optimization
|
|
161
|
+
|
|
162
|
+
- Identify expensive models used for simple tasks
|
|
163
|
+
- Recommend cheaper alternatives with same quality
|
|
164
|
+
- Calculate potential savings with confidence levels
|
|
165
|
+
- Generate specialized agents for different workloads
|
|
166
|
+
|
|
167
|
+
### ⚙️ Config Generation
|
|
168
|
+
|
|
169
|
+
- Production-ready `openclaw.json` generation
|
|
170
|
+
- Primary model optimization based on analysis
|
|
171
|
+
- Specialized agent creation (code-reviewer, researcher, quick-tasks)
|
|
172
|
+
- Budget controls and spending alerts
|
|
173
|
+
- Cache optimization settings
|
|
174
|
+
- Fallback chains for reliability
|
|
175
|
+
|
|
176
|
+
### 🎨 Interactive Dashboard
|
|
177
|
+
|
|
178
|
+
- Real-time cost breakdown and projections
|
|
179
|
+
- Visual charts for model usage and savings
|
|
180
|
+
- One-click optimization application
|
|
181
|
+
- Export analysis reports
|
|
182
|
+
- OpenRouter API integration
|
|
183
|
+
- Responsive design (mobile, tablet, desktop)
|
|
184
|
+
|
|
185
|
+
### 🔐 Safe Deployment
|
|
186
|
+
|
|
187
|
+
- Automatic config backups before changes
|
|
188
|
+
- Timestamped backup files
|
|
189
|
+
- One-command rollback: `smartmeter rollback`
|
|
190
|
+
- Config validation before applying
|
|
191
|
+
- Merge with existing configs (preserves custom settings)
|
|
192
|
+
|
|
193
|
+
### 🔌 OpenRouter Integration
|
|
194
|
+
|
|
195
|
+
- Connect your OpenRouter API key
|
|
196
|
+
- View actual usage vs. projected
|
|
197
|
+
- Real-time budget monitoring
|
|
198
|
+
- Cost alerts via Telegram (optional)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Configuration
|
|
203
|
+
|
|
204
|
+
### OpenRouter API Key (Optional)
|
|
205
|
+
|
|
206
|
+
For live usage monitoring and alerts:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Via environment variable
|
|
210
|
+
export OPENROUTER_API_KEY="or-v1-xxxxxxxxxxxx"
|
|
211
|
+
|
|
212
|
+
# Or store in OpenClaw config
|
|
213
|
+
smartmeter config --key or-v1-xxxxxxxxxxxx
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Dashboard Configuration
|
|
217
|
+
|
|
218
|
+
The dashboard server runs on:
|
|
219
|
+
|
|
220
|
+
- **Dashboard:** http://localhost:8080
|
|
221
|
+
- **API Server:** http://localhost:3001
|
|
222
|
+
|
|
223
|
+
To change ports, edit `~/.openclaw/smartmeter/config.json`
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## How It Works
|
|
228
|
+
|
|
229
|
+
### 1. Data Collection
|
|
230
|
+
|
|
231
|
+
SmartMeter reads your OpenClaw session logs:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
~/.openclaw/agents/*/sessions/*.jsonl
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Each log entry contains:
|
|
238
|
+
|
|
239
|
+
- Model used
|
|
240
|
+
- Tokens (input, output, cache)
|
|
241
|
+
- Cost breakdown
|
|
242
|
+
- User prompts
|
|
243
|
+
- Tool invocations
|
|
244
|
+
- Timestamps
|
|
245
|
+
|
|
246
|
+
### 2. Analysis Engine
|
|
247
|
+
|
|
248
|
+
- **Parser:** Extracts usage data from JSONL logs
|
|
249
|
+
- **Classifier:** Categorizes tasks by type (code, writing, research, etc.)
|
|
250
|
+
- **Aggregator:** Calculates costs, averages, and patterns
|
|
251
|
+
- **Recommender:** Generates optimization suggestions
|
|
252
|
+
|
|
253
|
+
### 3. Optimization Logic
|
|
254
|
+
|
|
255
|
+
For each task category:
|
|
256
|
+
|
|
257
|
+
- Analyze current model usage
|
|
258
|
+
- Calculate success rates
|
|
259
|
+
- Compare costs vs. quality
|
|
260
|
+
- Recommend optimal model
|
|
261
|
+
- Estimate savings
|
|
262
|
+
|
|
263
|
+
Example:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Category: code
|
|
267
|
+
Current: Claude Opus 4.5 ($0.80/task)
|
|
268
|
+
Success rate: 94%
|
|
269
|
+
|
|
270
|
+
Optimal: Claude Sonnet 4.5 ($0.38/task)
|
|
271
|
+
Success rate: 94% (same quality)
|
|
272
|
+
|
|
273
|
+
Savings: $0.42/task × 200 tasks = $84/month (52.5%)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### 4. Config Generation
|
|
277
|
+
|
|
278
|
+
Creates optimized `openclaw.json`:
|
|
279
|
+
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"agents": {
|
|
283
|
+
"defaults": {
|
|
284
|
+
"model": {
|
|
285
|
+
"primary": "openrouter/auto",
|
|
286
|
+
"fallback": ["claude-sonnet-4-5", "claude-opus-4-5"]
|
|
287
|
+
},
|
|
288
|
+
"budget": {
|
|
289
|
+
"daily": 5.0,
|
|
290
|
+
"weekly": 30.0,
|
|
291
|
+
"alert": {
|
|
292
|
+
"telegram": true,
|
|
293
|
+
"threshold": 0.75
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"code-reviewer": {
|
|
298
|
+
"model": "claude-sonnet-4-5",
|
|
299
|
+
"description": "Handles code review, debugging, and programming tasks",
|
|
300
|
+
"budget": { "daily": 2.0 }
|
|
301
|
+
},
|
|
302
|
+
"quick-tasks": {
|
|
303
|
+
"model": "deepseek/chat",
|
|
304
|
+
"description": "Simple queries, quick answers, config changes",
|
|
305
|
+
"budget": { "daily": 0.5 }
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Dashboard Guide
|
|
314
|
+
|
|
315
|
+
### Cost Overview
|
|
316
|
+
|
|
317
|
+
- Current monthly projection
|
|
318
|
+
- Optimized projection
|
|
319
|
+
- Potential savings ($ and %)
|
|
320
|
+
- Confidence level
|
|
321
|
+
|
|
322
|
+
### Model Breakdown
|
|
323
|
+
|
|
324
|
+
- Usage by model
|
|
325
|
+
- Token counts
|
|
326
|
+
- Cost per model
|
|
327
|
+
- Success rates
|
|
328
|
+
|
|
329
|
+
### Recommendations
|
|
330
|
+
|
|
331
|
+
- Actionable optimization suggestions
|
|
332
|
+
- Expected savings per recommendation
|
|
333
|
+
- One-click implementation
|
|
334
|
+
- Risk level indicators
|
|
335
|
+
|
|
336
|
+
### Charts & Visualizations
|
|
337
|
+
|
|
338
|
+
- Cost trends over time
|
|
339
|
+
- Model usage distribution
|
|
340
|
+
- Task category breakdown
|
|
341
|
+
- Cache hit rate analysis
|
|
342
|
+
|
|
343
|
+
### Actions
|
|
344
|
+
|
|
345
|
+
- **Preview:** See changes before applying
|
|
346
|
+
- **Apply:** Implement optimizations (creates backup)
|
|
347
|
+
- **Export:** Download analysis as JSON/CSV
|
|
348
|
+
- **Refresh:** Update with latest session data
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Best Practices
|
|
353
|
+
|
|
354
|
+
### Data Requirements
|
|
355
|
+
|
|
356
|
+
- **Minimum:** 2 days of usage data
|
|
357
|
+
- **Recommended:** 14+ days for accurate patterns
|
|
358
|
+
- **Optimal:** 30+ days for seasonal variations
|
|
359
|
+
|
|
360
|
+
### Analysis Timing
|
|
361
|
+
|
|
362
|
+
Run analysis:
|
|
363
|
+
|
|
364
|
+
- After major project milestones
|
|
365
|
+
- Monthly for budget reviews
|
|
366
|
+
- When costs seem high
|
|
367
|
+
- Before scaling usage
|
|
368
|
+
|
|
369
|
+
### Safety Tips
|
|
370
|
+
|
|
371
|
+
- Always preview before applying
|
|
372
|
+
- Keep backups (automatic)
|
|
373
|
+
- Start with conservative settings
|
|
374
|
+
- Monitor for 1-2 days after changes
|
|
375
|
+
- Roll back if quality degrades
|
|
376
|
+
|
|
377
|
+
### Optimization Strategy
|
|
378
|
+
|
|
379
|
+
1. **Phase 1:** Replace expensive models for simple tasks
|
|
380
|
+
2. **Phase 2:** Create specialized agents
|
|
381
|
+
3. **Phase 3:** Optimize caching and budgets
|
|
382
|
+
4. **Phase 4:** Fine-tune based on results
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Troubleshooting
|
|
387
|
+
|
|
388
|
+
### Dashboard Not Loading
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
# Check if servers are running
|
|
392
|
+
ps aux | grep node
|
|
393
|
+
|
|
394
|
+
# Restart servers
|
|
395
|
+
killall node
|
|
396
|
+
smartmeter analyze
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### No Session Data Found
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
# Check if session logs exist
|
|
403
|
+
ls -la ~/.openclaw/agents/*/sessions/
|
|
404
|
+
|
|
405
|
+
# Use sample data for testing
|
|
406
|
+
smartmeter analyze examples/sample-session.jsonl
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### OpenRouter API Errors
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Verify API key
|
|
413
|
+
echo $OPENROUTER_API_KEY
|
|
414
|
+
|
|
415
|
+
# Test connection
|
|
416
|
+
curl -H "Authorization: Bearer $OPENROUTER_API_KEY" \
|
|
417
|
+
https://openrouter.ai/api/v1/auth/key
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Apply Failed
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# Check config backup
|
|
424
|
+
ls -la ~/.openclaw/openclaw.json.backup-*
|
|
425
|
+
|
|
426
|
+
# Rollback to previous
|
|
427
|
+
smartmeter rollback
|
|
428
|
+
|
|
429
|
+
# Validate config manually
|
|
430
|
+
cat ~/.openclaw/openclaw.json | jq '.'
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Command Reference
|
|
436
|
+
|
|
437
|
+
### `smartmeter analyze [file]`
|
|
438
|
+
|
|
439
|
+
Analyze OpenClaw usage and launch dashboard.
|
|
440
|
+
|
|
441
|
+
**Options:**
|
|
442
|
+
|
|
443
|
+
- `[file]` - Optional path to specific session file
|
|
444
|
+
- Without file: analyzes all sessions in `~/.openclaw/agents/`
|
|
445
|
+
|
|
446
|
+
**Output:**
|
|
447
|
+
|
|
448
|
+
- Analysis saved to `~/.openclaw/smartmeter/analysis.json`
|
|
449
|
+
- Dashboard opens at http://localhost:8080
|
|
450
|
+
- API server starts on port 3001
|
|
451
|
+
|
|
452
|
+
### `smartmeter preview`
|
|
453
|
+
|
|
454
|
+
Preview optimizations without applying.
|
|
455
|
+
|
|
456
|
+
**Shows:**
|
|
457
|
+
|
|
458
|
+
- Proposed config changes
|
|
459
|
+
- Expected savings
|
|
460
|
+
- Risk assessment
|
|
461
|
+
- Confidence levels
|
|
462
|
+
|
|
463
|
+
### `smartmeter apply`
|
|
464
|
+
|
|
465
|
+
Apply optimizations to `openclaw.json`.
|
|
466
|
+
|
|
467
|
+
**Safety:**
|
|
468
|
+
|
|
469
|
+
- Creates backup: `openclaw.json.backup-{timestamp}`
|
|
470
|
+
- Validates config before applying
|
|
471
|
+
- Merges with existing settings
|
|
472
|
+
- Preserves custom configurations
|
|
473
|
+
|
|
474
|
+
### `smartmeter rollback`
|
|
475
|
+
|
|
476
|
+
Restore previous configuration.
|
|
477
|
+
|
|
478
|
+
**Process:**
|
|
479
|
+
|
|
480
|
+
- Lists available backups
|
|
481
|
+
- Restores most recent by default
|
|
482
|
+
- Verifies restoration success
|
|
483
|
+
|
|
484
|
+
### `smartmeter dashboard`
|
|
485
|
+
|
|
486
|
+
Open dashboard without re-analyzing.
|
|
487
|
+
|
|
488
|
+
**Requirements:**
|
|
489
|
+
|
|
490
|
+
- Previous analysis must exist
|
|
491
|
+
- Servers start automatically
|
|
492
|
+
|
|
493
|
+
### `smartmeter evaluate <file>`
|
|
494
|
+
|
|
495
|
+
Quick cost evaluation of session file.
|
|
496
|
+
|
|
497
|
+
**Use Case:**
|
|
498
|
+
|
|
499
|
+
- One-off analysis
|
|
500
|
+
- Testing with sample data
|
|
501
|
+
- CI/CD cost checks
|
|
502
|
+
|
|
503
|
+
### `smartmeter export`
|
|
504
|
+
|
|
505
|
+
Export analysis data.
|
|
506
|
+
|
|
507
|
+
**Options:**
|
|
508
|
+
|
|
509
|
+
- `--format json|csv` - Output format
|
|
510
|
+
- `--output <file>` - Destination file
|
|
511
|
+
|
|
512
|
+
### `smartmeter config`
|
|
513
|
+
|
|
514
|
+
Manage SmartMeter configuration.
|
|
515
|
+
|
|
516
|
+
**Subcommands:**
|
|
517
|
+
|
|
518
|
+
- `--key <api-key>` - Store OpenRouter API key
|
|
519
|
+
- `--show` - Display current config
|
|
520
|
+
- `--reset` - Reset to defaults
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## Examples
|
|
525
|
+
|
|
526
|
+
### Basic Usage
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# Install
|
|
530
|
+
npm install -g openclaw-smartmeter
|
|
531
|
+
|
|
532
|
+
# Analyze and view dashboard
|
|
533
|
+
smartmeter analyze
|
|
534
|
+
|
|
535
|
+
# Apply optimizations
|
|
536
|
+
smartmeter apply
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Advanced Workflow
|
|
540
|
+
|
|
541
|
+
```bash
|
|
542
|
+
# Analyze specific session
|
|
543
|
+
smartmeter analyze ~/.openclaw/agents/my-agent/sessions/session-123.jsonl
|
|
544
|
+
|
|
545
|
+
# Preview changes
|
|
546
|
+
smartmeter preview
|
|
547
|
+
|
|
548
|
+
# Export analysis
|
|
549
|
+
smartmeter export --format json --output report.json
|
|
550
|
+
|
|
551
|
+
# Apply optimizations
|
|
552
|
+
smartmeter apply
|
|
553
|
+
|
|
554
|
+
# Monitor for issues, rollback if needed
|
|
555
|
+
smartmeter rollback
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Continuous Monitoring
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
# Weekly analysis (add to cron)
|
|
562
|
+
0 0 * * 0 smartmeter analyze && smartmeter export --format csv --output weekly-report.csv
|
|
563
|
+
|
|
564
|
+
# Budget alerts via Telegram
|
|
565
|
+
export TELEGRAM_BOT_TOKEN="your-token"
|
|
566
|
+
export TELEGRAM_CHAT_ID="your-chat-id"
|
|
567
|
+
smartmeter monitor --alert-threshold 0.75
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## FAQ
|
|
573
|
+
|
|
574
|
+
### Will this affect my AI quality?
|
|
575
|
+
|
|
576
|
+
No. SmartMeter only recommends changes when cheaper models achieve the same success rate. You can always preview before applying.
|
|
577
|
+
|
|
578
|
+
### How much data is needed?
|
|
579
|
+
|
|
580
|
+
Minimum 2 days, but 14+ days recommended for accurate patterns. The tool will warn if data is insufficient.
|
|
581
|
+
|
|
582
|
+
### Is my data safe?
|
|
583
|
+
|
|
584
|
+
Yes. All analysis happens locally on your machine. No data is sent to external servers except OpenRouter API (if you configure it).
|
|
585
|
+
|
|
586
|
+
### Can I undo changes?
|
|
587
|
+
|
|
588
|
+
Yes. Every change creates an automatic backup. Use `smartmeter rollback` to restore.
|
|
589
|
+
|
|
590
|
+
### Does it work with other AI providers?
|
|
591
|
+
|
|
592
|
+
Currently optimized for OpenRouter, but works with any provider supported by OpenClaw.
|
|
593
|
+
|
|
594
|
+
### What if I use custom agents?
|
|
595
|
+
|
|
596
|
+
SmartMeter merges with your existing config and preserves custom settings. It only modifies cost-related fields.
|
|
597
|
+
|
|
598
|
+
---
|
|
599
|
+
|
|
600
|
+
## Requirements
|
|
601
|
+
|
|
602
|
+
- **Node.js:** 18.0.0 or higher
|
|
603
|
+
- **OpenClaw:** Any version with session logging
|
|
604
|
+
- **Storage:** At least 2 days of session logs
|
|
605
|
+
- **Ports:** 8080 (dashboard), 3001 (API)
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
## Learn More
|
|
610
|
+
|
|
611
|
+
- **GitHub:** https://github.com/vajih/openclaw-smartmeter
|
|
612
|
+
- **Issues:** https://github.com/vajih/openclaw-smartmeter/issues
|
|
613
|
+
- **License:** Apache 2.0
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## Support
|
|
618
|
+
|
|
619
|
+
Found a bug? Have a feature request?
|
|
620
|
+
|
|
621
|
+
1. Check [existing issues](https://github.com/vajih/openclaw-smartmeter/issues)
|
|
622
|
+
2. Create a new issue with details
|
|
623
|
+
3. Include your Node.js version and OS
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## Changelog
|
|
628
|
+
|
|
629
|
+
### v0.3.0 (February 11, 2026)
|
|
630
|
+
|
|
631
|
+
- ✨ OpenRouter API integration
|
|
632
|
+
- 🎨 Professional UI redesign
|
|
633
|
+
- 🐛 Fixed apply optimization feature
|
|
634
|
+
- 📊 Enhanced dashboard with real-time data
|
|
635
|
+
- 🔒 Improved config validation
|
|
636
|
+
|
|
637
|
+
### v0.2.4
|
|
638
|
+
|
|
639
|
+
- 💄 UX improvements for cost display
|
|
640
|
+
- 🐛 Zero-cost scenario handling
|
|
641
|
+
|
|
642
|
+
### v0.2.3
|
|
643
|
+
|
|
644
|
+
- 🐛 Critical bug fix: keep analyze command alive
|
|
645
|
+
|
|
646
|
+
### v0.2.2
|
|
647
|
+
|
|
648
|
+
- 📦 Initial public release
|
|
649
|
+
- ✨ Core analysis and optimization engine
|
|
650
|
+
- 🎨 Basic dashboard UI
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
654
|
+
**Made with 💰 by the OpenClaw community**
|