@leo000001/opencode-quota-sidebar 4.0.9 → 4.0.12
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 +504 -446
- package/README.zh-CN.md +516 -458
- package/dist/cli.d.ts +31 -0
- package/dist/cli.js +123 -46
- package/dist/cli_render.d.ts +4 -4
- package/dist/cli_render.js +74 -74
- package/dist/cost.d.ts +21 -4
- package/dist/cost.js +493 -264
- package/dist/format.d.ts +5 -5
- package/dist/format.js +288 -287
- package/dist/history_usage.d.ts +15 -9
- package/dist/history_usage.js +28 -22
- package/dist/index.js +15 -1
- package/dist/models_dev_pricing.d.ts +6 -0
- package/dist/models_dev_pricing.js +226 -0
- package/dist/opencode_pricing.d.ts +14 -0
- package/dist/opencode_pricing.js +273 -0
- package/dist/storage.d.ts +3 -3
- package/dist/storage.js +27 -28
- package/dist/storage_parse.d.ts +1 -1
- package/dist/storage_parse.js +51 -45
- package/dist/storage_paths.d.ts +1 -0
- package/dist/storage_paths.js +26 -11
- package/dist/title_apply.d.ts +1 -17
- package/dist/title_apply.js +17 -48
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +29 -15
- package/dist/tui.d.ts +1 -1
- package/dist/tui.tsx +481 -471
- package/dist/tui_helpers.d.ts +5 -3
- package/dist/tui_helpers.js +62 -34
- package/dist/types.d.ts +8 -10
- package/dist/usage.d.ts +9 -6
- package/dist/usage.js +27 -21
- package/dist/usage_service.d.ts +8 -7
- package/dist/usage_service.js +261 -150
- package/package.json +1 -1
package/dist/cost.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AssistantMessage } from
|
|
2
|
-
import type {
|
|
1
|
+
import type { AssistantMessage } from "@opencode-ai/sdk";
|
|
2
|
+
import type { OpenCodePricingModel } from "./opencode_pricing.js";
|
|
3
|
+
import type { CacheCoverageMode } from "./types.js";
|
|
3
4
|
export declare const API_COST_ENABLED_PROVIDERS: Set<string>;
|
|
4
|
-
export
|
|
5
|
+
export declare const API_COST_RULES_VERSION = 2;
|
|
6
|
+
export type CanonicalPriceSource = "official-doc" | "runtime";
|
|
5
7
|
export declare function canonicalPricingProviderID(providerID: string): string;
|
|
6
8
|
export declare function canonicalApiCostProviderID(providerID: string): string;
|
|
7
9
|
export type ModelCostRates = {
|
|
@@ -26,6 +28,21 @@ export type CanonicalPriceEntry = {
|
|
|
26
28
|
};
|
|
27
29
|
export declare function modelCostKey(providerID: string, modelID: string): string;
|
|
28
30
|
export declare function modelCostLookupKeys(providerID: string, modelID: string): string[];
|
|
31
|
+
export declare function derivedTierBaseModelID(model: OpenCodePricingModel): string | undefined;
|
|
32
|
+
export declare function explicitModelCostMap(models: OpenCodePricingModel[]): Record<string, ModelCostRates>;
|
|
33
|
+
export declare function applyDerivedTierRatesFromSource(baseMap: Record<string, ModelCostRates>, metadataModels: OpenCodePricingModel[], sourceRates: Record<string, ModelCostRates>, options?: {
|
|
34
|
+
skipExplicitRates?: Record<string, ModelCostRates>;
|
|
35
|
+
}): {
|
|
36
|
+
[x: string]: ModelCostRates;
|
|
37
|
+
};
|
|
38
|
+
export declare function applyExplicitRatesFromSource(baseMap: Record<string, ModelCostRates>, metadataModels: OpenCodePricingModel[], sourceRates: Record<string, ModelCostRates>, options?: {
|
|
39
|
+
skipExplicitRates?: Record<string, ModelCostRates>;
|
|
40
|
+
}): {
|
|
41
|
+
[x: string]: ModelCostRates;
|
|
42
|
+
};
|
|
43
|
+
export declare function mergeModelCostSource(baseMap: Record<string, ModelCostRates>, models: OpenCodePricingModel[]): {
|
|
44
|
+
[x: string]: ModelCostRates;
|
|
45
|
+
};
|
|
29
46
|
export declare function getBundledModelCostMap(): {
|
|
30
47
|
[x: string]: ModelCostRates;
|
|
31
48
|
};
|
|
@@ -48,7 +65,7 @@ export declare function getBundledCanonicalPriceEntries(): {
|
|
|
48
65
|
sourceURL?: string;
|
|
49
66
|
updatedAt?: string;
|
|
50
67
|
}[];
|
|
68
|
+
export declare function normalizeModelCostRates(rates: ModelCostRates): ModelCostRates;
|
|
51
69
|
export declare function parseModelCostRates(value: unknown): ModelCostRates | undefined;
|
|
52
|
-
export declare function guessModelCostDivisor(rates: ModelCostRates): 1 | 1000000;
|
|
53
70
|
export declare function cacheCoverageModeFromRates(rates: ModelCostRates | undefined): CacheCoverageMode;
|
|
54
71
|
export declare function calcEquivalentApiCostForMessage(message: AssistantMessage, rates: ModelCostRates): number;
|