@trazum/cli 2.7.3 → 2.7.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trazum/cli",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "description": "What your AI agents cost, per project, offline: one bill across Claude Code, Codex and Gemini CLI sessions, plus Anthropic, OpenAI, Gemini, OpenRouter, OTel and LiteLLM usage, written as PDF, HTML or CSV, with budgets enforced in CI.",
5
5
  "license": "MIT",
6
6
  "author": "David Mu\u00f1oz Rey",
@@ -53,7 +53,7 @@
53
53
  "prepublishOnly": "npm run build && npm test"
54
54
  },
55
55
  "dependencies": {
56
- "@trazum/core": "2.7.3"
56
+ "@trazum/core": "2.7.4"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/node": "^26.6.6",
package/src/i18n/en.ts CHANGED
@@ -2034,7 +2034,9 @@ ${bold('EXAMPLES')}
2034
2034
  unnamedModel: (count) =>
2035
2035
  `${count} row(s) named no model and are not in the output: the report was not grouped by model, so nothing on the row says what answered. Add group_by[]=model to the request.`,
2036
2036
  nonStandardTier: (count) =>
2037
- `${count} row(s) were billed at a tier a catalogue rate is not the rate for (batch, priority, flex) and are not in the output. Pricing them from the standard rate would overstate the bill and look right doing it.`,
2037
+ `${count} row(s) were billed at a tier no published rate here prices (priority, flex, or batch on a model with no batch rate) and are not in the output. Pricing them from the standard rate would be a guess nobody can check.`,
2038
+ batchPriced: (count) =>
2039
+ `${count} row(s) ran on the Batch API and are priced at the model's batch rate, half the standard one, as the pricing page publishes it.`,
2038
2040
  tierUnknown: () =>
2039
2041
  'The report never named a service tier, so a batch row and a standard row are indistinguishable here. Everything was read as standard. Add group_by[]=service_tier if any of this usage is batched.',
2040
2042
  fastPriced: (count) =>
@@ -2079,7 +2081,9 @@ ${bold('EXAMPLES')}
2079
2081
  unnamedModel: (count) =>
2080
2082
  `${count} row(s) named no model and are not in the output: the report was not grouped by model, so nothing on the row says what answered. Add group_by[]=model to the request.`,
2081
2083
  batch: (count) =>
2082
- `${count} row(s) were batch jobs and are not in the output: batch is billed at a discount, and pricing it from a catalogue rate would overstate the bill and look right doing it.`,
2084
+ `${count} row(s) were batch jobs on a model Trazum has no batch rate for, and are not in the output: batch is billed at a discount, and pricing it from the standard rate would overstate the bill and look right doing it.`,
2085
+ batchPriced: (count) =>
2086
+ `${count} row(s) were batch jobs and are priced at the model's batch rate, half the standard one, as the pricing page publishes it.`,
2083
2087
  batchUnknown: () =>
2084
2088
  'The report never said whether anything was batch, so a batch row and a standard row are indistinguishable here. Everything was read as standard. Add group_by[]=batch if any of this usage is batched.',
2085
2089
  nonDefaultTier: (count, tiers) =>
package/src/i18n/es.ts CHANGED
@@ -2064,7 +2064,9 @@ ${bold('EJEMPLOS')}
2064
2064
  unnamedModel: (count) =>
2065
2065
  `${count} fila(s) no nombraron modelo y no están en la salida: el informe no se agrupó por modelo, así que nada en la fila dice qué respondió. Añade group_by[]=model a la petición.`,
2066
2066
  nonStandardTier: (count) =>
2067
- `${count} fila(s) se facturaron en un tramo para el que una tarifa de catálogo no es la tarifa (batch, priority, flex) y no están en la salida. Cobrarlas a la tarifa estándar inflaría la factura y parecería correcto.`,
2067
+ `${count} fila(s) se facturaron en un tramo que ninguna tarifa publicada aquí cubre (priority, flex, o batch en un modelo sin tarifa batch) y no están en la salida. Cobrarlas a la tarifa estándar sería adivinar sin forma de comprobarlo.`,
2068
+ batchPriced: (count) =>
2069
+ `${count} fila(s) corrieron en la Batch API y se cobran a la tarifa batch del modelo, la mitad de la estándar, como la publica la página de precios.`,
2068
2070
  tierUnknown: () =>
2069
2071
  'El informe no nombró ningún tramo de servicio, así que una fila batch y una estándar son indistinguibles aquí. Todo se leyó como estándar. Añade group_by[]=service_tier si parte de este uso va por lotes.',
2070
2072
  fastPriced: (count) =>
@@ -2109,7 +2111,9 @@ ${bold('EJEMPLOS')}
2109
2111
  unnamedModel: (count) =>
2110
2112
  `${count} fila(s) no nombraron modelo y no están en la salida: el informe no se agrupó por modelo, así que nada en la fila dice qué respondió. Añade group_by[]=model a la petición.`,
2111
2113
  batch: (count) =>
2112
- `${count} fila(s) eran trabajos por lotes y no están en la salida: batch se factura con descuento, y cobrarlo a tarifa de catálogo inflaría la factura y parecería correcto.`,
2114
+ `${count} fila(s) eran trabajos por lotes en un modelo para el que Trazum no tiene tarifa batch, y no están en la salida: batch se factura con descuento, y cobrarlo a la tarifa estándar inflaría la factura y parecería correcto.`,
2115
+ batchPriced: (count) =>
2116
+ `${count} fila(s) eran trabajos por lotes y se cobran a la tarifa batch del modelo, la mitad de la estándar, como la publica la página de precios.`,
2113
2117
  batchUnknown: () =>
2114
2118
  'El informe nunca dijo si algo fue batch, así que una fila por lotes y una estándar son indistinguibles aquí. Todo se leyó como estándar. Añade group_by[]=batch si parte de este uso va por lotes.',
2115
2119
  nonDefaultTier: (count, tiers) =>
package/src/i18n/types.ts CHANGED
@@ -706,6 +706,7 @@ export interface CliMessages {
706
706
  unnamedModel(count: number): string;
707
707
  /** Batch and priority are not billed at a catalogue rate. */
708
708
  nonStandardTier(count: number): string;
709
+ batchPriced(count: number): string;
709
710
  /** Said when the report never named a tier: the question was not asked. */
710
711
  tierUnknown(): string;
711
712
  /** Server tools are billed per request, and no token rate reaches them. */
@@ -737,6 +738,7 @@ export interface CliMessages {
737
738
  unnamedModel(count: number): string;
738
739
  /** batch: true rows are billed at a discount no catalogue rate is. */
739
740
  batch(count: number): string;
741
+ batchPriced(count: number): string;
740
742
  /** The report never said whether anything was batch. */
741
743
  batchUnknown(): string;
742
744
  /** Any tier but default, named rather than counted. */
package/src/index.ts CHANGED
@@ -140,6 +140,8 @@ import {
140
140
  looksLikeLiteLlm,
141
141
  looksLikeOpenaiUsage,
142
142
  looksLikeOpenrouterActivity,
143
+ looksLikeBatchResults,
144
+ batchResultRecords,
143
145
  looksLikeOtel,
144
146
  openaiCostReport,
145
147
  openaiUsageRecords,
@@ -3530,6 +3532,7 @@ type UsageSource =
3530
3532
  | 'langsmith'
3531
3533
  | 'anthropic-usage'
3532
3534
  | 'openai-usage'
3535
+ | 'batch-results'
3533
3536
  | 'openrouter'
3534
3537
  | 'usage-log';
3535
3538
 
@@ -3546,6 +3549,7 @@ function usageSourcesOf(text: string): UsageSource[] {
3546
3549
  if (looksLikeOtel(text)) claims.push('otel');
3547
3550
  if (looksLikeAnthropicUsage(text)) claims.push('anthropic-usage');
3548
3551
  if (looksLikeOpenaiUsage(text)) claims.push('openai-usage');
3552
+ if (looksLikeBatchResults(text)) claims.push('batch-results');
3549
3553
  if (looksLikeOpenrouterActivity(text)) claims.push('openrouter');
3550
3554
  if (looksLikeHelicone(text)) claims.push('helicone');
3551
3555
  if (looksLikeLangsmith(text)) claims.push('langsmith');
@@ -3771,6 +3775,14 @@ async function commandBill(args: Args, pricing: PricingCatalogue, t: CliMessages
3771
3775
  leftOut = c.unnamedModel + c.batch + c.nonDefaultTier + c.unsplitRows;
3772
3776
  break;
3773
3777
  }
3778
+ case 'batch-results': {
3779
+ /* A provider's Batch API results: every billed line at the batch rate,
3780
+ and the requests the provider says it did not bill left out. */
3781
+ const c = batchResultRecords(text, withLabel);
3782
+ records = c.records;
3783
+ leftOut = c.unpriceable + c.unparseable;
3784
+ break;
3785
+ }
3774
3786
  case 'openrouter': {
3775
3787
  const c = openrouterActivityRecords(text, withLabel);
3776
3788
  records = c.records;
@@ -4723,6 +4735,7 @@ async function commandFromAnthropic(args: Args, t: CliMessages): Promise<void> {
4723
4735
  acts in: what was read, then what was left out, then what to ask for. */
4724
4736
  console.error(t.fromAnthropic.summary(conversion.buckets, conversion.rows));
4725
4737
  if (conversion.unnamedModel > 0) console.error(t.fromAnthropic.unnamedModel(conversion.unnamedModel));
4738
+ if (conversion.batchRows > 0) console.error(t.fromAnthropic.batchPriced(conversion.batchRows));
4726
4739
  if (conversion.nonStandardTier > 0) {
4727
4740
  console.error(t.fromAnthropic.nonStandardTier(conversion.nonStandardTier));
4728
4741
  }
@@ -4790,6 +4803,7 @@ async function commandFromOpenai(args: Args, t: CliMessages): Promise<void> {
4790
4803
  was left out and why, what to ask the endpoint for next time. */
4791
4804
  console.error(t.fromOpenai.summary(conversion.buckets, conversion.rows, conversion.requests));
4792
4805
  if (conversion.unnamedModel > 0) console.error(t.fromOpenai.unnamedModel(conversion.unnamedModel));
4806
+ if (conversion.batchRows > 0) console.error(t.fromOpenai.batchPriced(conversion.batchRows));
4793
4807
  if (conversion.batch > 0) console.error(t.fromOpenai.batch(conversion.batch));
4794
4808
  if (!conversion.batchNamed && conversion.rows > 0) console.error(t.fromOpenai.batchUnknown());
4795
4809
  if (conversion.serviceTierRows > 0) {