@unravel-tech/ccusage-opencode 18.0.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/README.md ADDED
@@ -0,0 +1,123 @@
1
+ <div align="center">
2
+ <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/logo.svg" alt="ccusage logo" width="256" height="256">
3
+ <h1>@ccusage/opencode</h1>
4
+ </div>
5
+
6
+ <p align="center">
7
+ <a href="https://socket.dev/api/npm/package/@ccusage/opencode"><img src="https://socket.dev/api/badge/npm/package/@ccusage/opencode" alt="Socket Badge" /></a>
8
+ <a href="https://npmjs.com/package/@ccusage/opencode"><img src="https://img.shields.io/npm/v/@ccusage/opencode?color=yellow" alt="npm version" /></a>
9
+ <a href="https://tanstack.com/stats/npm?packageGroups=%5B%7B%22packages%22:%5B%7B%22name%22:%22@ccusage/opencode%22%7D%5D%7D%5D&range=30-days&transform=none&binType=daily&showDataMode=all&height=400"><img src="https://img.shields.io/npm/dt/@ccusage/opencode" alt="NPM Downloads" /></a>
10
+ <a href="https://packagephobia.com/result?p=@ccusage/opencode"><img src="https://packagephobia.com/badge?p=@ccusage/opencode" alt="install size" /></a>
11
+ <a href="https://deepwiki.com/ryoppippi/ccusage"><img src="https://img.shields.io/badge/DeepWiki-ryoppippi%2Fccusage-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==" alt="DeepWiki"></a>
12
+ </p>
13
+
14
+ > Analyze [OpenCode](https://github.com/opencode-ai/opencode) usage logs with the same reporting experience as <code>ccusage</code>.
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ # Recommended - always include @latest
20
+ npx @ccusage/opencode@latest --help
21
+ bunx @ccusage/opencode@latest --help
22
+
23
+ # Alternative package runners
24
+ pnpm dlx @ccusage/opencode
25
+ pnpx @ccusage/opencode
26
+
27
+ # Using deno (with security flags)
28
+ deno run -E -R=$HOME/.local/share/opencode/ -S=homedir -N='raw.githubusercontent.com:443' npm:@ccusage/opencode@latest --help
29
+ ```
30
+
31
+ ### Recommended: Shell Alias
32
+
33
+ Since `npx @ccusage/opencode@latest` is quite long to type repeatedly, we strongly recommend setting up a shell alias:
34
+
35
+ ```bash
36
+ # bash/zsh: alias ccusage-opencode='bunx @ccusage/opencode@latest'
37
+ # fish: alias ccusage-opencode 'bunx @ccusage/opencode@latest'
38
+
39
+ # Then simply run:
40
+ ccusage-opencode daily
41
+ ccusage-opencode monthly --json
42
+ ```
43
+
44
+ > 💡 The CLI looks for OpenCode usage data under `OPENCODE_DATA_DIR` (defaults to `~/.local/share/opencode`).
45
+
46
+ ## Common Commands
47
+
48
+ ```bash
49
+ # Daily usage grouped by date (default command)
50
+ npx @ccusage/opencode@latest daily
51
+
52
+ # Weekly usage grouped by ISO week
53
+ npx @ccusage/opencode@latest weekly
54
+
55
+ # Monthly usage grouped by month
56
+ npx @ccusage/opencode@latest monthly
57
+
58
+ # Session-level detailed report
59
+ npx @ccusage/opencode@latest session
60
+
61
+ # JSON output for scripting
62
+ npx @ccusage/opencode@latest daily --json
63
+
64
+ # Compact mode for screenshots/sharing
65
+ npx @ccusage/opencode@latest daily --compact
66
+ ```
67
+
68
+ Useful environment variables:
69
+
70
+ - `OPENCODE_DATA_DIR` – override the OpenCode data directory (defaults to `~/.local/share/opencode`)
71
+ - `LOG_LEVEL` – control consola log verbosity (0 silent … 5 trace)
72
+
73
+ ## Features
74
+
75
+ - 📊 **Daily Reports**: View token usage and costs aggregated by date
76
+ - 📅 **Weekly Reports**: View usage grouped by ISO week (YYYY-Www)
77
+ - 🗓️ **Monthly Reports**: View usage aggregated by month (YYYY-MM)
78
+ - 💬 **Session Reports**: View usage grouped by conversation sessions
79
+ - 📈 **Responsive Tables**: Automatic layout adjustment for terminal width
80
+ - 🤖 **Model Tracking**: See which Claude models you're using (Opus, Sonnet, Haiku, etc.)
81
+ - 💵 **Accurate Cost Calculation**: Uses LiteLLM pricing database to calculate costs from token data
82
+ - 🔄 **Cache Token Support**: Tracks and displays cache creation and cache read tokens separately
83
+ - 📄 **JSON Output**: Export data in structured JSON format with `--json`
84
+ - 📱 **Compact Mode**: Use `--compact` flag for narrow terminals, perfect for screenshots
85
+
86
+ ## Cost Calculation
87
+
88
+ OpenCode stores `cost: 0` in message files, so this CLI calculates accurate costs from token usage data using the LiteLLM pricing database. All models supported by LiteLLM will have accurate pricing.
89
+
90
+ ## Data Location
91
+
92
+ OpenCode stores usage data in:
93
+
94
+ - **Messages**: `~/.local/share/opencode/storage/message/{sessionID}/msg_{messageID}.json`
95
+ - **Sessions**: `~/.local/share/opencode/storage/session/{projectHash}/{sessionID}.json`
96
+
97
+ Each message file contains token counts (`input`, `output`, `cache.read`, `cache.write`) and model information.
98
+
99
+ ## Documentation
100
+
101
+ For detailed guides and examples, visit **[ccusage.com](https://ccusage.com/)**.
102
+
103
+ ## Sponsors
104
+
105
+ ### Featured Sponsor
106
+
107
+ Check out [ccusage: The Claude Code cost scorecard that went viral](https://www.youtube.com/watch?v=Ak6qpQ5qdgk)
108
+
109
+ <p align="center">
110
+ <a href="https://www.youtube.com/watch?v=Ak6qpQ5qdgk">
111
+ <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/ccusage_thumbnail.png" alt="ccusage: The Claude Code cost scorecard that went viral" width="600">
112
+ </a>
113
+ </p>
114
+
115
+ <p align="center">
116
+ <a href="https://github.com/sponsors/ryoppippi">
117
+ <img src="https://cdn.jsdelivr.net/gh/ryoppippi/sponsors@main/sponsors.svg">
118
+ </a>
119
+ </p>
120
+
121
+ ## License
122
+
123
+ MIT © [@ryoppippi](https://github.com/ryoppippi)