@diogonzafe/tokenwatch 0.2.1 → 0.5.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 +245 -19
- package/dist/adapters.cjs +61 -36
- package/dist/adapters.cjs.map +1 -1
- package/dist/adapters.d.cts +5 -3
- package/dist/adapters.d.ts +5 -3
- package/dist/adapters.js +61 -36
- package/dist/adapters.js.map +1 -1
- package/dist/cli.js +1240 -56
- package/dist/cli.js.map +1 -1
- package/dist/{index-B_EmA3K7.d.cts → index-CJKk1hHw.d.cts} +62 -2
- package/dist/{index-B_EmA3K7.d.ts → index-CJKk1hHw.d.ts} +62 -2
- package/dist/index.cjs +548 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +547 -64
- package/dist/index.js.map +1 -1
- package/dist/langchain.cjs +62 -0
- package/dist/langchain.cjs.map +1 -0
- package/dist/langchain.d.cts +68 -0
- package/dist/langchain.d.ts +68 -0
- package/dist/langchain.js +35 -0
- package/dist/langchain.js.map +1 -0
- package/package.json +11 -2
- package/prices.json +167 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { T as TrackerConfig, a as Tracker, b as TrackingMeta } from './index-
|
|
2
|
-
export { F as FeatureStats, I as IStorage, M as ModelPrice,
|
|
1
|
+
import { T as TrackerConfig, a as Tracker, L as LazyTracker, b as TrackingMeta } from './index-CJKk1hHw.cjs';
|
|
2
|
+
export { B as BudgetConfig, C as CostForecast, F as FeatureStats, c as ForecastOptions, I as IStorage, M as ModelPrice, d as ModelStats, P as PriceMap, e as PricesFile, R as Report, f as ReportOptions, S as SessionStats, U as UsageEntry, g as UserStats } from './index-CJKk1hHw.cjs';
|
|
3
3
|
|
|
4
4
|
declare function createTracker(config?: TrackerConfig): Tracker;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Creates a lazy tracker that acts as a silent no-op until `init()` is called.
|
|
8
|
+
*
|
|
9
|
+
* Ideal for module-level singletons where the tracker is imported before `createTracker()`
|
|
10
|
+
* can be called (e.g. Jest test environments, top-level module imports).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // tracker.ts — safe to import anywhere, even before init
|
|
14
|
+
* export const tracker = createLazyTracker()
|
|
15
|
+
*
|
|
16
|
+
* // app.ts — initialize once at startup
|
|
17
|
+
* tracker.init({ storage: 'sqlite', syncPrices: true })
|
|
18
|
+
*
|
|
19
|
+
* // test.ts — never call init() and track() becomes a silent no-op
|
|
20
|
+
*/
|
|
21
|
+
declare function createLazyTracker(): LazyTracker;
|
|
22
|
+
|
|
6
23
|
interface CompletionsLike {
|
|
7
24
|
create(params: Record<string, unknown>): Promise<unknown>;
|
|
8
25
|
}
|
|
@@ -98,4 +115,4 @@ interface GenAILike {
|
|
|
98
115
|
*/
|
|
99
116
|
declare function wrapGemini<T extends GenAILike>(client: T, tracker: Tracker): T;
|
|
100
117
|
|
|
101
|
-
export { Tracker, TrackerConfig, TrackingMeta, createTracker, wrapAnthropic, wrapOpenAI as wrapDeepSeek, wrapGemini, wrapOpenAI };
|
|
118
|
+
export { LazyTracker, Tracker, TrackerConfig, TrackingMeta, createLazyTracker, createTracker, wrapAnthropic, wrapOpenAI as wrapDeepSeek, wrapGemini, wrapOpenAI };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { T as TrackerConfig, a as Tracker, b as TrackingMeta } from './index-
|
|
2
|
-
export { F as FeatureStats, I as IStorage, M as ModelPrice,
|
|
1
|
+
import { T as TrackerConfig, a as Tracker, L as LazyTracker, b as TrackingMeta } from './index-CJKk1hHw.js';
|
|
2
|
+
export { B as BudgetConfig, C as CostForecast, F as FeatureStats, c as ForecastOptions, I as IStorage, M as ModelPrice, d as ModelStats, P as PriceMap, e as PricesFile, R as Report, f as ReportOptions, S as SessionStats, U as UsageEntry, g as UserStats } from './index-CJKk1hHw.js';
|
|
3
3
|
|
|
4
4
|
declare function createTracker(config?: TrackerConfig): Tracker;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Creates a lazy tracker that acts as a silent no-op until `init()` is called.
|
|
8
|
+
*
|
|
9
|
+
* Ideal for module-level singletons where the tracker is imported before `createTracker()`
|
|
10
|
+
* can be called (e.g. Jest test environments, top-level module imports).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // tracker.ts — safe to import anywhere, even before init
|
|
14
|
+
* export const tracker = createLazyTracker()
|
|
15
|
+
*
|
|
16
|
+
* // app.ts — initialize once at startup
|
|
17
|
+
* tracker.init({ storage: 'sqlite', syncPrices: true })
|
|
18
|
+
*
|
|
19
|
+
* // test.ts — never call init() and track() becomes a silent no-op
|
|
20
|
+
*/
|
|
21
|
+
declare function createLazyTracker(): LazyTracker;
|
|
22
|
+
|
|
6
23
|
interface CompletionsLike {
|
|
7
24
|
create(params: Record<string, unknown>): Promise<unknown>;
|
|
8
25
|
}
|
|
@@ -98,4 +115,4 @@ interface GenAILike {
|
|
|
98
115
|
*/
|
|
99
116
|
declare function wrapGemini<T extends GenAILike>(client: T, tracker: Tracker): T;
|
|
100
117
|
|
|
101
|
-
export { Tracker, TrackerConfig, TrackingMeta, createTracker, wrapAnthropic, wrapOpenAI as wrapDeepSeek, wrapGemini, wrapOpenAI };
|
|
118
|
+
export { LazyTracker, Tracker, TrackerConfig, TrackingMeta, createLazyTracker, createTracker, wrapAnthropic, wrapOpenAI as wrapDeepSeek, wrapGemini, wrapOpenAI };
|