ccusage 17.0.1 → 17.0.2
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/README.md +52 -7
- package/dist/{data-loader-ClkEoCfz.js → data-loader-WR6J7qRb.js} +1 -1
- package/dist/data-loader.js +2 -2
- package/dist/{debug-BQXAD_hV.js → debug-3XWYvoVQ.js} +2 -2
- package/dist/debug.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{logger-C_yajNg2.js → logger-BPuFhmNp.js} +1 -1
- package/dist/logger.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,20 @@
|
|
|
20
20
|
|
|
21
21
|
> Analyze your Claude Code token usage and costs from local JSONL files — incredibly fast and informative!
|
|
22
22
|
|
|
23
|
+
## ccusage Family
|
|
24
|
+
|
|
25
|
+
### 📊 [ccusage](https://www.npmjs.com/package/ccusage) - Claude Code Usage Analyzer
|
|
26
|
+
|
|
27
|
+
The main CLI tool for analyzing Claude Code usage from local JSONL files. Track daily, monthly, and session-based usage with beautiful tables and live monitoring.
|
|
28
|
+
|
|
29
|
+
### 🤖 [@ccusage/codex](https://www.npmjs.com/package/@ccusage/codex) - OpenAI Codex Usage Analyzer
|
|
30
|
+
|
|
31
|
+
Companion tool for analyzing OpenAI Codex usage. Same powerful features as ccusage but tailored for Codex users, including GPT-5 support and 1M token context windows.
|
|
32
|
+
|
|
33
|
+
### 🔌 [@ccusage/mcp](https://www.npmjs.com/package/@ccusage/mcp) - MCP Server Integration
|
|
34
|
+
|
|
35
|
+
Model Context Protocol server that exposes ccusage data to Claude Desktop and other MCP-compatible tools. Enable real-time usage tracking directly in your AI workflows.
|
|
36
|
+
|
|
23
37
|
## Installation
|
|
24
38
|
|
|
25
39
|
### Quick Start (Recommended)
|
|
@@ -27,17 +41,51 @@
|
|
|
27
41
|
Thanks to ccusage's incredibly small bundle size ([](https://packagephobia.com/result?p=ccusage)), you can run it directly without installation:
|
|
28
42
|
|
|
29
43
|
```bash
|
|
30
|
-
#
|
|
44
|
+
# Recommended - always include @latest to ensure you get the newest version
|
|
45
|
+
npx ccusage@latest
|
|
31
46
|
bunx ccusage
|
|
32
47
|
|
|
33
|
-
#
|
|
34
|
-
|
|
48
|
+
# Alternative package runners
|
|
49
|
+
pnpm dlx ccusage
|
|
50
|
+
pnpx ccusage
|
|
35
51
|
|
|
36
52
|
# Using deno (with security flags)
|
|
37
53
|
deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest
|
|
38
54
|
```
|
|
39
55
|
|
|
40
|
-
> 💡 **
|
|
56
|
+
> 💡 **Important**: We strongly recommend using `@latest` suffix with npx (e.g., `npx ccusage@latest`) to ensure you're running the most recent version with the latest features and bug fixes.
|
|
57
|
+
|
|
58
|
+
### Related Tools
|
|
59
|
+
|
|
60
|
+
#### Codex CLI
|
|
61
|
+
|
|
62
|
+
Analyze OpenAI Codex usage with our companion tool [@ccusage/codex](https://www.npmjs.com/package/@ccusage/codex):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Recommended - always include @latest
|
|
66
|
+
npx @ccusage/codex@latest
|
|
67
|
+
bunx @ccusage/codex@latest # ⚠️ MUST include @latest with bunx
|
|
68
|
+
|
|
69
|
+
# Alternative package runners
|
|
70
|
+
pnpm dlx @ccusage/codex
|
|
71
|
+
pnpx @ccusage/codex
|
|
72
|
+
|
|
73
|
+
# Using deno (with security flags)
|
|
74
|
+
deno run -E -R=$HOME/.codex/ -S=homedir -N='raw.githubusercontent.com:443' npm:@ccusage/codex@latest
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> ⚠️ **Critical for bunx users**: Bun 1.2.x's bunx prioritizes binaries matching the package name suffix when given a scoped package. For `@ccusage/codex`, it looks for a `codex` binary in PATH first. If you have an existing `codex` command installed (e.g., GitHub Copilot's codex), that will be executed instead. **Always use `bunx @ccusage/codex@latest` with the version tag** to force bunx to fetch and run the correct package.
|
|
78
|
+
|
|
79
|
+
#### MCP Server
|
|
80
|
+
|
|
81
|
+
Integrate ccusage with Claude Desktop using [@ccusage/mcp](https://www.npmjs.com/package/@ccusage/mcp):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Start MCP server for Claude Desktop integration
|
|
85
|
+
npx @ccusage/mcp@latest --type http --port 8080
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This enables real-time usage tracking and analysis directly within Claude Desktop conversations.
|
|
41
89
|
|
|
42
90
|
## Usage
|
|
43
91
|
|
|
@@ -68,9 +116,6 @@ npx ccusage daily --instances --project myproject --json # Combined usage
|
|
|
68
116
|
# Compact mode for screenshots/sharing
|
|
69
117
|
npx ccusage --compact # Force compact table mode
|
|
70
118
|
npx ccusage monthly --compact # Compact monthly report
|
|
71
|
-
|
|
72
|
-
# MCP Server (Model Context Protocol)
|
|
73
|
-
npx @ccusage/mcp@latest # Run MCP server for Claude Desktop integration
|
|
74
119
|
```
|
|
75
120
|
|
|
76
121
|
## Features
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { activityDateSchema, array, boolean, createBucket, createDailyDate, createMonthlyDate, createProjectPath, createSessionId, createWeeklyDate, dailyDateSchema, getTotalTokens, isoTimestampSchema, messageIdSchema, modelNameSchema, monthlyDateSchema, number, object, optional, parse as parse$2, projectPathSchema, requestIdSchema, safeParse, sessionIdSchema, string, union, versionSchema, weeklyDateSchema } from "./_types-CV6z8-9_.js";
|
|
2
|
-
import { logger } from "./logger-
|
|
2
|
+
import { logger } from "./logger-BPuFhmNp.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import a, { readFile, stat } from "node:fs/promises";
|
|
5
5
|
import path, { basename, dirname, normalize, posix, relative, resolve, sep } from "node:path";
|
package/dist/data-loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema } from "./data-loader-
|
|
1
|
+
import { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema } from "./data-loader-WR6J7qRb.js";
|
|
2
2
|
import "./_types-CV6z8-9_.js";
|
|
3
|
-
import "./logger-
|
|
3
|
+
import "./logger-BPuFhmNp.js";
|
|
4
4
|
export { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, _usingCtx, getClaudePaths, glob, isFailure, try_, unwrap, usageDataSchema } from "./data-loader-
|
|
1
|
+
import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, _usingCtx, getClaudePaths, glob, isFailure, try_, unwrap, usageDataSchema } from "./data-loader-WR6J7qRb.js";
|
|
2
2
|
import { safeParse } from "./_types-CV6z8-9_.js";
|
|
3
|
-
import { logger } from "./logger-
|
|
3
|
+
import { logger } from "./logger-BPuFhmNp.js";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
async function detectMismatches(claudePath) {
|
package/dist/debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./data-loader-
|
|
1
|
+
import "./data-loader-WR6J7qRb.js";
|
|
2
2
|
import "./_types-CV6z8-9_.js";
|
|
3
|
-
import "./logger-
|
|
4
|
-
import { detectMismatches, printMismatchReport } from "./debug-
|
|
3
|
+
import "./logger-BPuFhmNp.js";
|
|
4
|
+
import { detectMismatches, printMismatchReport } from "./debug-3XWYvoVQ.js";
|
|
5
5
|
export { detectMismatches, printMismatchReport };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, CONFIG_FILE_NAME, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_LOCALE, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, DEFAULT_SESSION_DURATION_HOURS, MAX_REFRESH_INTERVAL_SECONDS, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PricingFetcher, WEEK_DAYS, __commonJSMin, __require, __toESM, _usingCtx, andThen, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, fail, filterRecentBlocks, formatDateCompact, getClaudePaths, getEarliestTimestamp, getFileModifiedTime, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, inspect, inspectError, isFailure, isSuccess, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, map as map$2, pipe, projectBlockUsage, sortFilesByTimestamp, succeed, toArray, try_, uniq, unreachable, unwrap, usageDataSchema } from "./data-loader-
|
|
2
|
+
import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, CONFIG_FILE_NAME, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_LOCALE, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, DEFAULT_SESSION_DURATION_HOURS, MAX_REFRESH_INTERVAL_SECONDS, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PricingFetcher, WEEK_DAYS, __commonJSMin, __require, __toESM, _usingCtx, andThen, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, fail, filterRecentBlocks, formatDateCompact, getClaudePaths, getEarliestTimestamp, getFileModifiedTime, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, inspect, inspectError, isFailure, isSuccess, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, map as map$2, pipe, projectBlockUsage, sortFilesByTimestamp, succeed, toArray, try_, uniq, unreachable, unwrap, usageDataSchema } from "./data-loader-WR6J7qRb.js";
|
|
3
3
|
import { CostModes, SortOrders, check, filterDateSchema, flatten, getTotalTokens, integer as integer$1, maxValue, minValue, number, parse as parse$1, pipe as pipe$1, safeParse, statuslineHookJsonSchema, string, transform, trim, union } from "./_types-CV6z8-9_.js";
|
|
4
4
|
import { calculateTotals, createTotalsObject } from "./calculate-cost-CX9KwEZt.js";
|
|
5
|
-
import { description, log, logger, name, version } from "./logger-
|
|
6
|
-
import { detectMismatches, printMismatchReport } from "./debug-
|
|
5
|
+
import { description, log, logger, name, version } from "./logger-BPuFhmNp.js";
|
|
6
|
+
import { detectMismatches, printMismatchReport } from "./debug-3XWYvoVQ.js";
|
|
7
7
|
import a, { readFile, stat } from "node:fs/promises";
|
|
8
8
|
import path, { join } from "node:path";
|
|
9
9
|
import process$1 from "node:process";
|
|
@@ -869,7 +869,7 @@ function createLogger(name$1) {
|
|
|
869
869
|
}
|
|
870
870
|
const log = console.log;
|
|
871
871
|
var name = "ccusage";
|
|
872
|
-
var version = "17.0.
|
|
872
|
+
var version = "17.0.2";
|
|
873
873
|
var description = "Usage analysis tool for Claude Code";
|
|
874
874
|
const logger = createLogger(name);
|
|
875
875
|
const log$1 = log;
|
package/dist/logger.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { log, logger } from "./logger-
|
|
1
|
+
import { log, logger } from "./logger-BPuFhmNp.js";
|
|
2
2
|
export { log, logger };
|