@hasna/economy 0.1.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/LICENSE +17 -0
- package/README.md +69 -0
- package/dist/cli/index.js +1170 -0
- package/dist/index.js +640 -0
- package/dist/mcp/index.js +675 -0
- package/dist/server/index.js +759 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Andrei Hasna
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @hasna/economy
|
|
2
|
+
|
|
3
|
+
AI coding cost tracker for Claude Code, Codex, and Gemini.
|
|
4
|
+
|
|
5
|
+
Track every dollar spent across all your AI coding sessions — per request, per session, per project, per day.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Claude Code** — exact costs from telemetry JSONL (`costUSD` per request)
|
|
10
|
+
- **Codex** — estimated costs from token count × model pricing
|
|
11
|
+
- **SQLite backend** — all data stored locally at `~/.economy/economy.db`
|
|
12
|
+
- **DB-backed pricing** — model rates editable via CLI, seeded from defaults
|
|
13
|
+
- **CLI** — `economy sync`, `economy today`, `economy sessions`, `economy watch`, etc.
|
|
14
|
+
- **Live watch** — `economy watch` streams costs as they arrive
|
|
15
|
+
- **Budgets** — set per-project or global budgets with alert thresholds
|
|
16
|
+
- **MCP server** — agents can query their own costs
|
|
17
|
+
- **REST API** — `economy serve` on port 3456
|
|
18
|
+
- **Web dashboard** — charts, sessions table, model/project breakdown
|
|
19
|
+
- **macOS menubar** — live cost display in your menu bar
|
|
20
|
+
- **SDK** — `@hasna/economy-sdk` for programmatic access
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun add -g @hasna/economy
|
|
26
|
+
economy sync
|
|
27
|
+
economy today
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
economy sync # ingest Claude Code + Codex data
|
|
34
|
+
economy today # today's cost summary
|
|
35
|
+
economy week # this week
|
|
36
|
+
economy month # this month
|
|
37
|
+
economy sessions # list sessions with costs
|
|
38
|
+
economy top # most expensive sessions
|
|
39
|
+
economy watch # live cost stream
|
|
40
|
+
economy breakdown # by model/agent/project
|
|
41
|
+
economy budget set --period monthly --limit 100
|
|
42
|
+
economy budget list
|
|
43
|
+
economy project add /path/to/project --name "My Project"
|
|
44
|
+
economy pricing list
|
|
45
|
+
economy pricing set gpt-4o --input 2.50 --output 10.00
|
|
46
|
+
economy serve # start REST API on port 3456
|
|
47
|
+
economy dashboard # open web dashboard
|
|
48
|
+
economy mcp --all # show MCP install commands
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## MCP Server
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
claude mcp add --transport stdio --scope user economy -- economy-mcp
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## SDK
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { EconomyClient } from '@hasna/economy-sdk'
|
|
61
|
+
|
|
62
|
+
const client = new EconomyClient()
|
|
63
|
+
const today = await client.getSummary('today')
|
|
64
|
+
console.log(`Today's cost: $${today.total_usd.toFixed(4)}`)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
Apache-2.0
|