@bitkyc08/opencodex 2.7.36 → 2.7.38-preview.20260724

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.
@@ -2,7 +2,7 @@ import { baseProviderLabel } from "../providers/label";
2
2
  import { canonicalAntigravityUsageModel } from "../providers/antigravity-models";
3
3
  import { usageDisplayTotalTokens } from "./totals";
4
4
  import type { PersistedUsageEntry, UsageStatus } from "./log";
5
- import { estimateComboCost, estimateRequestCost } from "./cost";
5
+ import { estimateComboCost, estimateRequestCost, effectiveServiceTier } from "./cost";
6
6
 
7
7
  export type UsageRange = "7d" | "30d" | "all";
8
8
  export type UsageSurface = "all" | "codex" | "claude";
@@ -268,16 +268,17 @@ function finalizeCoverage(totals: UsageSummaryTotals): void {
268
268
 
269
269
  function addEstimatedCost(
270
270
  totals: UsageSummaryTotals,
271
- entry: Pick<PersistedUsageEntry, "provider" | "model" | "usageStatus" | "usage" | "attempts">,
271
+ entry: Pick<PersistedUsageEntry, "provider" | "model" | "usageStatus" | "usage" | "attempts" | "responseServiceTier" | "requestedServiceTier" | "configuredServiceTier">,
272
272
  ): void {
273
273
  if (entry.usageStatus === "unreported" || entry.usageStatus === "unsupported"
274
274
  || (!entry.usage && !entry.attempts?.length)) {
275
275
  totals.unmeteredRequests += 1;
276
276
  return;
277
277
  }
278
+ const tier = effectiveServiceTier(entry);
278
279
  const estimate = entry.attempts?.length
279
- ? estimateComboCost(entry.attempts)
280
- : estimateRequestCost({ provider: entry.provider, model: entry.model, usage: entry.usage, usageStatus: entry.usageStatus });
280
+ ? estimateComboCost(entry.attempts, undefined, tier)
281
+ : estimateRequestCost({ provider: entry.provider, model: entry.model, usage: entry.usage, usageStatus: entry.usageStatus, serviceTier: tier });
281
282
  if (!estimate) {
282
283
  totals.unpricedRequests += 1;
283
284
  return;
@@ -389,9 +390,10 @@ function buildModels(entries: PersistedUsageEntry[], totalTokens: number): Usage
389
390
  }
390
391
  // Accumulate per-model estimated cost
391
392
  for (const entry of entries) {
393
+ const tier = effectiveServiceTier(entry);
392
394
  const estimate = entry.attempts?.length
393
- ? estimateComboCost(entry.attempts)
394
- : estimateRequestCost({ provider: entry.provider, model: entry.model, usage: entry.usage, usageStatus: entry.usageStatus });
395
+ ? estimateComboCost(entry.attempts, undefined, tier)
396
+ : estimateRequestCost({ provider: entry.provider, model: entry.model, usage: entry.usage, usageStatus: entry.usageStatus, serviceTier: tier });
395
397
  if (!estimate) continue;
396
398
 
397
399
  if (entry.attempts?.length && estimate.attempts) {
@@ -457,9 +459,10 @@ function buildProviders(entries: PersistedUsageEntry[], totalTokens: number): Us
457
459
  }
458
460
  }
459
461
  for (const entry of entries) {
462
+ const tier = effectiveServiceTier(entry);
460
463
  const estimate = entry.attempts?.length
461
- ? estimateComboCost(entry.attempts)
462
- : estimateRequestCost({ provider: entry.provider, model: entry.model, usage: entry.usage, usageStatus: entry.usageStatus });
464
+ ? estimateComboCost(entry.attempts, undefined, tier)
465
+ : estimateRequestCost({ provider: entry.provider, model: entry.model, usage: entry.usage, usageStatus: entry.usageStatus, serviceTier: tier });
463
466
  if (!estimate) continue;
464
467
 
465
468
  if (entry.attempts?.length && estimate.attempts) {