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.
- {token_tracker-0.2.0 → token_tracker-0.2.1}/PKG-INFO +2 -2
- {token_tracker-0.2.0 → token_tracker-0.2.1}/README.md +23 -17
- {token_tracker-0.2.0 → token_tracker-0.2.1}/pyproject.toml +2 -2
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/cli.py +3 -1
- {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/PKG-INFO +2 -2
- {token_tracker-0.2.0 → token_tracker-0.2.1}/setup.cfg +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/__init__.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/__init__.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/claude.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/codex.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/rate_limits.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/registry.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/adapters/types.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/__init__.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/aggregator.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/blocks.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/analyzer/cost.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/hooks.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/ui/__init__.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/src/ui/tables.py +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/SOURCES.txt +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/dependency_links.txt +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/entry_points.txt +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/requires.txt +0 -0
- {token_tracker-0.2.0 → token_tracker-0.2.1}/token_tracker.egg-info/top_level.txt +0 -0
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
# Token Tracker (tt)
|
|
2
2
|
|
|
3
|
-
本地 AI Agent Token
|
|
3
|
+
本地 AI Agent Token 消耗追踪/分析工具,支持 **Claude Code** 和 **Codex** 。
|
|
4
4
|
|
|
5
5
|
自定义 StatusLine 状态栏 + CLI Dashboard,实时查看 token 用量、等效成本、限额状态。
|
|
6
6
|
|
|
7
|
-
 
|
|
8
8
|
|
|
9
9
|
[English](README_EN.md)
|
|
10
10
|
|
|
11
|
-

|
|
12
|
-
|
|
13
11
|
## StatusLine 状态栏
|
|
14
12
|
|
|
15
|
-
自动为 Claude Code 和 Codex
|
|
13
|
+
自动为 Claude Code 和 Codex 配置状态栏,`tt setup` 一键配置,脚本更新时自动升级。
|
|
16
14
|
|
|
17
15
|
**Claude Code**:项目名、5h/7d 配额进度条、CTX 窗口占比、Token 用量、模型名
|
|
18
16
|
|
|
19
|
-

|
|
17
|
+

|
|
20
18
|
|
|
21
19
|
**Codex**:项目名、5h/7d 配额、上下文剩余、模型名
|
|
22
20
|
|
|
23
|
-

|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
## Dashboard 数据面板和 日/周/月 数据报表分析
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+

|
|
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 #
|
|
51
|
-
tt 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.
|
|
70
|
+
- Python 3.11+
|
|
63
71
|
- [Rich](https://github.com/Textualize/rich)(自动安装)
|
|
64
72
|
|
|
65
|
-
##
|
|
73
|
+
## TODO
|
|
66
74
|
|
|
67
|
-
|
|
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.
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "Track token usage across local AI agents (Claude Code, Codex)"
|
|
9
|
-
requires-python = ">=3.
|
|
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
|
-
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|