ccusage 0.1.3 → 0.1.5
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.
- package/LICENSE +21 -0
- package/README.md +11 -2
- package/dist/index.js +15 -11
- package/docs/screenshot.png +0 -0
- package/package.json +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ryoppippi
|
|
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
|
@@ -12,6 +12,12 @@ A CLI tool for analyzing Claude Code usage from local JSONL files.
|
|
|
12
12
|
|
|
13
13
|
Inspired by [this article](https://note.com/milliondev/n/n1d018da2d769) about tracking Claude Code usage costs.
|
|
14
14
|
|
|
15
|
+
## Motivation
|
|
16
|
+
|
|
17
|
+
Claude Code's Max plan offers unlimited usage - but wouldn't it be interesting to know how much you'd be paying if you were on a pay-per-use plan?
|
|
18
|
+
|
|
19
|
+
This tool helps you understand the value you're getting from your subscription by calculating the equivalent costs of your actual usage. See how much you're saving and enjoy that satisfying feeling of getting great value! 😊
|
|
20
|
+
|
|
15
21
|
## Features
|
|
16
22
|
|
|
17
23
|
- 📊 **Daily Report**: View token usage and costs aggregated by date
|
|
@@ -30,10 +36,10 @@ Run directly without installation:
|
|
|
30
36
|
|
|
31
37
|
```bash
|
|
32
38
|
# Using npx
|
|
33
|
-
npx ccusage@latest
|
|
39
|
+
npx ccusage@latest
|
|
34
40
|
|
|
35
41
|
# Using bunx
|
|
36
|
-
bunx ccusage
|
|
42
|
+
bunx ccusage
|
|
37
43
|
```
|
|
38
44
|
|
|
39
45
|
### Local Installation
|
|
@@ -72,6 +78,7 @@ Shows token usage and costs aggregated by date:
|
|
|
72
78
|
```bash
|
|
73
79
|
# Show all daily usage
|
|
74
80
|
ccusage daily
|
|
81
|
+
# or: ccusage
|
|
75
82
|
# or: npx ccusage@latest daily
|
|
76
83
|
# or: bunx ccusage daily
|
|
77
84
|
|
|
@@ -85,6 +92,8 @@ ccusage daily --path /custom/path/to/.claude
|
|
|
85
92
|
ccusage daily --json
|
|
86
93
|
```
|
|
87
94
|
|
|
95
|
+
`ccusage` is an alias for `ccusage daily`, so you can run it without specifying the subcommand.
|
|
96
|
+
|
|
88
97
|
### Session Report
|
|
89
98
|
|
|
90
99
|
Shows usage grouped by conversation sessions, sorted by cost:
|
package/dist/index.js
CHANGED
|
@@ -5754,10 +5754,9 @@ const SessionUsageSchema = object({
|
|
|
5754
5754
|
});
|
|
5755
5755
|
const formatDate = (dateStr) => {
|
|
5756
5756
|
const date = new Date(dateStr);
|
|
5757
|
-
const
|
|
5758
|
-
const
|
|
5759
|
-
const
|
|
5760
|
-
const day = String(offsetDate.getUTCDate()).padStart(2, "0");
|
|
5757
|
+
const year = date.getFullYear();
|
|
5758
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
5759
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
5761
5760
|
return `${year}-${month}-${day}`;
|
|
5762
5761
|
};
|
|
5763
5762
|
async function loadUsageData(options) {
|
|
@@ -6817,7 +6816,7 @@ const consola = createConsola();
|
|
|
6817
6816
|
//#endregion
|
|
6818
6817
|
//#region package.json
|
|
6819
6818
|
var name = "ccusage";
|
|
6820
|
-
var version = "0.1.
|
|
6819
|
+
var version = "0.1.5";
|
|
6821
6820
|
var description = "Usage analysis tool for Claude Code";
|
|
6822
6821
|
|
|
6823
6822
|
//#endregion
|
|
@@ -6985,7 +6984,7 @@ const sessionCommand = define({
|
|
|
6985
6984
|
if (sessionData.length === 0) {
|
|
6986
6985
|
if (ctx.values.json) log(JSON.stringify([]));
|
|
6987
6986
|
else logger.warn("No Claude usage data found.");
|
|
6988
|
-
process.exit(0);
|
|
6987
|
+
process$1.exit(0);
|
|
6989
6988
|
}
|
|
6990
6989
|
const totals = sessionData.reduce((acc, data) => ({
|
|
6991
6990
|
inputTokens: acc.inputTokens + data.inputTokens,
|
|
@@ -7019,7 +7018,8 @@ const sessionCommand = define({
|
|
|
7019
7018
|
logger.box("Claude Code Token Usage Report - By Session");
|
|
7020
7019
|
const table = new import_cli_table3.default({
|
|
7021
7020
|
head: [
|
|
7022
|
-
"Project
|
|
7021
|
+
"Project",
|
|
7022
|
+
"Session",
|
|
7023
7023
|
"Input Tokens",
|
|
7024
7024
|
"Output Tokens",
|
|
7025
7025
|
"Total Tokens",
|
|
@@ -7028,6 +7028,7 @@ const sessionCommand = define({
|
|
|
7028
7028
|
],
|
|
7029
7029
|
style: { head: ["cyan"] },
|
|
7030
7030
|
colAligns: [
|
|
7031
|
+
"left",
|
|
7031
7032
|
"left",
|
|
7032
7033
|
"right",
|
|
7033
7034
|
"right",
|
|
@@ -7037,10 +7038,11 @@ const sessionCommand = define({
|
|
|
7037
7038
|
]
|
|
7038
7039
|
});
|
|
7039
7040
|
for (const data of sessionData) {
|
|
7040
|
-
const projectDisplay = data.projectPath.length >
|
|
7041
|
-
const sessionDisplay = data.sessionId.length >
|
|
7041
|
+
const projectDisplay = data.projectPath.length > 20 ? `...${data.projectPath.slice(-17)}` : data.projectPath;
|
|
7042
|
+
const sessionDisplay = data.sessionId.length > 30 ? `...${data.sessionId.slice(-27)}` : data.sessionId;
|
|
7042
7043
|
table.push([
|
|
7043
|
-
|
|
7044
|
+
projectDisplay,
|
|
7045
|
+
sessionDisplay,
|
|
7044
7046
|
formatNumber(data.inputTokens),
|
|
7045
7047
|
formatNumber(data.outputTokens),
|
|
7046
7048
|
formatNumber(data.inputTokens + data.outputTokens),
|
|
@@ -7049,7 +7051,8 @@ const sessionCommand = define({
|
|
|
7049
7051
|
]);
|
|
7050
7052
|
}
|
|
7051
7053
|
table.push([
|
|
7052
|
-
"─".repeat(
|
|
7054
|
+
"─".repeat(20),
|
|
7055
|
+
"─".repeat(30),
|
|
7053
7056
|
"─".repeat(12),
|
|
7054
7057
|
"─".repeat(12),
|
|
7055
7058
|
"─".repeat(12),
|
|
@@ -7058,6 +7061,7 @@ const sessionCommand = define({
|
|
|
7058
7061
|
]);
|
|
7059
7062
|
table.push([
|
|
7060
7063
|
import_picocolors.default.yellow("Total"),
|
|
7064
|
+
"",
|
|
7061
7065
|
import_picocolors.default.yellow(formatNumber(totals.inputTokens)),
|
|
7062
7066
|
import_picocolors.default.yellow(formatNumber(totals.outputTokens)),
|
|
7063
7067
|
import_picocolors.default.yellow(formatNumber(totals.inputTokens + totals.outputTokens)),
|
package/docs/screenshot.png
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccusage",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Usage analysis tool for Claude Code",
|
|
5
|
+
"homepage": "https://github.com/ryoppippi/ccusage#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ryoppippi/ccusage/issues"
|
|
8
|
+
},
|
|
7
9
|
"repository": {
|
|
8
10
|
"type": "git",
|
|
9
11
|
"url": "git+https://github.com/ryoppippi/ccusage.git"
|
|
10
12
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"homepage": "https://github.com/ryoppippi/ccusage#readme",
|
|
15
|
-
"bin": "./dist/index.js",
|
|
16
|
-
"description": "Usage analysis tool for Claude Code",
|
|
13
|
+
"funding": "https://github.com/ryoppippi/ccusage?sponsor=1",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "ryoppippi <ryoppippi.el@gmail.com> (https://github.com/ryoppippi)",
|
|
17
16
|
"type": "module",
|
|
17
|
+
"bin": "./dist/index.js",
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
20
|
"docs"
|