tokenreach 0.5.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.
- tokenreach-0.5.0/LICENSE +21 -0
- tokenreach-0.5.0/PKG-INFO +222 -0
- tokenreach-0.5.0/README.md +213 -0
- tokenreach-0.5.0/examples/sample.jsonl +82 -0
- tokenreach-0.5.0/pyproject.toml +45 -0
- tokenreach-0.5.0/tokenreach/__init__.py +75 -0
- tokenreach-0.5.0/tokenreach/__main__.py +5 -0
- tokenreach-0.5.0/tokenreach/data.py +142 -0
- tokenreach-0.5.0/tokenreach/logs.py +425 -0
- tokenreach-0.5.0/tokenreach/report.py +348 -0
- tokenreach-0.5.0/tokenreach/tools.toml +74 -0
- tokenreach-0.5.0/tokenreach/weights.toml +107 -0
tokenreach-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tokenreach 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.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tokenreach
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Claude Code token usage analyzer: reads your local logs and shows where your tokens go, split by the kind of token-saving tool (caveman, RTK, ...) that works on each part, so you can measure before you install one.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# tokenreach
|
|
11
|
+
|
|
12
|
+
A Claude Code token usage analyzer. It reads your local Claude Code logs and shows where your tokens go, split by the
|
|
13
|
+
kind of token-saving tool that works on each part: output shorteners such as caveman, shell-output compressors such as
|
|
14
|
+
RTK, file-read reducers, tool-result reducers and fixed-prompt reducers. Use it to measure first, before you install
|
|
15
|
+
one. Reach means the part of your usage that a kind of tool works on directly; it is not the amount the tool saves.
|
|
16
|
+
With `--full` the report also lists known tools, what they claim and what third parties measured.
|
|
17
|
+
|
|
18
|
+
## Run it
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
uvx --from git+https://github.com/fognoc/tokenreach tokenreach report
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After the PyPI release: `uvx tokenreach report`. From a clone, with no install:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
git clone https://github.com/fognoc/tokenreach
|
|
28
|
+
cd tokenreach
|
|
29
|
+
python -m tokenreach report
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Needs Python 3.11 or later. No dependencies. Options for `report`:
|
|
33
|
+
|
|
34
|
+
- `--days N`: in a log directory, only files modified in the last N days (1 to 3650, default 30)
|
|
35
|
+
- `--path DIR_OR_FILE`: another log directory (default `~/.claude/projects`), or one `.jsonl` file, read whatever its date
|
|
36
|
+
- `--full`: every breakdown, plus the known tools with their claims and third-party measurements
|
|
37
|
+
- `--json`: all numbers as JSON, at full precision
|
|
38
|
+
- `--data FILE`: an extra tools data file, distributed separately (see below)
|
|
39
|
+
- `--debug`: full error details if something unexpected fails
|
|
40
|
+
|
|
41
|
+
To let Claude Code run the report for you and explain it, add the skill:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
npx skills add fognoc/tokenreach --skill tokenreach
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or install it as a Claude Code plugin (Claude Code 2.1.275 or later):
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/plugin install tokenreach --marketplace fognoc/tokenreach
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Project page: https://tokenreach.fognoc.com/
|
|
54
|
+
|
|
55
|
+
## How it differs from ccusage
|
|
56
|
+
|
|
57
|
+
[ccusage](https://github.com/ccusage/ccusage) reports token totals and cost by day, month, session and billing block.
|
|
58
|
+
tokenreach does not replace it. It reports a different thing: the share of your usage by the kind of tool that works
|
|
59
|
+
on each part.
|
|
60
|
+
|
|
61
|
+
## What it tells you
|
|
62
|
+
|
|
63
|
+
Each share is the size of the part a kind of tool reaches directly, not the amount it saves. Side effects can
|
|
64
|
+
move a tool's real result up or down. `tokenreach` estimates those parts from your own logs.
|
|
65
|
+
|
|
66
|
+
The repository includes a small made-up session, `examples/sample.jsonl`. This is the output of
|
|
67
|
+
`tokenreach report --path examples/sample.jsonl`:
|
|
68
|
+
|
|
69
|
+
<!-- sample-output: kept equal to the real output by tests/test_tokenreach.py -->
|
|
70
|
+
```
|
|
71
|
+
tokenreach: the part of your Claude Code usage each kind of token-saving tool reaches
|
|
72
|
+
|
|
73
|
+
Read: 1 log file; records 2026-11-20 to 2026-11-20; 41 API calls.
|
|
74
|
+
Skipped: 0 unreadable lines, 0 unreadable files.
|
|
75
|
+
|
|
76
|
+
Where the cost goes (token counts weighted by official price ratios; no dollar amounts)
|
|
77
|
+
Claude Code keeps the conversation so far in a cache; writing it there and reading it back are both billed.
|
|
78
|
+
Model output about 16%
|
|
79
|
+
Writing context into the cache about 33%
|
|
80
|
+
Reading cached context again about 51%
|
|
81
|
+
New input not from the cache about 0.0%
|
|
82
|
+
|
|
83
|
+
What each kind of tool reaches (estimates)
|
|
84
|
+
A tool result stays in the conversation and is sent again on every later call. Shares count those repeats.
|
|
85
|
+
Share of cost: the column to compare tools by.
|
|
86
|
+
Share of prompt: share of everything sent to the model on each call (new input plus cache).
|
|
87
|
+
Kind of tool Part it reaches Share of cost Share of prompt
|
|
88
|
+
output shorteners model output about 16% -
|
|
89
|
+
shell-output compressors shell output about 11% about 13%
|
|
90
|
+
file-read reducers Read tool results about 12% about 14%
|
|
91
|
+
tool-result reducers all tool results about 24% about 29%
|
|
92
|
+
fixed-prompt reducers system prompt, tool definitions, other about 58% about 69%
|
|
93
|
+
(remainder, not measured directly)
|
|
94
|
+
|
|
95
|
+
Notes
|
|
96
|
+
- Shares estimate the part each kind of tool reaches directly, not savings; side effects move results.
|
|
97
|
+
- Too few suitable records to measure characters per token; a default rate was used for ASCII text.
|
|
98
|
+
- Few records or a poor fit between characters and tokens: treat the prompt shares as rough.
|
|
99
|
+
|
|
100
|
+
Known tools (claims and third-party measurements) and all details: add --full
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
With `--full` the report adds token totals, cost by billing part and by model, tool-result volume per tool and per
|
|
104
|
+
shell command family, what the model re-reads on each call, and the known tools.
|
|
105
|
+
|
|
106
|
+
## Reading the numbers
|
|
107
|
+
|
|
108
|
+
- Exact (straight from the logs): token totals, files, unreadable lines, tool-result characters.
|
|
109
|
+
- Relative cost: exact token counts multiplied by the official price ratios. No dollar amounts are shown.
|
|
110
|
+
- Estimated: everything about the prompt. Every tool result, model output and user message is counted once for each
|
|
111
|
+
later API call that had it in context, until the conversation ends or is compacted. Characters are converted to
|
|
112
|
+
tokens with a rate measured from your own logs (prompt growth between API calls); with too few usable records, a
|
|
113
|
+
default of 2.0 ASCII characters per token and 1.1 tokens per non-ASCII character is used, and the report says so.
|
|
114
|
+
Those defaults were fitted on one heavy user's logs, where most text is code, paths and JSON; they are not a general
|
|
115
|
+
rule for English prose.
|
|
116
|
+
- "Share of cost" is the column to compare tools by. For parts of the prompt it assumes that part is cached like the
|
|
117
|
+
rest of the prompt. "Share of prompt" is the share of everything sent to the model.
|
|
118
|
+
- Each share is the part a kind of tool reaches directly (an estimate). The actual result depends on how much of that
|
|
119
|
+
part the tool changes, and on side effects such as added instructions or more or fewer calls.
|
|
120
|
+
- "fixed-prompt reducers" is a remainder, not measured directly: the prompt total minus everything that could be
|
|
121
|
+
counted (the system prompt, tool definitions, attachments and images are not in the logs as text). The full report
|
|
122
|
+
also shows "whole-prompt compressors", the whole prompt as a share of cost, for comparison.
|
|
123
|
+
- Third-party measurements are listed next to your share and are not multiplied with it: they come from other
|
|
124
|
+
workloads. `[verified]` means the measurement's own page was opened; `[secondary]` means another site reported it.
|
|
125
|
+
|
|
126
|
+
## Price ratios
|
|
127
|
+
|
|
128
|
+
Different models and billing parts cost different amounts, so tokens are weighted with the ratios from the public price
|
|
129
|
+
list: input 1, 5-minute cache write 1.25, 1-hour cache write 2, output 5, cache read 0.025 to 0.1 depending on the
|
|
130
|
+
model, and each model's base input price to weigh models against each other. The table is in
|
|
131
|
+
`tokenreach/weights.toml` with its source URL and the date it was checked. Prices change; if the table is out of
|
|
132
|
+
date, install a newer version of tokenreach.
|
|
133
|
+
|
|
134
|
+
## Extra tools data (`--data`)
|
|
135
|
+
|
|
136
|
+
The bundled list of known tools is short. A longer list can be distributed as a separate file and passed with
|
|
137
|
+
`--data FILE`. Tools in that file are added to the list; a tool with the same `name` replaces the bundled one. A file
|
|
138
|
+
that does not follow the format is rejected with the line and field that is wrong (exit code 2).
|
|
139
|
+
|
|
140
|
+
Fields of each `[[tool]]`:
|
|
141
|
+
|
|
142
|
+
- `name`, `url`, `kind` (text, required)
|
|
143
|
+
- `part` (required): the part of your logs the tool works on. One of `ai_output`, `shell_output`, `rtk_commands`,
|
|
144
|
+
`file_reads`, `tool_results`, `fixed_and_other`, `input_side`, `none`
|
|
145
|
+
- `claimed`, `touches`, `note`, `independent_note` (text, optional)
|
|
146
|
+
- `covers`, `covers_source` (lists of text): command prefixes and their source, only for `part = "rtk_commands"`
|
|
147
|
+
- `[[tool.measurement]]`: `value`, `source`, `status` (`"verified"` or `"secondary"`) required; `how`, `date` optional
|
|
148
|
+
|
|
149
|
+
```toml
|
|
150
|
+
[[tool]]
|
|
151
|
+
name = "Example compressor"
|
|
152
|
+
url = "https://example.com/compressor"
|
|
153
|
+
kind = "shell-output compressors"
|
|
154
|
+
part = "shell_output"
|
|
155
|
+
claimed = "50% less output (project README)"
|
|
156
|
+
|
|
157
|
+
[[tool.measurement]]
|
|
158
|
+
value = "-3% cost on 40 tasks"
|
|
159
|
+
how = "paired runs, one model"
|
|
160
|
+
source = "https://example.com/measurement"
|
|
161
|
+
status = "verified"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Paid data pack
|
|
165
|
+
|
|
166
|
+
A longer tools list is sold separately as one file, `tools-full.toml`, to pass with `--data`. It lists 20 tools with
|
|
167
|
+
what each author claims. 10 of them also have third-party measurements, 17 in all, each with its own source URL; the
|
|
168
|
+
other 10 have only the author's claim. 7 of the 17 measurements come from the same computingforgeeks page (one task,
|
|
169
|
+
one result per tool).
|
|
170
|
+
|
|
171
|
+
- Price: 2 USD, or 5 USD with the updates of the file published in the 12 months after purchase. One-time payment.
|
|
172
|
+
- Full refund on request within 14 days.
|
|
173
|
+
- Sold through Creem (the seller of record). Buy page: https://tokenreach.fognoc.com/
|
|
174
|
+
- The free tool works without it.
|
|
175
|
+
|
|
176
|
+
## What stays on your machine
|
|
177
|
+
|
|
178
|
+
- No network access. Nothing is sent anywhere, and no agent is run.
|
|
179
|
+
- The output contains only counts, percentages, normalized model ids (unknown ones become `other`), command family
|
|
180
|
+
names and the URLs in the tools data. It does not show message text, command arguments or file paths.
|
|
181
|
+
- Errors print only the error type, without paths or a traceback, unless you pass `--debug`.
|
|
182
|
+
|
|
183
|
+
## Known limits
|
|
184
|
+
|
|
185
|
+
- Some context trimming (cleared old tool results or thinking) is not recorded in the logs, so re-reads can be counted
|
|
186
|
+
too high.
|
|
187
|
+
- The system prompt, tool definitions, attachments and images are not in the logs as text. Their share
|
|
188
|
+
("fixed-prompt reducers") is a remainder, not measured directly, so any error in the other estimates ends up there.
|
|
189
|
+
- RTK coverage is matched on the first words of a Bash command; flags are not checked, so that share is slightly high.
|
|
190
|
+
- Models without a price entry are left out of relative cost and counted separately.
|
|
191
|
+
- The log format is not documented. Lines with unexpected field types are skipped and counted by reason.
|
|
192
|
+
|
|
193
|
+
## Files
|
|
194
|
+
|
|
195
|
+
| File | Role |
|
|
196
|
+
|---|---|
|
|
197
|
+
| tokenreach/\_\_init\_\_.py | Command line entry point |
|
|
198
|
+
| tokenreach/\_\_main\_\_.py | Lets `python -m tokenreach` start the command line |
|
|
199
|
+
| tokenreach/logs.py | Reads logs line by line: usage, tool results, re-reads, rate calibration |
|
|
200
|
+
| tokenreach/report.py | Builds the report (JSON, short summary, full text) |
|
|
201
|
+
| tokenreach/data.py | Loads price ratios and tools data, checks `--data` files |
|
|
202
|
+
| tokenreach/tools.toml | Bundled known tools |
|
|
203
|
+
| tokenreach/weights.toml | Official price ratios per model, with source URL and check date |
|
|
204
|
+
| examples/sample.jsonl | A small made-up session to try the report on |
|
|
205
|
+
| skills/tokenreach/SKILL.md | Lets Claude Code run the report and explain it |
|
|
206
|
+
| tests/test_tokenreach.py | Tests on small synthetic logs, and the README example |
|
|
207
|
+
| tests/test_robustness.py | Tests for malformed records, unreadable files and unexpected errors |
|
|
208
|
+
| pyproject.toml | Package, lint (ruff) and test (pytest) settings |
|
|
209
|
+
| .github/workflows/release.yml | Publishes to PyPI when a version tag is pushed (no API token stored) |
|
|
210
|
+
| LICENSE | MIT license |
|
|
211
|
+
| docs/index.html | Project page (static, no external requests) |
|
|
212
|
+
| docs/privacy.html | Privacy Policy (static, no external requests) |
|
|
213
|
+
| docs/terms.html | Terms of Service for the paid data pack |
|
|
214
|
+
| docs/llms.txt | Short plain-text summary for AI agents |
|
|
215
|
+
| docs/CNAME | Custom domain for GitHub Pages |
|
|
216
|
+
| docs/robots.txt | Tells search engines where the sitemap is |
|
|
217
|
+
| docs/sitemap.xml | List of the site pages for search engines |
|
|
218
|
+
| docs/dc96e7cdee554066069f150cc3e539f2.txt | IndexNow key file (lets the site notify search engines of changes) |
|
|
219
|
+
| docs/ja/index.html | Japanese version of the project page |
|
|
220
|
+
| .claude-plugin/plugin.json | Claude Code plugin manifest (the skill as a plugin) |
|
|
221
|
+
| .claude-plugin/marketplace.json | Lets `/plugin install` find the plugin in this repository |
|
|
222
|
+
| .gitignore | Files kept out of the repository |
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# tokenreach
|
|
2
|
+
|
|
3
|
+
A Claude Code token usage analyzer. It reads your local Claude Code logs and shows where your tokens go, split by the
|
|
4
|
+
kind of token-saving tool that works on each part: output shorteners such as caveman, shell-output compressors such as
|
|
5
|
+
RTK, file-read reducers, tool-result reducers and fixed-prompt reducers. Use it to measure first, before you install
|
|
6
|
+
one. Reach means the part of your usage that a kind of tool works on directly; it is not the amount the tool saves.
|
|
7
|
+
With `--full` the report also lists known tools, what they claim and what third parties measured.
|
|
8
|
+
|
|
9
|
+
## Run it
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
uvx --from git+https://github.com/fognoc/tokenreach tokenreach report
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
After the PyPI release: `uvx tokenreach report`. From a clone, with no install:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
git clone https://github.com/fognoc/tokenreach
|
|
19
|
+
cd tokenreach
|
|
20
|
+
python -m tokenreach report
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Needs Python 3.11 or later. No dependencies. Options for `report`:
|
|
24
|
+
|
|
25
|
+
- `--days N`: in a log directory, only files modified in the last N days (1 to 3650, default 30)
|
|
26
|
+
- `--path DIR_OR_FILE`: another log directory (default `~/.claude/projects`), or one `.jsonl` file, read whatever its date
|
|
27
|
+
- `--full`: every breakdown, plus the known tools with their claims and third-party measurements
|
|
28
|
+
- `--json`: all numbers as JSON, at full precision
|
|
29
|
+
- `--data FILE`: an extra tools data file, distributed separately (see below)
|
|
30
|
+
- `--debug`: full error details if something unexpected fails
|
|
31
|
+
|
|
32
|
+
To let Claude Code run the report for you and explain it, add the skill:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
npx skills add fognoc/tokenreach --skill tokenreach
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or install it as a Claude Code plugin (Claude Code 2.1.275 or later):
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
/plugin install tokenreach --marketplace fognoc/tokenreach
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Project page: https://tokenreach.fognoc.com/
|
|
45
|
+
|
|
46
|
+
## How it differs from ccusage
|
|
47
|
+
|
|
48
|
+
[ccusage](https://github.com/ccusage/ccusage) reports token totals and cost by day, month, session and billing block.
|
|
49
|
+
tokenreach does not replace it. It reports a different thing: the share of your usage by the kind of tool that works
|
|
50
|
+
on each part.
|
|
51
|
+
|
|
52
|
+
## What it tells you
|
|
53
|
+
|
|
54
|
+
Each share is the size of the part a kind of tool reaches directly, not the amount it saves. Side effects can
|
|
55
|
+
move a tool's real result up or down. `tokenreach` estimates those parts from your own logs.
|
|
56
|
+
|
|
57
|
+
The repository includes a small made-up session, `examples/sample.jsonl`. This is the output of
|
|
58
|
+
`tokenreach report --path examples/sample.jsonl`:
|
|
59
|
+
|
|
60
|
+
<!-- sample-output: kept equal to the real output by tests/test_tokenreach.py -->
|
|
61
|
+
```
|
|
62
|
+
tokenreach: the part of your Claude Code usage each kind of token-saving tool reaches
|
|
63
|
+
|
|
64
|
+
Read: 1 log file; records 2026-11-20 to 2026-11-20; 41 API calls.
|
|
65
|
+
Skipped: 0 unreadable lines, 0 unreadable files.
|
|
66
|
+
|
|
67
|
+
Where the cost goes (token counts weighted by official price ratios; no dollar amounts)
|
|
68
|
+
Claude Code keeps the conversation so far in a cache; writing it there and reading it back are both billed.
|
|
69
|
+
Model output about 16%
|
|
70
|
+
Writing context into the cache about 33%
|
|
71
|
+
Reading cached context again about 51%
|
|
72
|
+
New input not from the cache about 0.0%
|
|
73
|
+
|
|
74
|
+
What each kind of tool reaches (estimates)
|
|
75
|
+
A tool result stays in the conversation and is sent again on every later call. Shares count those repeats.
|
|
76
|
+
Share of cost: the column to compare tools by.
|
|
77
|
+
Share of prompt: share of everything sent to the model on each call (new input plus cache).
|
|
78
|
+
Kind of tool Part it reaches Share of cost Share of prompt
|
|
79
|
+
output shorteners model output about 16% -
|
|
80
|
+
shell-output compressors shell output about 11% about 13%
|
|
81
|
+
file-read reducers Read tool results about 12% about 14%
|
|
82
|
+
tool-result reducers all tool results about 24% about 29%
|
|
83
|
+
fixed-prompt reducers system prompt, tool definitions, other about 58% about 69%
|
|
84
|
+
(remainder, not measured directly)
|
|
85
|
+
|
|
86
|
+
Notes
|
|
87
|
+
- Shares estimate the part each kind of tool reaches directly, not savings; side effects move results.
|
|
88
|
+
- Too few suitable records to measure characters per token; a default rate was used for ASCII text.
|
|
89
|
+
- Few records or a poor fit between characters and tokens: treat the prompt shares as rough.
|
|
90
|
+
|
|
91
|
+
Known tools (claims and third-party measurements) and all details: add --full
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
With `--full` the report adds token totals, cost by billing part and by model, tool-result volume per tool and per
|
|
95
|
+
shell command family, what the model re-reads on each call, and the known tools.
|
|
96
|
+
|
|
97
|
+
## Reading the numbers
|
|
98
|
+
|
|
99
|
+
- Exact (straight from the logs): token totals, files, unreadable lines, tool-result characters.
|
|
100
|
+
- Relative cost: exact token counts multiplied by the official price ratios. No dollar amounts are shown.
|
|
101
|
+
- Estimated: everything about the prompt. Every tool result, model output and user message is counted once for each
|
|
102
|
+
later API call that had it in context, until the conversation ends or is compacted. Characters are converted to
|
|
103
|
+
tokens with a rate measured from your own logs (prompt growth between API calls); with too few usable records, a
|
|
104
|
+
default of 2.0 ASCII characters per token and 1.1 tokens per non-ASCII character is used, and the report says so.
|
|
105
|
+
Those defaults were fitted on one heavy user's logs, where most text is code, paths and JSON; they are not a general
|
|
106
|
+
rule for English prose.
|
|
107
|
+
- "Share of cost" is the column to compare tools by. For parts of the prompt it assumes that part is cached like the
|
|
108
|
+
rest of the prompt. "Share of prompt" is the share of everything sent to the model.
|
|
109
|
+
- Each share is the part a kind of tool reaches directly (an estimate). The actual result depends on how much of that
|
|
110
|
+
part the tool changes, and on side effects such as added instructions or more or fewer calls.
|
|
111
|
+
- "fixed-prompt reducers" is a remainder, not measured directly: the prompt total minus everything that could be
|
|
112
|
+
counted (the system prompt, tool definitions, attachments and images are not in the logs as text). The full report
|
|
113
|
+
also shows "whole-prompt compressors", the whole prompt as a share of cost, for comparison.
|
|
114
|
+
- Third-party measurements are listed next to your share and are not multiplied with it: they come from other
|
|
115
|
+
workloads. `[verified]` means the measurement's own page was opened; `[secondary]` means another site reported it.
|
|
116
|
+
|
|
117
|
+
## Price ratios
|
|
118
|
+
|
|
119
|
+
Different models and billing parts cost different amounts, so tokens are weighted with the ratios from the public price
|
|
120
|
+
list: input 1, 5-minute cache write 1.25, 1-hour cache write 2, output 5, cache read 0.025 to 0.1 depending on the
|
|
121
|
+
model, and each model's base input price to weigh models against each other. The table is in
|
|
122
|
+
`tokenreach/weights.toml` with its source URL and the date it was checked. Prices change; if the table is out of
|
|
123
|
+
date, install a newer version of tokenreach.
|
|
124
|
+
|
|
125
|
+
## Extra tools data (`--data`)
|
|
126
|
+
|
|
127
|
+
The bundled list of known tools is short. A longer list can be distributed as a separate file and passed with
|
|
128
|
+
`--data FILE`. Tools in that file are added to the list; a tool with the same `name` replaces the bundled one. A file
|
|
129
|
+
that does not follow the format is rejected with the line and field that is wrong (exit code 2).
|
|
130
|
+
|
|
131
|
+
Fields of each `[[tool]]`:
|
|
132
|
+
|
|
133
|
+
- `name`, `url`, `kind` (text, required)
|
|
134
|
+
- `part` (required): the part of your logs the tool works on. One of `ai_output`, `shell_output`, `rtk_commands`,
|
|
135
|
+
`file_reads`, `tool_results`, `fixed_and_other`, `input_side`, `none`
|
|
136
|
+
- `claimed`, `touches`, `note`, `independent_note` (text, optional)
|
|
137
|
+
- `covers`, `covers_source` (lists of text): command prefixes and their source, only for `part = "rtk_commands"`
|
|
138
|
+
- `[[tool.measurement]]`: `value`, `source`, `status` (`"verified"` or `"secondary"`) required; `how`, `date` optional
|
|
139
|
+
|
|
140
|
+
```toml
|
|
141
|
+
[[tool]]
|
|
142
|
+
name = "Example compressor"
|
|
143
|
+
url = "https://example.com/compressor"
|
|
144
|
+
kind = "shell-output compressors"
|
|
145
|
+
part = "shell_output"
|
|
146
|
+
claimed = "50% less output (project README)"
|
|
147
|
+
|
|
148
|
+
[[tool.measurement]]
|
|
149
|
+
value = "-3% cost on 40 tasks"
|
|
150
|
+
how = "paired runs, one model"
|
|
151
|
+
source = "https://example.com/measurement"
|
|
152
|
+
status = "verified"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Paid data pack
|
|
156
|
+
|
|
157
|
+
A longer tools list is sold separately as one file, `tools-full.toml`, to pass with `--data`. It lists 20 tools with
|
|
158
|
+
what each author claims. 10 of them also have third-party measurements, 17 in all, each with its own source URL; the
|
|
159
|
+
other 10 have only the author's claim. 7 of the 17 measurements come from the same computingforgeeks page (one task,
|
|
160
|
+
one result per tool).
|
|
161
|
+
|
|
162
|
+
- Price: 2 USD, or 5 USD with the updates of the file published in the 12 months after purchase. One-time payment.
|
|
163
|
+
- Full refund on request within 14 days.
|
|
164
|
+
- Sold through Creem (the seller of record). Buy page: https://tokenreach.fognoc.com/
|
|
165
|
+
- The free tool works without it.
|
|
166
|
+
|
|
167
|
+
## What stays on your machine
|
|
168
|
+
|
|
169
|
+
- No network access. Nothing is sent anywhere, and no agent is run.
|
|
170
|
+
- The output contains only counts, percentages, normalized model ids (unknown ones become `other`), command family
|
|
171
|
+
names and the URLs in the tools data. It does not show message text, command arguments or file paths.
|
|
172
|
+
- Errors print only the error type, without paths or a traceback, unless you pass `--debug`.
|
|
173
|
+
|
|
174
|
+
## Known limits
|
|
175
|
+
|
|
176
|
+
- Some context trimming (cleared old tool results or thinking) is not recorded in the logs, so re-reads can be counted
|
|
177
|
+
too high.
|
|
178
|
+
- The system prompt, tool definitions, attachments and images are not in the logs as text. Their share
|
|
179
|
+
("fixed-prompt reducers") is a remainder, not measured directly, so any error in the other estimates ends up there.
|
|
180
|
+
- RTK coverage is matched on the first words of a Bash command; flags are not checked, so that share is slightly high.
|
|
181
|
+
- Models without a price entry are left out of relative cost and counted separately.
|
|
182
|
+
- The log format is not documented. Lines with unexpected field types are skipped and counted by reason.
|
|
183
|
+
|
|
184
|
+
## Files
|
|
185
|
+
|
|
186
|
+
| File | Role |
|
|
187
|
+
|---|---|
|
|
188
|
+
| tokenreach/\_\_init\_\_.py | Command line entry point |
|
|
189
|
+
| tokenreach/\_\_main\_\_.py | Lets `python -m tokenreach` start the command line |
|
|
190
|
+
| tokenreach/logs.py | Reads logs line by line: usage, tool results, re-reads, rate calibration |
|
|
191
|
+
| tokenreach/report.py | Builds the report (JSON, short summary, full text) |
|
|
192
|
+
| tokenreach/data.py | Loads price ratios and tools data, checks `--data` files |
|
|
193
|
+
| tokenreach/tools.toml | Bundled known tools |
|
|
194
|
+
| tokenreach/weights.toml | Official price ratios per model, with source URL and check date |
|
|
195
|
+
| examples/sample.jsonl | A small made-up session to try the report on |
|
|
196
|
+
| skills/tokenreach/SKILL.md | Lets Claude Code run the report and explain it |
|
|
197
|
+
| tests/test_tokenreach.py | Tests on small synthetic logs, and the README example |
|
|
198
|
+
| tests/test_robustness.py | Tests for malformed records, unreadable files and unexpected errors |
|
|
199
|
+
| pyproject.toml | Package, lint (ruff) and test (pytest) settings |
|
|
200
|
+
| .github/workflows/release.yml | Publishes to PyPI when a version tag is pushed (no API token stored) |
|
|
201
|
+
| LICENSE | MIT license |
|
|
202
|
+
| docs/index.html | Project page (static, no external requests) |
|
|
203
|
+
| docs/privacy.html | Privacy Policy (static, no external requests) |
|
|
204
|
+
| docs/terms.html | Terms of Service for the paid data pack |
|
|
205
|
+
| docs/llms.txt | Short plain-text summary for AI agents |
|
|
206
|
+
| docs/CNAME | Custom domain for GitHub Pages |
|
|
207
|
+
| docs/robots.txt | Tells search engines where the sitemap is |
|
|
208
|
+
| docs/sitemap.xml | List of the site pages for search engines |
|
|
209
|
+
| docs/dc96e7cdee554066069f150cc3e539f2.txt | IndexNow key file (lets the site notify search engines of changes) |
|
|
210
|
+
| docs/ja/index.html | Japanese version of the project page |
|
|
211
|
+
| .claude-plugin/plugin.json | Claude Code plugin manifest (the skill as a plugin) |
|
|
212
|
+
| .claude-plugin/marketplace.json | Lets `/plugin install` find the plugin in this repository |
|
|
213
|
+
| .gitignore | Files kept out of the repository |
|