ccusage 18.0.9 → 18.0.11
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/dist/{_types-BFL_bTNX.js → _types-DY3gqCWm.js} +21 -1
- package/dist/{calculate-cost-CKH-OC_c.js → calculate-cost-DWGfKMSD.js} +1 -1
- package/dist/calculate-cost.d.ts +1 -1
- package/dist/calculate-cost.js +2 -2
- package/dist/{data-loader-sVkn4Ind.js → data-loader-9ESMosno.js} +55 -99
- package/dist/{data-loader-BRnqe1-8.d.ts → data-loader-CdGrTB0Q.d.ts} +61 -0
- package/dist/data-loader.d.ts +1 -1
- package/dist/data-loader.js +3 -3
- package/dist/{debug-Cf-lkCu_.js → debug-DvI5DUKR.js} +3 -3
- package/dist/debug.js +4 -4
- package/dist/index.js +5 -5
- package/dist/{logger-BjbQOSox.js → logger-D9FuoYJ7.js} +1 -1
- package/dist/logger.js +1 -1
- package/package.json +1 -1
|
@@ -431,6 +431,26 @@ function optional(wrapped, default_) {
|
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
/* @__NO_SIDE_EFFECTS__ */
|
|
434
|
+
function picklist(options, message2) {
|
|
435
|
+
return {
|
|
436
|
+
kind: "schema",
|
|
437
|
+
type: "picklist",
|
|
438
|
+
reference: picklist,
|
|
439
|
+
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
440
|
+
async: false,
|
|
441
|
+
options,
|
|
442
|
+
message: message2,
|
|
443
|
+
get "~standard"() {
|
|
444
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
445
|
+
},
|
|
446
|
+
"~run"(dataset, config2) {
|
|
447
|
+
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
448
|
+
else _addIssue(this, "type", dataset, config2);
|
|
449
|
+
return dataset;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
434
454
|
function string(message2) {
|
|
435
455
|
return {
|
|
436
456
|
kind: "schema",
|
|
@@ -585,4 +605,4 @@ const statuslineHookJsonSchema = /* @__PURE__ */ object({
|
|
|
585
605
|
context_window_size: /* @__PURE__ */ number()
|
|
586
606
|
}))
|
|
587
607
|
});
|
|
588
|
-
export { object as A, boolean as C, maxValue as D, integer as E,
|
|
608
|
+
export { object as A, getTotalTokens as B, boolean as C, maxValue as D, integer as E, safeParse as F, string as I, transform as L, parse as M, picklist as N, minValue as O, pipe as P, trim as R, array as S, flatten as T, requestIdSchema as _, createDailyDate as a, versionSchema as b, createSessionId as c, filterDateSchema as d, isoTimestampSchema as f, projectPathSchema as g, monthlyDateSchema as h, createBucket as i, optional as j, number as k, createWeeklyDate as l, modelNameSchema as m, SortOrders as n, createMonthlyDate as o, messageIdSchema as p, activityDateSchema as r, createProjectPath as s, CostModes as t, dailyDateSchema as u, sessionIdSchema as v, check as w, weeklyDateSchema as x, statuslineHookJsonSchema as y, union as z };
|
package/dist/calculate-cost.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as SessionUsage, n as DailyUsage, s as MonthlyUsage, u as WeeklyUsage } from "./data-loader-
|
|
1
|
+
import { c as SessionUsage, n as DailyUsage, s as MonthlyUsage, u as WeeklyUsage } from "./data-loader-CdGrTB0Q.js";
|
|
2
2
|
|
|
3
3
|
//#region src/_token-utils.d.ts
|
|
4
4
|
|
package/dist/calculate-cost.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createTotalsObject, t as calculateTotals } from "./calculate-cost-
|
|
1
|
+
import { B as getTotalTokens } from "./_types-DY3gqCWm.js";
|
|
2
|
+
import { n as createTotalsObject, t as calculateTotals } from "./calculate-cost-DWGfKMSD.js";
|
|
3
3
|
export { calculateTotals, createTotalsObject, getTotalTokens };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as object, C as boolean, F as string, M as parse$2,
|
|
2
|
-
import { n as logger } from "./logger-
|
|
1
|
+
import { A as object, B as getTotalTokens, C as boolean, F as safeParse, I as string, M as parse$2, N as picklist, S as array, _ as requestIdSchema, a as createDailyDate, b as versionSchema, c as createSessionId, f as isoTimestampSchema, g as projectPathSchema, h as monthlyDateSchema, i as createBucket, j as optional, k as number, l as createWeeklyDate, m as modelNameSchema, o as createMonthlyDate, p as messageIdSchema, r as activityDateSchema, s as createProjectPath, u as dailyDateSchema, v as sessionIdSchema, x as weeklyDateSchema, z as union } from "./_types-DY3gqCWm.js";
|
|
2
|
+
import { n as logger } from "./logger-D9FuoYJ7.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as nativeFs from "node:fs";
|
|
5
5
|
import b, { createReadStream } from "node:fs";
|
|
@@ -4622,7 +4622,8 @@ const liteLLMModelPricingSchema = object({
|
|
|
4622
4622
|
cache_creation_input_token_cost_above_200k_tokens: optional(number()),
|
|
4623
4623
|
cache_read_input_token_cost_above_200k_tokens: optional(number()),
|
|
4624
4624
|
input_cost_per_token_above_128k_tokens: optional(number()),
|
|
4625
|
-
output_cost_per_token_above_128k_tokens: optional(number())
|
|
4625
|
+
output_cost_per_token_above_128k_tokens: optional(number()),
|
|
4626
|
+
provider_specific_entry: optional(object({ fast: optional(number()) }))
|
|
4626
4627
|
});
|
|
4627
4628
|
const DEFAULT_PROVIDER_PREFIXES = [
|
|
4628
4629
|
"anthropic/",
|
|
@@ -4753,11 +4754,11 @@ var LiteLLMPricingFetcher = class {
|
|
|
4753
4754
|
const cacheReadCost = calculateTieredCost(tokens.cache_read_input_tokens, pricing.cache_read_input_token_cost, pricing.cache_read_input_token_cost_above_200k_tokens);
|
|
4754
4755
|
return inputCost + outputCost + cacheCreationCost + cacheReadCost;
|
|
4755
4756
|
}
|
|
4756
|
-
async calculateCostFromTokens(tokens, modelName) {
|
|
4757
|
+
async calculateCostFromTokens(tokens, modelName, options) {
|
|
4757
4758
|
if (modelName == null || modelName === "") return succeed(0);
|
|
4758
4759
|
return pipe(this.getModelPricing(modelName), andThen((pricing) => {
|
|
4759
4760
|
if (pricing == null) return fail(/* @__PURE__ */ new Error(`Model pricing not found for ${modelName}`));
|
|
4760
|
-
return succeed(this.calculateCostFromPricing(tokens, pricing));
|
|
4761
|
+
return succeed(this.calculateCostFromPricing(tokens, pricing) * (options?.speed === "fast" ? pricing.provider_specific_entry?.fast ?? 1 : 1));
|
|
4761
4762
|
}));
|
|
4762
4763
|
}
|
|
4763
4764
|
};
|
|
@@ -4908,11 +4909,16 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
4908
4909
|
"cache_read_input_token_cost": 5e-7,
|
|
4909
4910
|
"max_tokens": 128e3,
|
|
4910
4911
|
"max_input_tokens": 1e6,
|
|
4911
|
-
"max_output_tokens": 128e3
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
"
|
|
4915
|
-
"
|
|
4912
|
+
"max_output_tokens": 128e3
|
|
4913
|
+
},
|
|
4914
|
+
"anthropic.claude-opus-4-7": {
|
|
4915
|
+
"input_cost_per_token": 5e-6,
|
|
4916
|
+
"output_cost_per_token": 25e-6,
|
|
4917
|
+
"cache_creation_input_token_cost": 625e-8,
|
|
4918
|
+
"cache_read_input_token_cost": 5e-7,
|
|
4919
|
+
"max_tokens": 128e3,
|
|
4920
|
+
"max_input_tokens": 1e6,
|
|
4921
|
+
"max_output_tokens": 128e3
|
|
4916
4922
|
},
|
|
4917
4923
|
"anthropic.claude-sonnet-4-6": {
|
|
4918
4924
|
"input_cost_per_token": 3e-6,
|
|
@@ -4920,12 +4926,8 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
4920
4926
|
"cache_creation_input_token_cost": 375e-8,
|
|
4921
4927
|
"cache_read_input_token_cost": 3e-7,
|
|
4922
4928
|
"max_tokens": 64e3,
|
|
4923
|
-
"max_input_tokens":
|
|
4924
|
-
"max_output_tokens": 64e3
|
|
4925
|
-
"input_cost_per_token_above_200k_tokens": 6e-6,
|
|
4926
|
-
"output_cost_per_token_above_200k_tokens": 225e-7,
|
|
4927
|
-
"cache_creation_input_token_cost_above_200k_tokens": 75e-7,
|
|
4928
|
-
"cache_read_input_token_cost_above_200k_tokens": 6e-7
|
|
4929
|
+
"max_input_tokens": 1e6,
|
|
4930
|
+
"max_output_tokens": 64e3
|
|
4929
4931
|
},
|
|
4930
4932
|
"anthropic.claude-sonnet-4-20250514-v1:0": {
|
|
4931
4933
|
"input_cost_per_token": 3e-6,
|
|
@@ -4967,24 +4969,6 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
4967
4969
|
"max_input_tokens": 1e5,
|
|
4968
4970
|
"max_output_tokens": 8191
|
|
4969
4971
|
},
|
|
4970
|
-
"claude-3-5-haiku-20241022": {
|
|
4971
|
-
"input_cost_per_token": 8e-7,
|
|
4972
|
-
"output_cost_per_token": 4e-6,
|
|
4973
|
-
"cache_creation_input_token_cost": 1e-6,
|
|
4974
|
-
"cache_read_input_token_cost": 8e-8,
|
|
4975
|
-
"max_tokens": 8192,
|
|
4976
|
-
"max_input_tokens": 2e5,
|
|
4977
|
-
"max_output_tokens": 8192
|
|
4978
|
-
},
|
|
4979
|
-
"claude-3-5-haiku-latest": {
|
|
4980
|
-
"input_cost_per_token": 1e-6,
|
|
4981
|
-
"output_cost_per_token": 5e-6,
|
|
4982
|
-
"cache_creation_input_token_cost": 125e-8,
|
|
4983
|
-
"cache_read_input_token_cost": 1e-7,
|
|
4984
|
-
"max_tokens": 8192,
|
|
4985
|
-
"max_input_tokens": 2e5,
|
|
4986
|
-
"max_output_tokens": 8192
|
|
4987
|
-
},
|
|
4988
4972
|
"claude-haiku-4-5-20251001": {
|
|
4989
4973
|
"input_cost_per_token": 1e-6,
|
|
4990
4974
|
"output_cost_per_token": 5e-6,
|
|
@@ -5003,33 +4987,6 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
5003
4987
|
"max_input_tokens": 2e5,
|
|
5004
4988
|
"max_output_tokens": 64e3
|
|
5005
4989
|
},
|
|
5006
|
-
"claude-3-5-sonnet-20240620": {
|
|
5007
|
-
"input_cost_per_token": 3e-6,
|
|
5008
|
-
"output_cost_per_token": 15e-6,
|
|
5009
|
-
"cache_creation_input_token_cost": 375e-8,
|
|
5010
|
-
"cache_read_input_token_cost": 3e-7,
|
|
5011
|
-
"max_tokens": 8192,
|
|
5012
|
-
"max_input_tokens": 2e5,
|
|
5013
|
-
"max_output_tokens": 8192
|
|
5014
|
-
},
|
|
5015
|
-
"claude-3-5-sonnet-20241022": {
|
|
5016
|
-
"input_cost_per_token": 3e-6,
|
|
5017
|
-
"output_cost_per_token": 15e-6,
|
|
5018
|
-
"cache_creation_input_token_cost": 375e-8,
|
|
5019
|
-
"cache_read_input_token_cost": 3e-7,
|
|
5020
|
-
"max_tokens": 8192,
|
|
5021
|
-
"max_input_tokens": 2e5,
|
|
5022
|
-
"max_output_tokens": 8192
|
|
5023
|
-
},
|
|
5024
|
-
"claude-3-5-sonnet-latest": {
|
|
5025
|
-
"input_cost_per_token": 3e-6,
|
|
5026
|
-
"output_cost_per_token": 15e-6,
|
|
5027
|
-
"cache_creation_input_token_cost": 375e-8,
|
|
5028
|
-
"cache_read_input_token_cost": 3e-7,
|
|
5029
|
-
"max_tokens": 8192,
|
|
5030
|
-
"max_input_tokens": 2e5,
|
|
5031
|
-
"max_output_tokens": 8192
|
|
5032
|
-
},
|
|
5033
4990
|
"claude-3-7-sonnet-20250219": {
|
|
5034
4991
|
"input_cost_per_token": 3e-6,
|
|
5035
4992
|
"output_cost_per_token": 15e-6,
|
|
@@ -5039,15 +4996,6 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
5039
4996
|
"max_input_tokens": 2e5,
|
|
5040
4997
|
"max_output_tokens": 64e3
|
|
5041
4998
|
},
|
|
5042
|
-
"claude-3-7-sonnet-latest": {
|
|
5043
|
-
"input_cost_per_token": 3e-6,
|
|
5044
|
-
"output_cost_per_token": 15e-6,
|
|
5045
|
-
"cache_creation_input_token_cost": 375e-8,
|
|
5046
|
-
"cache_read_input_token_cost": 3e-7,
|
|
5047
|
-
"max_tokens": 64e3,
|
|
5048
|
-
"max_input_tokens": 2e5,
|
|
5049
|
-
"max_output_tokens": 64e3
|
|
5050
|
-
},
|
|
5051
4999
|
"claude-3-haiku-20240307": {
|
|
5052
5000
|
"input_cost_per_token": 25e-8,
|
|
5053
5001
|
"output_cost_per_token": 125e-8,
|
|
@@ -5066,15 +5014,6 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
5066
5014
|
"max_input_tokens": 2e5,
|
|
5067
5015
|
"max_output_tokens": 4096
|
|
5068
5016
|
},
|
|
5069
|
-
"claude-3-opus-latest": {
|
|
5070
|
-
"input_cost_per_token": 15e-6,
|
|
5071
|
-
"output_cost_per_token": 75e-6,
|
|
5072
|
-
"cache_creation_input_token_cost": 1875e-8,
|
|
5073
|
-
"cache_read_input_token_cost": 15e-7,
|
|
5074
|
-
"max_tokens": 4096,
|
|
5075
|
-
"max_input_tokens": 2e5,
|
|
5076
|
-
"max_output_tokens": 4096
|
|
5077
|
-
},
|
|
5078
5017
|
"claude-4-opus-20250514": {
|
|
5079
5018
|
"input_cost_per_token": 15e-6,
|
|
5080
5019
|
"output_cost_per_token": 75e-6,
|
|
@@ -5129,12 +5068,8 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
5129
5068
|
"cache_creation_input_token_cost": 375e-8,
|
|
5130
5069
|
"cache_read_input_token_cost": 3e-7,
|
|
5131
5070
|
"max_tokens": 64e3,
|
|
5132
|
-
"max_input_tokens":
|
|
5133
|
-
"max_output_tokens": 64e3
|
|
5134
|
-
"input_cost_per_token_above_200k_tokens": 6e-6,
|
|
5135
|
-
"output_cost_per_token_above_200k_tokens": 225e-7,
|
|
5136
|
-
"cache_creation_input_token_cost_above_200k_tokens": 75e-7,
|
|
5137
|
-
"cache_read_input_token_cost_above_200k_tokens": 6e-7
|
|
5071
|
+
"max_input_tokens": 1e6,
|
|
5072
|
+
"max_output_tokens": 64e3
|
|
5138
5073
|
},
|
|
5139
5074
|
"claude-sonnet-4-5-20250929-v1:0": {
|
|
5140
5075
|
"input_cost_per_token": 3e-6,
|
|
@@ -5202,10 +5137,7 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
5202
5137
|
"max_tokens": 128e3,
|
|
5203
5138
|
"max_input_tokens": 1e6,
|
|
5204
5139
|
"max_output_tokens": 128e3,
|
|
5205
|
-
"
|
|
5206
|
-
"output_cost_per_token_above_200k_tokens": 375e-7,
|
|
5207
|
-
"cache_creation_input_token_cost_above_200k_tokens": 125e-7,
|
|
5208
|
-
"cache_read_input_token_cost_above_200k_tokens": 1e-6
|
|
5140
|
+
"provider_specific_entry": { "fast": 6 }
|
|
5209
5141
|
},
|
|
5210
5142
|
"claude-opus-4-6-20260205": {
|
|
5211
5143
|
"input_cost_per_token": 5e-6,
|
|
@@ -5215,10 +5147,27 @@ const PREFETCHED_CLAUDE_PRICING = {
|
|
|
5215
5147
|
"max_tokens": 128e3,
|
|
5216
5148
|
"max_input_tokens": 1e6,
|
|
5217
5149
|
"max_output_tokens": 128e3,
|
|
5218
|
-
"
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
"
|
|
5150
|
+
"provider_specific_entry": { "fast": 6 }
|
|
5151
|
+
},
|
|
5152
|
+
"claude-opus-4-7": {
|
|
5153
|
+
"input_cost_per_token": 5e-6,
|
|
5154
|
+
"output_cost_per_token": 25e-6,
|
|
5155
|
+
"cache_creation_input_token_cost": 625e-8,
|
|
5156
|
+
"cache_read_input_token_cost": 5e-7,
|
|
5157
|
+
"max_tokens": 128e3,
|
|
5158
|
+
"max_input_tokens": 1e6,
|
|
5159
|
+
"max_output_tokens": 128e3,
|
|
5160
|
+
"provider_specific_entry": { "fast": 6 }
|
|
5161
|
+
},
|
|
5162
|
+
"claude-opus-4-7-20260416": {
|
|
5163
|
+
"input_cost_per_token": 5e-6,
|
|
5164
|
+
"output_cost_per_token": 25e-6,
|
|
5165
|
+
"cache_creation_input_token_cost": 625e-8,
|
|
5166
|
+
"cache_read_input_token_cost": 5e-7,
|
|
5167
|
+
"max_tokens": 128e3,
|
|
5168
|
+
"max_input_tokens": 1e6,
|
|
5169
|
+
"max_output_tokens": 128e3,
|
|
5170
|
+
"provider_specific_entry": { "fast": 6 }
|
|
5222
5171
|
},
|
|
5223
5172
|
"claude-sonnet-4-20250514": {
|
|
5224
5173
|
"input_cost_per_token": 3e-6,
|
|
@@ -5437,7 +5386,8 @@ const usageDataSchema = object({
|
|
|
5437
5386
|
input_tokens: number(),
|
|
5438
5387
|
output_tokens: number(),
|
|
5439
5388
|
cache_creation_input_tokens: optional(number()),
|
|
5440
|
-
cache_read_input_tokens: optional(number())
|
|
5389
|
+
cache_read_input_tokens: optional(number()),
|
|
5390
|
+
speed: optional(picklist(["standard", "fast"]))
|
|
5441
5391
|
}),
|
|
5442
5392
|
model: optional(modelNameSchema),
|
|
5443
5393
|
id: optional(messageIdSchema),
|
|
@@ -5522,6 +5472,11 @@ const bucketUsageSchema = object({
|
|
|
5522
5472
|
modelBreakdowns: array(modelBreakdownSchema),
|
|
5523
5473
|
project: optional(string())
|
|
5524
5474
|
});
|
|
5475
|
+
function getDisplayModelName(data) {
|
|
5476
|
+
const model = data.message.model;
|
|
5477
|
+
if (model == null) return;
|
|
5478
|
+
return data.message.usage.speed === "fast" ? `${model}-fast` : model;
|
|
5479
|
+
}
|
|
5525
5480
|
function aggregateByModel(entries, getModel, getUsage, getCost) {
|
|
5526
5481
|
const modelAggregates = /* @__PURE__ */ new Map();
|
|
5527
5482
|
const defaultStats = {
|
|
@@ -5662,14 +5617,15 @@ async function sortFilesByTimestamp(files) {
|
|
|
5662
5617
|
}).map((item) => item.file);
|
|
5663
5618
|
}
|
|
5664
5619
|
async function calculateCostForEntry(data, mode, fetcher) {
|
|
5620
|
+
const speed = data.message.usage.speed;
|
|
5665
5621
|
if (mode === "display") return data.costUSD ?? 0;
|
|
5666
5622
|
if (mode === "calculate") {
|
|
5667
|
-
if (data.message.model != null) return unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model), 0);
|
|
5623
|
+
if (data.message.model != null) return unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model, { speed }), 0);
|
|
5668
5624
|
return 0;
|
|
5669
5625
|
}
|
|
5670
5626
|
if (mode === "auto") {
|
|
5671
5627
|
if (data.costUSD != null) return data.costUSD;
|
|
5672
|
-
if (data.message.model != null) return unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model), 0);
|
|
5628
|
+
if (data.message.model != null) return unwrap(fetcher.calculateCostFromTokens(data.message.usage, data.message.model, { speed }), 0);
|
|
5673
5629
|
return 0;
|
|
5674
5630
|
}
|
|
5675
5631
|
unreachable(mode);
|
|
@@ -5724,7 +5680,7 @@ async function loadDailyUsageData(options) {
|
|
|
5724
5680
|
data,
|
|
5725
5681
|
date,
|
|
5726
5682
|
cost,
|
|
5727
|
-
model: data
|
|
5683
|
+
model: getDisplayModelName(data),
|
|
5728
5684
|
project
|
|
5729
5685
|
});
|
|
5730
5686
|
} catch {}
|
|
@@ -5790,7 +5746,7 @@ async function loadSessionData(options) {
|
|
|
5790
5746
|
projectPath,
|
|
5791
5747
|
cost,
|
|
5792
5748
|
timestamp: data.timestamp,
|
|
5793
|
-
model: data
|
|
5749
|
+
model: getDisplayModelName(data)
|
|
5794
5750
|
});
|
|
5795
5751
|
} catch {}
|
|
5796
5752
|
});
|
|
@@ -5986,7 +5942,7 @@ async function loadSessionBlockData(options) {
|
|
|
5986
5942
|
cacheReadInputTokens: data.message.usage.cache_read_input_tokens ?? 0
|
|
5987
5943
|
},
|
|
5988
5944
|
costUSD: cost,
|
|
5989
|
-
model: data
|
|
5945
|
+
model: getDisplayModelName(data) ?? "unknown",
|
|
5990
5946
|
version: data.version,
|
|
5991
5947
|
usageLimitResetTime: usageLimitResetTime ?? void 0
|
|
5992
5948
|
});
|
|
@@ -1649,6 +1649,66 @@ declare function optionalAsync<const TWrapped$1 extends BaseSchema<unknown, unkn
|
|
|
1649
1649
|
/**
|
|
1650
1650
|
* Picklist options type.
|
|
1651
1651
|
*/
|
|
1652
|
+
type PicklistOptions = MaybeReadonly<(string | number | bigint)[]>;
|
|
1653
|
+
/**
|
|
1654
|
+
* Picklist issue interface.
|
|
1655
|
+
*/
|
|
1656
|
+
interface PicklistIssue extends BaseIssue<unknown> {
|
|
1657
|
+
/**
|
|
1658
|
+
* The issue kind.
|
|
1659
|
+
*/
|
|
1660
|
+
readonly kind: 'schema';
|
|
1661
|
+
/**
|
|
1662
|
+
* The issue type.
|
|
1663
|
+
*/
|
|
1664
|
+
readonly type: 'picklist';
|
|
1665
|
+
/**
|
|
1666
|
+
* The expected property.
|
|
1667
|
+
*/
|
|
1668
|
+
readonly expected: string;
|
|
1669
|
+
}
|
|
1670
|
+
/**
|
|
1671
|
+
* Picklist schema interface.
|
|
1672
|
+
*/
|
|
1673
|
+
interface PicklistSchema<TOptions$1 extends PicklistOptions, TMessage extends ErrorMessage<PicklistIssue> | undefined> extends BaseSchema<TOptions$1[number], TOptions$1[number], PicklistIssue> {
|
|
1674
|
+
/**
|
|
1675
|
+
* The schema type.
|
|
1676
|
+
*/
|
|
1677
|
+
readonly type: 'picklist';
|
|
1678
|
+
/**
|
|
1679
|
+
* The schema reference.
|
|
1680
|
+
*/
|
|
1681
|
+
readonly reference: typeof picklist;
|
|
1682
|
+
/**
|
|
1683
|
+
* The picklist options.
|
|
1684
|
+
*/
|
|
1685
|
+
readonly options: TOptions$1;
|
|
1686
|
+
/**
|
|
1687
|
+
* The error message.
|
|
1688
|
+
*/
|
|
1689
|
+
readonly message: TMessage;
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Creates a picklist schema.
|
|
1693
|
+
*
|
|
1694
|
+
* @param options The picklist options.
|
|
1695
|
+
*
|
|
1696
|
+
* @returns A picklist schema.
|
|
1697
|
+
*/
|
|
1698
|
+
declare function picklist<const TOptions$1 extends PicklistOptions>(options: TOptions$1): PicklistSchema<TOptions$1, undefined>;
|
|
1699
|
+
/**
|
|
1700
|
+
* Creates a picklist schema.
|
|
1701
|
+
*
|
|
1702
|
+
* @param options The picklist options.
|
|
1703
|
+
* @param message The error message.
|
|
1704
|
+
*
|
|
1705
|
+
* @returns A picklist schema.
|
|
1706
|
+
*/
|
|
1707
|
+
declare function picklist<const TOptions$1 extends PicklistOptions, const TMessage extends ErrorMessage<PicklistIssue> | undefined>(options: TOptions$1, message: TMessage): PicklistSchema<TOptions$1, TMessage>;
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* Promise issue interface.
|
|
1711
|
+
*/
|
|
1652
1712
|
|
|
1653
1713
|
/**
|
|
1654
1714
|
* String issue interface.
|
|
@@ -1994,6 +2054,7 @@ declare const usageDataSchema: ObjectSchema<{
|
|
|
1994
2054
|
readonly output_tokens: NumberSchema<undefined>;
|
|
1995
2055
|
readonly cache_creation_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
1996
2056
|
readonly cache_read_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
2057
|
+
readonly speed: OptionalSchema<PicklistSchema<["standard", "fast"], undefined>, undefined>;
|
|
1997
2058
|
}, undefined>;
|
|
1998
2059
|
readonly model: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
|
|
1999
2060
|
readonly id: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Message ID cannot be empty">, BrandAction<string, "MessageId">]>, undefined>;
|
package/dist/data-loader.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as sessionUsageSchema, C as loadMonthlyUsageData, D as loadWeeklyUsageData, E as loadSessionUsageById, F as weeklyUsageSchema, M as transcriptMessageSchema, N as transcriptUsageSchema, O as modelBreakdownSchema, P as usageDataSchema, S as loadDailyUsageData, T as loadSessionData, _ as getClaudePaths, a as LoadOptions, b as globUsageFiles, c as SessionUsage, d as bucketUsageSchema, f as calculateContextTokens, g as extractProjectFromPath, h as dailyUsageSchema, i as GlobResult, j as sortFilesByTimestamp, k as monthlyUsageSchema, l as UsageData, m as createUniqueHash, n as DailyUsage, o as ModelBreakdown, p as calculateCostForEntry, r as DateFilter, s as MonthlyUsage, t as BucketUsage, u as WeeklyUsage, v as getEarliestTimestamp, w as loadSessionBlockData, x as loadBucketUsageData, y as getUsageLimitResetTime } from "./data-loader-
|
|
1
|
+
import { A as sessionUsageSchema, C as loadMonthlyUsageData, D as loadWeeklyUsageData, E as loadSessionUsageById, F as weeklyUsageSchema, M as transcriptMessageSchema, N as transcriptUsageSchema, O as modelBreakdownSchema, P as usageDataSchema, S as loadDailyUsageData, T as loadSessionData, _ as getClaudePaths, a as LoadOptions, b as globUsageFiles, c as SessionUsage, d as bucketUsageSchema, f as calculateContextTokens, g as extractProjectFromPath, h as dailyUsageSchema, i as GlobResult, j as sortFilesByTimestamp, k as monthlyUsageSchema, l as UsageData, m as createUniqueHash, n as DailyUsage, o as ModelBreakdown, p as calculateCostForEntry, r as DateFilter, s as MonthlyUsage, t as BucketUsage, u as WeeklyUsage, v as getEarliestTimestamp, w as loadSessionBlockData, x as loadBucketUsageData, y as getUsageLimitResetTime } from "./data-loader-CdGrTB0Q.js";
|
|
2
2
|
export { BucketUsage, DailyUsage, DateFilter, GlobResult, LoadOptions, ModelBreakdown, MonthlyUsage, SessionUsage, UsageData, WeeklyUsage, bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema };
|
package/dist/data-loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as transcriptUsageSchema, S as transcriptMessageSchema, T as weeklyUsageSchema, _ as loadWeeklyUsageData, a as dailyUsageSchema, b as sessionUsageSchema, c as getEarliestTimestamp, d as loadBucketUsageData, f as loadDailyUsageData, g as loadSessionUsageById, h as loadSessionData, i as createUniqueHash, l as getUsageLimitResetTime, m as loadSessionBlockData, n as calculateContextTokens, o as extractProjectFromPath, p as loadMonthlyUsageData, r as calculateCostForEntry, s as getClaudePaths, t as bucketUsageSchema, u as globUsageFiles, v as modelBreakdownSchema, w as usageDataSchema, x as sortFilesByTimestamp, y as monthlyUsageSchema } from "./data-loader-
|
|
2
|
-
import "./_types-
|
|
3
|
-
import "./logger-
|
|
1
|
+
import { C as transcriptUsageSchema, S as transcriptMessageSchema, T as weeklyUsageSchema, _ as loadWeeklyUsageData, a as dailyUsageSchema, b as sessionUsageSchema, c as getEarliestTimestamp, d as loadBucketUsageData, f as loadDailyUsageData, g as loadSessionUsageById, h as loadSessionData, i as createUniqueHash, l as getUsageLimitResetTime, m as loadSessionBlockData, n as calculateContextTokens, o as extractProjectFromPath, p as loadMonthlyUsageData, r as calculateCostForEntry, s as getClaudePaths, t as bucketUsageSchema, u as globUsageFiles, v as modelBreakdownSchema, w as usageDataSchema, x as sortFilesByTimestamp, y as monthlyUsageSchema } from "./data-loader-9ESMosno.js";
|
|
2
|
+
import "./_types-DY3gqCWm.js";
|
|
3
|
+
import "./logger-D9FuoYJ7.js";
|
|
4
4
|
export { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as PricingFetcher, J as CLAUDE_PROJECTS_DIR_NAME, W as _usingCtx, X as DEBUG_MATCH_THRESHOLD_PERCENT, at as try_, ft as isFailure, it as unwrap, rt as glob, s as getClaudePaths, tt as USAGE_DATA_GLOB_PATTERN, w as usageDataSchema } from "./data-loader-
|
|
2
|
-
import {
|
|
3
|
-
import { n as logger } from "./logger-
|
|
1
|
+
import { A as PricingFetcher, J as CLAUDE_PROJECTS_DIR_NAME, W as _usingCtx, X as DEBUG_MATCH_THRESHOLD_PERCENT, at as try_, ft as isFailure, it as unwrap, rt as glob, s as getClaudePaths, tt as USAGE_DATA_GLOB_PATTERN, w as usageDataSchema } from "./data-loader-9ESMosno.js";
|
|
2
|
+
import { F as safeParse } from "./_types-DY3gqCWm.js";
|
|
3
|
+
import { n as logger } from "./logger-D9FuoYJ7.js";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
async function detectMismatches(claudePath) {
|
package/dist/debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./data-loader-
|
|
2
|
-
import "./_types-
|
|
3
|
-
import "./logger-
|
|
4
|
-
import { n as printMismatchReport, t as detectMismatches } from "./debug-
|
|
1
|
+
import "./data-loader-9ESMosno.js";
|
|
2
|
+
import "./_types-DY3gqCWm.js";
|
|
3
|
+
import "./logger-D9FuoYJ7.js";
|
|
4
|
+
import { n as printMismatchReport, t as detectMismatches } from "./debug-DvI5DUKR.js";
|
|
5
5
|
export { detectMismatches, printMismatchReport };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as DEFAULT_RECENT_DAYS, B as pushBreakdownRows, D as calculateBurnRate, E as DEFAULT_SESSION_DURATION_HOURS, F as formatDateCompact, G as BLOCKS_COMPACT_WIDTH_THRESHOLD, H as getFileModifiedTime, I as formatModelsDisplayMultiline, K as BLOCKS_DEFAULT_TERMINAL_WIDTH, L as formatNumber, M as addEmptySeparatorRow, N as createUsageReportTable, O as filterRecentBlocks, P as formatCurrency, Q as DEFAULT_LOCALE, R as formatTotalsRow, U as unreachable, V as require_picocolors, W as _usingCtx, Y as CONFIG_FILE_NAME, Z as DEFAULT_CONTEXT_USAGE_THRESHOLDS, _ as loadWeeklyUsageData, at as try_, ct as inspectError, dt as isSuccess, et as DEFAULT_REFRESH_INTERVAL_SECONDS, f as loadDailyUsageData, ft as isFailure, g as loadSessionUsageById, h as loadSessionData, it as unwrap, j as ResponsiveTable, k as projectBlockUsage, lt as inspect, m as loadSessionBlockData, mt as __toESM, n as calculateContextTokens, nt as WEEK_DAYS, ot as pipe, p as loadMonthlyUsageData, pt as toArray, q as BLOCKS_WARNING_THRESHOLD, s as getClaudePaths, st as map$1, ut as succeed, z as formatUsageDataRow } from "./data-loader-
|
|
3
|
-
import { D as maxValue, E as integer$1, F as
|
|
4
|
-
import { n as createTotalsObject, t as calculateTotals } from "./calculate-cost-
|
|
5
|
-
import { a as version, i as name, n as logger, r as description, t as log } from "./logger-
|
|
6
|
-
import { n as printMismatchReport, t as detectMismatches } from "./debug-
|
|
2
|
+
import { $ as DEFAULT_RECENT_DAYS, B as pushBreakdownRows, D as calculateBurnRate, E as DEFAULT_SESSION_DURATION_HOURS, F as formatDateCompact, G as BLOCKS_COMPACT_WIDTH_THRESHOLD, H as getFileModifiedTime, I as formatModelsDisplayMultiline, K as BLOCKS_DEFAULT_TERMINAL_WIDTH, L as formatNumber, M as addEmptySeparatorRow, N as createUsageReportTable, O as filterRecentBlocks, P as formatCurrency, Q as DEFAULT_LOCALE, R as formatTotalsRow, U as unreachable, V as require_picocolors, W as _usingCtx, Y as CONFIG_FILE_NAME, Z as DEFAULT_CONTEXT_USAGE_THRESHOLDS, _ as loadWeeklyUsageData, at as try_, ct as inspectError, dt as isSuccess, et as DEFAULT_REFRESH_INTERVAL_SECONDS, f as loadDailyUsageData, ft as isFailure, g as loadSessionUsageById, h as loadSessionData, it as unwrap, j as ResponsiveTable, k as projectBlockUsage, lt as inspect, m as loadSessionBlockData, mt as __toESM, n as calculateContextTokens, nt as WEEK_DAYS, ot as pipe, p as loadMonthlyUsageData, pt as toArray, q as BLOCKS_WARNING_THRESHOLD, s as getClaudePaths, st as map$1, ut as succeed, z as formatUsageDataRow } from "./data-loader-9ESMosno.js";
|
|
3
|
+
import { B as getTotalTokens, D as maxValue, E as integer$1, F as safeParse, I as string, L as transform, M as parse$1, O as minValue, P as pipe$1, R as trim, T as flatten, d as filterDateSchema, k as number, n as SortOrders, t as CostModes, w as check, y as statuslineHookJsonSchema, z as union } from "./_types-DY3gqCWm.js";
|
|
4
|
+
import { n as createTotalsObject, t as calculateTotals } from "./calculate-cost-DWGfKMSD.js";
|
|
5
|
+
import { a as version, i as name, n as logger, r as description, t as log } from "./logger-D9FuoYJ7.js";
|
|
6
|
+
import { n as printMismatchReport, t as detectMismatches } from "./debug-DvI5DUKR.js";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import a from "node:fs/promises";
|
|
9
9
|
import path, { join } from "node:path";
|
|
@@ -866,7 +866,7 @@ function createLogger(name$1) {
|
|
|
866
866
|
}
|
|
867
867
|
const log = console.log;
|
|
868
868
|
var name = "ccusage";
|
|
869
|
-
var version = "18.0.
|
|
869
|
+
var version = "18.0.11";
|
|
870
870
|
var description = "Usage analysis tool for Claude Code";
|
|
871
871
|
const logger = createLogger(name);
|
|
872
872
|
const log$1 = log;
|
package/dist/logger.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as logger, t as log } from "./logger-
|
|
1
|
+
import { n as logger, t as log } from "./logger-D9FuoYJ7.js";
|
|
2
2
|
export { log, logger };
|