@ccusage/codex 0.0.1 → 17.0.1
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 +77 -29
- package/dist/index.js +7792 -0
- package/dist/prompt-C-goQ9sU.js +845 -0
- package/package.json +25 -8
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
|
@@ -1,45 +1,93 @@
|
|
|
1
|
-
|
|
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/codex</h1>
|
|
4
|
+
</div>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://socket.dev/api/npm/package/@ccusage/codex"><img src="https://socket.dev/api/badge/npm/package/@ccusage/codex" alt="Socket Badge" /></a>
|
|
8
|
+
<a href="https://npmjs.com/package/@ccusage/codex"><img src="https://img.shields.io/npm/v/@ccusage/codex?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/codex%22%7D%5D%7D%5D&range=30-days&transform=none&binType=daily&showDataMode=all&height=400"><img src="https://img.shields.io/npm/dy/@ccusage/codex" alt="NPM Downloads" /></a>
|
|
10
|
+
<a href="https://packagephobia.com/result?p=@ccusage/codex"><img src="https://packagephobia.com/badge?p=@ccusage/codex" 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>
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
<div align="center">
|
|
15
|
+
<img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/codex-cli.jpeg" alt="Codex CLI usage screenshot" width="640">
|
|
16
|
+
</div>
|
|
6
17
|
|
|
7
|
-
|
|
18
|
+
> Analyze <a href="https://github.com/openai/codex">OpenAI Codex CLI</a> usage logs with the same reporting experience as <code>ccusage</code>.
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
> ⚠️ <strong>Beta:</strong> The Codex CLI support is experimental. Expect breaking changes until the upstream Codex tooling stabilizes.
|
|
10
21
|
|
|
11
|
-
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@ccusage/codex`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
22
|
+
## Quick Start
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
```bash
|
|
25
|
+
# Recommended (fastest)
|
|
26
|
+
bunx @ccusage/codex --help
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
# Using npx
|
|
29
|
+
npx @ccusage/codex@latest --help
|
|
30
|
+
```
|
|
19
31
|
|
|
20
|
-
|
|
32
|
+
> 💡 The CLI looks for Codex session JSONL files under `CODEX_HOME` (defaults to `~/.codex`).
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
## Common Commands
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
36
|
+
```bash
|
|
37
|
+
# Daily usage grouped by date (default command)
|
|
38
|
+
bunx @ccusage/codex daily
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
# Date range filtering
|
|
41
|
+
bunx @ccusage/codex daily --since 20250911 --until 20250917
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
43
|
+
# JSON output for scripting
|
|
44
|
+
bunx @ccusage/codex daily --json
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
# Monthly usage grouped by month
|
|
47
|
+
bunx @ccusage/codex monthly
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
# Monthly JSON report for integrations
|
|
50
|
+
bunx @ccusage/codex monthly --json
|
|
51
|
+
```
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
Useful environment variables:
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
- `CODEX_HOME` – override the root directory that contains Codex session folders
|
|
56
|
+
- `LOG_LEVEL` – controla consola log verbosity (0 silent … 5 trace)
|
|
57
|
+
|
|
58
|
+
ℹ️ The CLI now relies on the model metadata recorded in each `turn_context`. Sessions emitted during early September 2025 that lack this metadata are skipped to avoid mispricing. Newer builds of the Codex CLI restore the model field, and aliases such as `gpt-5-codex` automatically resolve to the correct LiteLLM pricing entry.
|
|
59
|
+
📦 For legacy JSONL files that never emitted `turn_context` metadata, the CLI falls back to treating the tokens as `gpt-5` so that usage still appears in reports (pricing is therefore approximate for those sessions). In JSON output you will also see `"isFallback": true` on those model entries.
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
- 📊 Responsive terminal tables shared with the `ccusage` CLI
|
|
64
|
+
- 💵 Offline-first pricing cache with automatic LiteLLM refresh when needed
|
|
65
|
+
- 🤖 Per-model token and cost aggregation, including cached token accounting
|
|
66
|
+
- 📅 Daily and monthly rollups with identical CLI options
|
|
67
|
+
- 📄 JSON output for further processing or scripting
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
For detailed guides and examples, visit **[ccusage.com/guide/codex](https://ccusage.com/guide/codex/)**.
|
|
72
|
+
|
|
73
|
+
## Sponsors
|
|
74
|
+
|
|
75
|
+
### Featured Sponsor
|
|
76
|
+
|
|
77
|
+
Check out [ccusage: The Claude Code cost scorecard that went viral](https://www.youtube.com/watch?v=Ak6qpQ5qdgk)
|
|
78
|
+
|
|
79
|
+
<p align="center">
|
|
80
|
+
<a href="https://www.youtube.com/watch?v=Ak6qpQ5qdgk">
|
|
81
|
+
<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">
|
|
82
|
+
</a>
|
|
83
|
+
</p>
|
|
84
|
+
|
|
85
|
+
<p align="center">
|
|
86
|
+
<a href="https://github.com/sponsors/ryoppippi">
|
|
87
|
+
<img src="https://cdn.jsdelivr.net/gh/ryoppippi/sponsors@main/sponsors.svg">
|
|
88
|
+
</a>
|
|
89
|
+
</p>
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT © [@ryoppippi](https://github.com/ryoppippi)
|