agent-cost-analyzer 0.0.0 → 0.16.1

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -5
  3. package/THIRD-PARTY-NOTICES.md +3510 -0
  4. package/bin/agent-cost-analyzer.js +22 -0
  5. package/bin/node-gate.js +41 -0
  6. package/dist/cli.js +315313 -0
  7. package/dist/data/learn-scripts/cache-basics.json +163 -0
  8. package/dist/data/learn-scripts/cache-ttl-1-hour-breakpoint.json +176 -0
  9. package/dist/data/learn-scripts/cache-ttl-smoke-break.json +190 -0
  10. package/dist/data/learn-scripts/cascading-model-switch-then-ttl-lapse.json +121 -0
  11. package/dist/data/learn-scripts/clear.json +133 -0
  12. package/dist/data/learn-scripts/compaction.json +98 -0
  13. package/dist/data/learn-scripts/image-attachment-invalidation.json +108 -0
  14. package/dist/data/learn-scripts/inline-exploration-bloat.json +115 -0
  15. package/dist/data/learn-scripts/instructions-edit.json +99 -0
  16. package/dist/data/learn-scripts/mcp-tool-change.json +93 -0
  17. package/dist/data/learn-scripts/model-switch.json +88 -0
  18. package/dist/data/learn-scripts/reasoning-budget-toggle.json +98 -0
  19. package/dist/data/learn-scripts/rewind.json +139 -0
  20. package/dist/data/learn-scripts/session-forking-multi-branch.json +124 -0
  21. package/dist/data/learn-scripts/session-forking.json +99 -0
  22. package/dist/data/learn-scripts/silent-instructions-pullin.json +104 -0
  23. package/dist/data/learn-scripts/subagent-cheaper-model.json +70 -0
  24. package/dist/data/learn-scripts/subagent-session.json +70 -0
  25. package/dist/data/price-book/anthropic-api.json +662 -0
  26. package/dist/data/price-book/github-copilot.json +1402 -0
  27. package/dist/data/price-book/google-api.json +507 -0
  28. package/dist/data/price-book/openai-api.json +1184 -0
  29. package/dist/data/vendor-profiles/anthropic.json +568 -0
  30. package/dist/data/vendor-profiles/google.json +190 -0
  31. package/dist/data/vendor-profiles/microsoft.json +96 -0
  32. package/dist/data/vendor-profiles/moonshot.json +115 -0
  33. package/dist/data/vendor-profiles/openai.json +442 -0
  34. package/dist/data/vendor-profiles/xai.json +217 -0
  35. package/dist/mcp-apps/views.html +124 -0
  36. package/dist/web/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
  37. package/dist/web/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
  38. package/dist/web/assets/commit-mono-latin-700-normal-1-GU0IUE.woff +0 -0
  39. package/dist/web/assets/commit-mono-latin-700-normal-DU8mrtj2.woff2 +0 -0
  40. package/dist/web/assets/index-DeqVluBu.js +76 -0
  41. package/dist/web/assets/index-EJpifWDV.css +1 -0
  42. package/dist/web/assets/source-serif-4-latin-400-normal-C1O10bxN.woff +0 -0
  43. package/dist/web/assets/source-serif-4-latin-400-normal-DJ5YJwmz.woff2 +0 -0
  44. package/dist/web/assets/source-serif-4-latin-600-normal-DeJomR3S.woff +0 -0
  45. package/dist/web/assets/source-serif-4-latin-600-normal-DouSKlru.woff2 +0 -0
  46. package/dist/web/index.html +32 -0
  47. package/package.json +18 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raul Kivi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,76 @@
1
1
  # agent-cost-analyzer
2
2
 
3
- Placeholder that reserves the name. It contains no code.
3
+ **Last changed:** 2026-11-15 · **Source:** https://github.com/raulkivi/agent-cost-analyzer
4
4
 
5
- Agent Cost Analyzer is a local, read-only cost analyzer for AI coding-agent logs:
6
- https://github.com/raulkivi/agent-cost-analyzer
5
+ See where the tokens and money go when an AI agent writes code for you. This
6
+ package runs the standalone **Agent Cost Analyzer** app: it reads the session
7
+ logs that GitHub Copilot Chat, Claude Code and the pi coding agent already
8
+ write on your machine and shows every session turn by turn. It also has a
9
+ Learn mode with sample sessions, so it is useful before you have any data.
7
10
 
8
- Real versions are published from the repository's release workflow through npm
9
- trusted publishing, with a provenance attestation.
11
+ Independent project; not affiliated with or endorsed by GitHub, Microsoft,
12
+ Anthropic or the pi project.
13
+
14
+ ## Run it
15
+
16
+ Needs Node.js 22.18 or newer.
17
+
18
+ ```sh
19
+ npx agent-cost-analyzer
20
+ ```
21
+
22
+ The app starts on http://127.0.0.1:5199 and opens in your browser. If it is
23
+ already running, a second start opens that instance. If another program holds
24
+ port 5199, it takes the next free port (up to ten) and prints which.
25
+ `npx agent-cost-analyzer@latest` runs the newest release.
26
+
27
+ | Option | Does |
28
+ |---|---|
29
+ | `--port <n>` | Uses that port only; `0` takes any free port. Fails if the port is busy |
30
+ | `--no-open` | Starts without opening a browser |
31
+ | `--help`, `-h` | Prints usage |
32
+ | `--version`, `-v` | Prints the version |
33
+
34
+ Ctrl+C stops the app. It never listens beyond `127.0.0.1`; there is no
35
+ `--host` option.
36
+
37
+ ## Ask your AI chat
38
+
39
+ `agent-cost-analyzer mcp` runs the same analysis as a read-only MCP server
40
+ over stdio, so an MCP client can answer "what drove my spend this week?". The
41
+ interactive views for hosts that support MCP Apps are included.
42
+
43
+ ```sh
44
+ claude mcp add agent-cost-analyzer -- npx -y --prefer-offline agent-cost-analyzer mcp
45
+ ```
46
+
47
+ - `--prefer-offline` starts the cached copy at once when the npm registry is
48
+ unreachable; without it, `npx` waits about a minute of retries first.
49
+ - On Windows, a client that does not resolve `.cmd` files needs
50
+ `cmd /c npx -y --prefer-offline agent-cost-analyzer mcp`.
51
+ - To run fully offline or on a pinned version, run
52
+ `npm install -g agent-cost-analyzer` once, then register
53
+ `agent-cost-analyzer mcp` as the command.
54
+ - `--project-billing-details` after `mcp` also shares client names and
55
+ billing codes with the client.
56
+
57
+ ## Privacy
58
+
59
+ - Everything runs on your machine; the app sends no data anywhere and makes
60
+ no network call of its own (`npx` itself talks to the npm registry).
61
+ - It only reads your tools' session logs. The one place it writes is its own
62
+ settings folder: `~/.config/agent-cost-analyzer` on Linux,
63
+ `~/Library/Application Support/agent-cost-analyzer` on macOS and
64
+ `%APPDATA%\agent-cost-analyzer` on Windows.
65
+ - The package has no dependencies and no install scripts, and each release
66
+ carries an npm provenance attestation that links to the source commit.
67
+
68
+ ## More
69
+
70
+ - [Setup and data sources](https://github.com/raulkivi/agent-cost-analyzer/blob/main/docs/standalone-app.md)
71
+ - [User Guide](https://github.com/raulkivi/agent-cost-analyzer/blob/main/docs/UserGuide.md)
72
+ - [Security policy and how to verify a release](https://github.com/raulkivi/agent-cost-analyzer/blob/main/SECURITY.md)
73
+ - [Changelog](https://github.com/raulkivi/agent-cost-analyzer/blob/main/CHANGELOG.md)
74
+ - [Report a problem](https://github.com/raulkivi/agent-cost-analyzer/issues)
75
+
76
+ MIT licensed. Third-party licenses: `THIRD-PARTY-NOTICES.md` in this package.