token-tracker 0.2.0__tar.gz → 0.2.1__tar.gz

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 (25) hide show
  1. {token_tracker-0.2.0 → token_tracker-0.2.1}/PKG-INFO +2 -2
  2. {token_tracker-0.2.0 → token_tracker-0.2.1}/README.md +23 -17
  3. {token_tracker-0.2.0 → token_tracker-0.2.1}/pyproject.toml +2 -2
  4. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/cli.py +3 -1
  5. {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/PKG-INFO +2 -2
  6. {token_tracker-0.2.0 → token_tracker-0.2.1}/setup.cfg +0 -0
  7. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/__init__.py +0 -0
  8. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/__init__.py +0 -0
  9. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/claude.py +0 -0
  10. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/codex.py +0 -0
  11. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/rate_limits.py +0 -0
  12. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/registry.py +0 -0
  13. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/types.py +0 -0
  14. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/__init__.py +0 -0
  15. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/aggregator.py +0 -0
  16. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/blocks.py +0 -0
  17. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/cost.py +0 -0
  18. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/hooks.py +0 -0
  19. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/ui/__init__.py +0 -0
  20. {token_tracker-0.2.0 → token_tracker-0.2.1}/src/ui/tables.py +0 -0
  21. {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/SOURCES.txt +0 -0
  22. {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/dependency_links.txt +0 -0
  23. {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/entry_points.txt +0 -0
  24. {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/requires.txt +0 -0
  25. {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: token-tracker
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Track token usage across local AI agents (Claude Code, Codex)
5
- Requires-Python: >=3.12
5
+ Requires-Python: >=3.11
6
6
  Requires-Dist: rich>=13.7
@@ -1,26 +1,34 @@
1
1
  # Token Tracker (tt)
2
2
 
3
- 本地 AI Agent Token 消耗追踪工具,支持 **Claude Code** 和 **Codex** 。
3
+ 本地 AI Agent Token 消耗追踪/分析工具,支持 **Claude Code** 和 **Codex** 。
4
4
 
5
5
  自定义 StatusLine 状态栏 + CLI Dashboard,实时查看 token 用量、等效成本、限额状态。
6
6
 
7
- ![Python](https://img.shields.io/badge/python-3.12+-blue) ![License](https://img.shields.io/badge/license-MIT-green)
7
+ ![Python](https://img.shields.io/badge/python-3.11+-blue) ![License](https://img.shields.io/badge/license-MIT-green)
8
8
 
9
9
  [English](README_EN.md)
10
10
 
11
- ![Token Tracker Dashboard](screenshot.png)
12
-
13
11
  ## StatusLine 状态栏
14
12
 
15
- 自动为 Claude Code 和 Codex 配置状态栏,首次运行 `tt` 即自动安装,脚本更新时自动升级。
13
+ 自动为 Claude Code 和 Codex 配置状态栏,`tt setup` 一键配置,脚本更新时自动升级。
16
14
 
17
15
  **Claude Code**:项目名、5h/7d 配额进度条、CTX 窗口占比、Token 用量、模型名
18
16
 
19
- ![Claude Code StatusLine](screenshot-statusline-cc.png)
17
+ ![Claude Code StatusLine](assets/screenshot-statusline-cc.png)
20
18
 
21
19
  **Codex**:项目名、5h/7d 配额、上下文剩余、模型名
22
20
 
23
- ![Codex StatusLine](screenshot-statusline-codex.png)
21
+ ![Codex StatusLine](assets/screenshot-statusline-codex.png)
22
+
23
+ ## Dashboard 数据面板和 日/周/月 数据报表分析
24
+
25
+ ![Token Tracker Dashboard](assets/screenshot.png)
26
+
27
+ ![Token Tracker Daily](assets/screenshot-daily.png)
28
+
29
+ ![Token Tracker Weekly](assets/screenshot-weekly.png)
30
+
31
+ ![Token Tracker Monthly](assets/screenshot-monthly.png)
24
32
 
25
33
  ## 功能
26
34
 
@@ -46,28 +54,26 @@ pip install token-tracker
46
54
  ## 使用
47
55
 
48
56
  ```bash
57
+ tt setup # 初始化配置 Claude Code + Codex status_line
49
58
  tt # 交互式 Dashboard(方向键切换 Agent)
50
- tt claude # Claude Code
51
- tt codex # Codex
59
+ tt claude # 仅展示 Claude Code
60
+ tt codex # 仅展示 Codex
52
61
  tt daily # 按日汇总(按 token 消耗排序)
53
62
  tt weekly # 按周汇总(多 Agent 分组展示)
54
63
  tt monthly # 按月汇总(多 Agent 分组展示)
55
- tt sessions # 会话明细
56
- tt setup # 配置 Claude Code statusLine + Codex status_line
64
+ tt sessions # 最近 20 条会话明细数据
57
65
  tt unsetup # 卸载并恢复安装前的配置
58
66
  ```
59
67
 
60
68
  ## 环境要求
61
69
 
62
- - Python 3.12+
70
+ - Python 3.11+
63
71
  - [Rich](https://github.com/Textualize/rich)(自动安装)
64
72
 
65
- ## Roadmap
73
+ ## TODO
66
74
 
67
- - 🖥️ **桌面应用** — 基于 Tauri 的跨平台桌面版,打开即用,可视化图表 + 更多数据分析
68
- - 🔌 **更多 Agent 支持** — Cursor、Cline、Aider 等本地日志适配 + API 提供商用量拉取
69
- - 🧩 **终端集成** — 规划见 [Terminal Integrations Roadmap](docs/terminal-integrations.md)
75
+ 未来持续增加更多数据报表,多维度分析。
70
76
 
71
77
  ## License
72
78
 
73
- MIT
79
+ Copyright (c) 2026 stormzhang. MIT License.
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "token-tracker"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Track token usage across local AI agents (Claude Code, Codex)"
9
- requires-python = ">=3.12"
9
+ requires-python = ">=3.11"
10
10
  dependencies = [
11
11
  "rich>=13.7",
12
12
  ]
@@ -48,7 +48,9 @@ def _build_agent_data(agent_id: str, agent_name: str) -> dict | None:
48
48
  weekly = aggregate_weekly(entries)
49
49
  monthly = aggregate_monthly(entries)
50
50
  sessions = aggregate_sessions(entries)
51
- recent = _load_entries(agent_id, hours_back=48)
51
+ from datetime import datetime, timezone, timedelta
52
+ cutoff = datetime.now(timezone.utc) - timedelta(hours=48)
53
+ recent = [e for e in entries if e.timestamp >= cutoff]
52
54
  blocks = analyze_blocks(recent)
53
55
  rate_limits = RATE_LIMIT_LOADERS.get(agent_id, lambda: None)()
54
56
  p90 = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: token-tracker
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Track token usage across local AI agents (Claude Code, Codex)
5
- Requires-Python: >=3.12
5
+ Requires-Python: >=3.11
6
6
  Requires-Dist: rich>=13.7
File without changes