clawcost 1.0.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/README.md +100 -0
- package/dist/index.cjs +593 -0
- package/dist/public/assets/index-B5X32u6q.css +1 -0
- package/dist/public/assets/index-CaIYpGKh.js +111 -0
- package/dist/public/favicon.png +0 -0
- package/dist/public/index.html +16 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ClawCost
|
|
2
|
+
|
|
3
|
+
Monitor your OpenClaw session costs in real-time with budget alerts and a dark-themed dashboard.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Real-time Cost Tracking** - Watches OpenClaw session logs and calculates API costs automatically
|
|
8
|
+
- **Budget Alerts** - Desktop notifications when spending hits warning thresholds or limits
|
|
9
|
+
- **Auto-Pause** - Optionally stop OpenClaw when budget limits are exceeded
|
|
10
|
+
- **Dark Dashboard** - 5-page React dashboard with charts and session drilldowns
|
|
11
|
+
- **Model Analyzer** - Compare model costs, run what-if calculations, get optimization tips
|
|
12
|
+
- **Weekly Reports** - Auto-generated savings reports emailed every Sunday
|
|
13
|
+
- **Session Timeline** - Per-message cost breakdown for every session
|
|
14
|
+
|
|
15
|
+
## Supported Models
|
|
16
|
+
|
|
17
|
+
| Model | Input ($/M tokens) | Output ($/M tokens) |
|
|
18
|
+
|-------|-------|--------|
|
|
19
|
+
| Claude Opus 4.6 | $15 | $75 |
|
|
20
|
+
| Claude Sonnet 4.5 | $3 | $15 |
|
|
21
|
+
| Claude Haiku 4.5 | $0.80 | $4 |
|
|
22
|
+
| GPT-4o | $2.50 | $10 |
|
|
23
|
+
| GPT-4o-mini | $0.15 | $0.60 |
|
|
24
|
+
| Gemini 2.5 Pro | $1.25 | $10 |
|
|
25
|
+
| Gemini Flash | $0.15 | $0.60 |
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g clawcost
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
### Launch Dashboard
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
clawcost dash
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Opens the dashboard at `http://localhost:5000` with:
|
|
42
|
+
- Overview page with spending stats and daily chart
|
|
43
|
+
- Sessions page with per-message timeline
|
|
44
|
+
- Model Analyzer with what-if calculator
|
|
45
|
+
- Weekly Reports with savings recommendations
|
|
46
|
+
- Settings for budget limits and email config
|
|
47
|
+
|
|
48
|
+
### Set Budget
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
clawcost budget set --daily 10 --monthly 100 --auto-pause
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Options:
|
|
55
|
+
- `--daily <amount>` - Daily spending limit in USD
|
|
56
|
+
- `--weekly <amount>` - Weekly spending limit
|
|
57
|
+
- `--monthly <amount>` - Monthly spending limit
|
|
58
|
+
- `--auto-pause` - Automatically pause OpenClaw when limit hit
|
|
59
|
+
- `--threshold <percent>` - Warning threshold (default: 80%)
|
|
60
|
+
|
|
61
|
+
### Generate Report
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Quick spending summary
|
|
65
|
+
clawcost report
|
|
66
|
+
|
|
67
|
+
# Full weekly savings report
|
|
68
|
+
clawcost report --weekly
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## How It Works
|
|
72
|
+
|
|
73
|
+
ClawCost watches `~/.openclaw/agents/*/sessions/*.jsonl` for new session logs. When a new log entry appears, it:
|
|
74
|
+
|
|
75
|
+
1. Parses the model, token counts, and message type
|
|
76
|
+
2. Calculates the cost using current API pricing
|
|
77
|
+
3. Stores everything in a local SQLite database (`clawcost.db`)
|
|
78
|
+
4. Checks spending against your budget limits
|
|
79
|
+
5. Sends desktop notifications if thresholds are hit
|
|
80
|
+
|
|
81
|
+
## Authentication
|
|
82
|
+
|
|
83
|
+
The dashboard uses email/password authentication:
|
|
84
|
+
- Sign up to get a 7-day free trial
|
|
85
|
+
- After trial, request Pro access from the admin
|
|
86
|
+
|
|
87
|
+
## Environment Variables
|
|
88
|
+
|
|
89
|
+
| Variable | Description | Required |
|
|
90
|
+
|----------|-------------|----------|
|
|
91
|
+
| `SESSION_SECRET` | JWT signing secret | Yes (production) |
|
|
92
|
+
| `ADMIN_SECRET` | Secret for admin approval endpoint | Yes |
|
|
93
|
+
|
|
94
|
+
## Contact
|
|
95
|
+
|
|
96
|
+
Telegram: [@shadow9812](https://t.me/shadow9812)
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
MIT
|