opencode-usage 0.3.1 → 0.4.0
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 +5 -5
- package/dist/cli.d.ts +2 -4
- package/dist/codex-client.d.ts +6 -2
- package/dist/config-commands.d.ts +0 -4
- package/dist/config.d.ts +0 -8
- package/dist/dashboard-solid.d.ts +0 -1
- package/dist/dashboard.d.ts +0 -1
- package/dist/index.d.ts +4 -7
- package/dist/index.js +148 -294
- package/dist/index.js.map +10 -10
- package/dist/loader.d.ts +0 -7
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,13 +87,13 @@ opencode-usage --provider anthropic --since 7d --json
|
|
|
87
87
|
|
|
88
88
|
## How It Works
|
|
89
89
|
|
|
90
|
-
This tool reads OpenCode session data from:
|
|
90
|
+
This tool reads OpenCode session data from the SQLite database (`opencode.db`):
|
|
91
91
|
|
|
92
|
-
- Linux: `~/.local/share/opencode/
|
|
93
|
-
- macOS: `~/.local/share/opencode/
|
|
94
|
-
- Windows: `%LOCALAPPDATA%/opencode/
|
|
92
|
+
- Linux: `~/.local/share/opencode/opencode.db`
|
|
93
|
+
- macOS: `~/.local/share/opencode/opencode.db`
|
|
94
|
+
- Windows: `%LOCALAPPDATA%/opencode/opencode.db`
|
|
95
95
|
|
|
96
|
-
It aggregates token usage by day and calculates estimated costs based on current API pricing.
|
|
96
|
+
Requires OpenCode v1.2.0+ (SQLite storage). It aggregates token usage by day and calculates estimated costs based on current API pricing.
|
|
97
97
|
|
|
98
98
|
## Note on Costs
|
|
99
99
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -9,9 +9,7 @@ export type CliArgs = {
|
|
|
9
9
|
json?: boolean;
|
|
10
10
|
monthly?: boolean;
|
|
11
11
|
watch?: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
config?: "set-codex-token" | "show";
|
|
15
|
-
configToken?: string;
|
|
12
|
+
stats?: boolean;
|
|
13
|
+
config?: "show";
|
|
16
14
|
};
|
|
17
15
|
export declare function parseArgs(): CliArgs;
|
package/dist/codex-client.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { QuotaSnapshot } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
3
|
+
* Resolve Codex token: explicit override > ~/.codex/auth.json auto-read
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveCodexToken(explicitToken?: string): Promise<string | undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* Fetch Codex usage quota from ChatGPT API.
|
|
8
|
+
* Auto-reads token from ~/.codex/auth.json if not provided explicitly.
|
|
5
9
|
*/
|
|
6
10
|
export declare function loadCodexQuota(token?: string): Promise<QuotaSnapshot[]>;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration file loader for opencode-usage
|
|
3
|
-
*/
|
|
4
|
-
export type Config = {
|
|
5
|
-
codexToken?: string;
|
|
6
|
-
};
|
|
7
1
|
export declare function getConfigPath(): string;
|
|
8
|
-
export declare function loadConfig(): Promise<Config>;
|
|
9
|
-
export declare function saveConfig(config: Config): Promise<void>;
|
package/dist/dashboard.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
* OpenCode Usage - CLI tool for tracking OpenCode AI usage and costs
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* bunx opencode-usage
|
|
7
|
-
* bunx opencode-usage --
|
|
8
|
-
* bunx opencode-usage --
|
|
9
|
-
* bunx opencode-usage --
|
|
10
|
-
* bunx opencode-usage --monthly --json
|
|
11
|
-
* bunx opencode-usage --watch
|
|
12
|
-
* bunx opencode-usage --dashboard
|
|
6
|
+
* bunx opencode-usage (dashboard, default)
|
|
7
|
+
* bunx opencode-usage --stats (table mode)
|
|
8
|
+
* bunx opencode-usage --stats -d 30
|
|
9
|
+
* bunx opencode-usage --stats --monthly --json
|
|
13
10
|
*/
|
|
14
11
|
export {};
|