tuntu 0.1.0__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.
- tuntu-0.1.0/LICENSE +21 -0
- tuntu-0.1.0/PKG-INFO +134 -0
- tuntu-0.1.0/README.md +116 -0
- tuntu-0.1.0/pyproject.toml +35 -0
- tuntu-0.1.0/setup.cfg +4 -0
- tuntu-0.1.0/tuntu/__init__.py +3 -0
- tuntu-0.1.0/tuntu/__main__.py +3 -0
- tuntu-0.1.0/tuntu/cli.py +496 -0
- tuntu-0.1.0/tuntu/web/index.html +611 -0
- tuntu-0.1.0/tuntu.egg-info/PKG-INFO +134 -0
- tuntu-0.1.0/tuntu.egg-info/SOURCES.txt +12 -0
- tuntu-0.1.0/tuntu.egg-info/dependency_links.txt +1 -0
- tuntu-0.1.0/tuntu.egg-info/entry_points.txt +2 -0
- tuntu-0.1.0/tuntu.egg-info/top_level.txt +1 -0
tuntu-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tuntu contributors
|
|
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.
|
tuntu-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tuntu
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 吞吐:本机 Claude Code token 用量看板。A local, zero-dependency dashboard for Claude Code token usage.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Keywords: claude,claude-code,tokens,usage,dashboard
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Environment :: Web Environment
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Utilities
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# 吞吐 tuntu
|
|
20
|
+
|
|
21
|
+
我的 Token 都去哪了?——一个本机运行的 Claude Code token 用量看板。
|
|
22
|
+
|
|
23
|
+
A local, zero-dependency dashboard for your Claude Code token usage. It reads the session logs already on your machine and shows them in a playful one-page dashboard. Nothing leaves your computer. (The UI is in Chinese.)
|
|
24
|
+
|
|
25
|
+
## 运行
|
|
26
|
+
|
|
27
|
+
需要 Python 3.9 或更高版本,没有任何第三方依赖。
|
|
28
|
+
|
|
29
|
+
不用安装,一行运行(需要 [uv](https://docs.astral.sh/uv/)):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uvx tuntu
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
或者装成命令:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pipx install tuntu
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
tuntu
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
也可以直接从源码运行,不用安装:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone <本仓库地址>
|
|
49
|
+
cd <仓库目录>
|
|
50
|
+
python3 -m tuntu
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
它会扫描 `~/.claude/projects` 下的会话日志,然后在浏览器里打开 `http://127.0.0.1:8787/`。
|
|
54
|
+
|
|
55
|
+
没有日志,或者只是想先看看长什么样(也适合截图):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
tuntu --demo
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| 参数 | 作用 |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `--demo` | 用虚构数据演示,不读取任何日志 |
|
|
64
|
+
| `--dir PATH` | 指定日志目录(默认 `~/.claude/projects`,也会识别 `CLAUDE_CONFIG_DIR`) |
|
|
65
|
+
| `--port N` | 端口,默认 8787,被占用时自动往后找 |
|
|
66
|
+
| `--no-open` | 不自动打开浏览器 |
|
|
67
|
+
| `--web-fonts` | 从 Google Fonts 加载展示字体,观感更接近设计稿(会产生外网请求) |
|
|
68
|
+
| `--json` | 把聚合结果打印成 JSON 后退出 |
|
|
69
|
+
| `--version` | 显示版本号 |
|
|
70
|
+
|
|
71
|
+
## 能看到什么
|
|
72
|
+
|
|
73
|
+
- **总量**:一共吞了多少 token,平均每秒多少,日均多少。
|
|
74
|
+
- **读写比**:每写出 1 个 token,先读了多少个。
|
|
75
|
+
- **缓存命中率**:缓存读取 ÷ 全部输入。
|
|
76
|
+
- **每日吞吐**:可以切换看全部、输出、请求次数或命中率。
|
|
77
|
+
- **24 小时钟、一周作息表**:你什么时候用得最多。
|
|
78
|
+
- **构成**:缓存读取、缓存写入、输出、新输入各占多少;缓存写入里 1 小时档的占比;子代理的占比。
|
|
79
|
+
- **推理强度、模型、项目、工具**:各自的分布。
|
|
80
|
+
- **会话马拉松榜**:最耗 token 的会话。点进去能看到上下文长度随对话增长、被自动压缩的过程。
|
|
81
|
+
- **成就贴纸**:夜猫子、缓存大师、马拉松选手……
|
|
82
|
+
|
|
83
|
+
时间范围可以切换:全部、近 30 天、近 7 天、今天。
|
|
84
|
+
|
|
85
|
+
## 隐私
|
|
86
|
+
|
|
87
|
+
- 服务只监听 `127.0.0.1`,并且拒绝 Host 不是本机的请求。
|
|
88
|
+
- 默认不发出任何外网请求,页面带有禁止外部资源的 CSP。只有加了 `--web-fonts` 才会去请求 Google Fonts。
|
|
89
|
+
- 只取用日志里的用量数字、时间、模型名、工具名和工作目录名;对话内容不会被保存、显示或发送到任何地方。
|
|
90
|
+
- 页面上的项目只显示目录名,不显示完整路径;日志目录里的家目录显示为 `~`。
|
|
91
|
+
- 不写任何文件,不做缓存,关掉就什么都不留。
|
|
92
|
+
|
|
93
|
+
分享截图前请留意:项目名和工具名来自你自己的机器。想要一张不含个人信息的图,用 `--demo`。
|
|
94
|
+
|
|
95
|
+
## 数字是怎么算的
|
|
96
|
+
|
|
97
|
+
- 数据来自 Claude Code 写在本机的会话日志(`*.jsonl`)里每次请求的 `usage` 字段。
|
|
98
|
+
- 同一条消息在日志里会出现多行,按消息去重后再累加。
|
|
99
|
+
- 续接或分叉出来的会话会带着前半段记录。算总量时每条消息只算一次;但会话榜里每个会话按它自己的全部记录算,所以各会话相加会超过总量。
|
|
100
|
+
- 项目按会话启动时的目录归类,worktree 里的会话归到原项目。
|
|
101
|
+
- “会话跨度”是第一次请求到最后一次请求之间的时间,中间可能隔了很久没用。
|
|
102
|
+
- 时间按本机时区显示。
|
|
103
|
+
- Claude Code 默认只保留一段时间的日志(由 `cleanupPeriodDays` 设置决定),更早的用量已经不在本机,这里也就看不到。
|
|
104
|
+
- 这里只统计本机的 Claude Code,不包含 claude.ai 网页或手机上的对话。
|
|
105
|
+
- 这些数字是从本机日志估算的,不是账单。以官方的用量页面为准。
|
|
106
|
+
|
|
107
|
+
## 目录结构
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
tuntu/cli.py 扫描日志、聚合、本机 HTTP 服务(只用标准库)
|
|
111
|
+
tuntu/web/index.html 页面(单文件,原生 JS,无依赖)
|
|
112
|
+
pyproject.toml 打包配置
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 发布新版本(维护者)
|
|
116
|
+
|
|
117
|
+
1. 改 `tuntu/__init__.py` 里的 `__version__`。
|
|
118
|
+
2. 构建并上传:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv build
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
uv publish
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 说明
|
|
129
|
+
|
|
130
|
+
这是个人项目,与 Anthropic 无关。Claude 和 Claude Code 是 Anthropic 的商标。
|
|
131
|
+
|
|
132
|
+
## 许可证
|
|
133
|
+
|
|
134
|
+
MIT,见 [LICENSE](LICENSE)。
|
tuntu-0.1.0/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# 吞吐 tuntu
|
|
2
|
+
|
|
3
|
+
我的 Token 都去哪了?——一个本机运行的 Claude Code token 用量看板。
|
|
4
|
+
|
|
5
|
+
A local, zero-dependency dashboard for your Claude Code token usage. It reads the session logs already on your machine and shows them in a playful one-page dashboard. Nothing leaves your computer. (The UI is in Chinese.)
|
|
6
|
+
|
|
7
|
+
## 运行
|
|
8
|
+
|
|
9
|
+
需要 Python 3.9 或更高版本,没有任何第三方依赖。
|
|
10
|
+
|
|
11
|
+
不用安装,一行运行(需要 [uv](https://docs.astral.sh/uv/)):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uvx tuntu
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
或者装成命令:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pipx install tuntu
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
tuntu
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
也可以直接从源码运行,不用安装:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone <本仓库地址>
|
|
31
|
+
cd <仓库目录>
|
|
32
|
+
python3 -m tuntu
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
它会扫描 `~/.claude/projects` 下的会话日志,然后在浏览器里打开 `http://127.0.0.1:8787/`。
|
|
36
|
+
|
|
37
|
+
没有日志,或者只是想先看看长什么样(也适合截图):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
tuntu --demo
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| 参数 | 作用 |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `--demo` | 用虚构数据演示,不读取任何日志 |
|
|
46
|
+
| `--dir PATH` | 指定日志目录(默认 `~/.claude/projects`,也会识别 `CLAUDE_CONFIG_DIR`) |
|
|
47
|
+
| `--port N` | 端口,默认 8787,被占用时自动往后找 |
|
|
48
|
+
| `--no-open` | 不自动打开浏览器 |
|
|
49
|
+
| `--web-fonts` | 从 Google Fonts 加载展示字体,观感更接近设计稿(会产生外网请求) |
|
|
50
|
+
| `--json` | 把聚合结果打印成 JSON 后退出 |
|
|
51
|
+
| `--version` | 显示版本号 |
|
|
52
|
+
|
|
53
|
+
## 能看到什么
|
|
54
|
+
|
|
55
|
+
- **总量**:一共吞了多少 token,平均每秒多少,日均多少。
|
|
56
|
+
- **读写比**:每写出 1 个 token,先读了多少个。
|
|
57
|
+
- **缓存命中率**:缓存读取 ÷ 全部输入。
|
|
58
|
+
- **每日吞吐**:可以切换看全部、输出、请求次数或命中率。
|
|
59
|
+
- **24 小时钟、一周作息表**:你什么时候用得最多。
|
|
60
|
+
- **构成**:缓存读取、缓存写入、输出、新输入各占多少;缓存写入里 1 小时档的占比;子代理的占比。
|
|
61
|
+
- **推理强度、模型、项目、工具**:各自的分布。
|
|
62
|
+
- **会话马拉松榜**:最耗 token 的会话。点进去能看到上下文长度随对话增长、被自动压缩的过程。
|
|
63
|
+
- **成就贴纸**:夜猫子、缓存大师、马拉松选手……
|
|
64
|
+
|
|
65
|
+
时间范围可以切换:全部、近 30 天、近 7 天、今天。
|
|
66
|
+
|
|
67
|
+
## 隐私
|
|
68
|
+
|
|
69
|
+
- 服务只监听 `127.0.0.1`,并且拒绝 Host 不是本机的请求。
|
|
70
|
+
- 默认不发出任何外网请求,页面带有禁止外部资源的 CSP。只有加了 `--web-fonts` 才会去请求 Google Fonts。
|
|
71
|
+
- 只取用日志里的用量数字、时间、模型名、工具名和工作目录名;对话内容不会被保存、显示或发送到任何地方。
|
|
72
|
+
- 页面上的项目只显示目录名,不显示完整路径;日志目录里的家目录显示为 `~`。
|
|
73
|
+
- 不写任何文件,不做缓存,关掉就什么都不留。
|
|
74
|
+
|
|
75
|
+
分享截图前请留意:项目名和工具名来自你自己的机器。想要一张不含个人信息的图,用 `--demo`。
|
|
76
|
+
|
|
77
|
+
## 数字是怎么算的
|
|
78
|
+
|
|
79
|
+
- 数据来自 Claude Code 写在本机的会话日志(`*.jsonl`)里每次请求的 `usage` 字段。
|
|
80
|
+
- 同一条消息在日志里会出现多行,按消息去重后再累加。
|
|
81
|
+
- 续接或分叉出来的会话会带着前半段记录。算总量时每条消息只算一次;但会话榜里每个会话按它自己的全部记录算,所以各会话相加会超过总量。
|
|
82
|
+
- 项目按会话启动时的目录归类,worktree 里的会话归到原项目。
|
|
83
|
+
- “会话跨度”是第一次请求到最后一次请求之间的时间,中间可能隔了很久没用。
|
|
84
|
+
- 时间按本机时区显示。
|
|
85
|
+
- Claude Code 默认只保留一段时间的日志(由 `cleanupPeriodDays` 设置决定),更早的用量已经不在本机,这里也就看不到。
|
|
86
|
+
- 这里只统计本机的 Claude Code,不包含 claude.ai 网页或手机上的对话。
|
|
87
|
+
- 这些数字是从本机日志估算的,不是账单。以官方的用量页面为准。
|
|
88
|
+
|
|
89
|
+
## 目录结构
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
tuntu/cli.py 扫描日志、聚合、本机 HTTP 服务(只用标准库)
|
|
93
|
+
tuntu/web/index.html 页面(单文件,原生 JS,无依赖)
|
|
94
|
+
pyproject.toml 打包配置
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 发布新版本(维护者)
|
|
98
|
+
|
|
99
|
+
1. 改 `tuntu/__init__.py` 里的 `__version__`。
|
|
100
|
+
2. 构建并上传:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
uv build
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv publish
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 说明
|
|
111
|
+
|
|
112
|
+
这是个人项目,与 Anthropic 无关。Claude 和 Claude Code 是 Anthropic 的商标。
|
|
113
|
+
|
|
114
|
+
## 许可证
|
|
115
|
+
|
|
116
|
+
MIT,见 [LICENSE](LICENSE)。
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tuntu"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "吞吐:本机 Claude Code token 用量看板。A local, zero-dependency dashboard for Claude Code token usage."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
keywords = ["claude", "claude-code", "tokens", "usage", "dashboard"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Environment :: Web Environment",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Natural Language :: Chinese (Simplified)",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Topic :: Utilities",
|
|
22
|
+
]
|
|
23
|
+
dependencies = []
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
tuntu = "tuntu.cli:main"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools]
|
|
29
|
+
packages = ["tuntu"]
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.dynamic]
|
|
32
|
+
version = { attr = "tuntu.__version__" }
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.package-data]
|
|
35
|
+
tuntu = ["web/*.html"]
|
tuntu-0.1.0/setup.cfg
ADDED