Skip to content
Trazum

1.18.0

The bill, where the decisions are made

Added#

profile reads a directory of rotated logs. Logs rotate — one file per day for a month — and making somebody cat them together before a profile will read them is a setup cost that gets a tool skipped. A directory is read in name order (which for dated names is time order) as one bill, with the number of files stated: a report over "the logs" that silently skipped one is a total wrong by an unknown amount. A file with no trailing newline is joined without gluing its last record to the next file's first. A directory with nothing readable is an error naming the extensions it looked for, never an empty report that would read as "you spent nothing".

profile --csv-out, the report for whoever signs off the bill. One row per label and model — the grain a routing or budget decision is made at — written from @trazum/core's profileToCsv. Three deliberate refusals: no total row, because a total inside a data file gets summed with the data and doubles every figure downstream; empty dollar cells for unpriced models, never zeros, because 0 would claim those calls were free while their tokens are real; and a label that starts with =, +, - or @ is prefixed with an apostrophe, because a usage log is data and a spreadsheet would otherwise run it.

Two bugs the feature's own tests caught, both now fixed: under --json the side files (--csv-out, --markdown-out) were never written at all — a flag that silently did nothing — and the "wrote to" notice went to stdout, turning a parseable JSON document into a parse error. Both output paths now write the files, and the notice goes to stderr under --json, the rule the money gates already followed.

Money budgets that live in the repository: spend in trazum.config.json. budgets gates the tokens a prompt file may hold; spend gates the dollars a usage log records — maxUsd for the whole log, byLabel for each named workload against its own limit in the same run. A per-workload budget is a policy several people agree on, and a policy that lives in one CI invocation is a policy nobody can read. Flags still win over the config, as everywhere.

Two refusals keep it honest. A budgeted label with no calls in the log is reported as not measured, never as a pass: a workload that did not appear is not a workload that came in under budget. And per-label budgets are not applied under --since/--until, because a window makes "what this label spent" mean a slice, and a budget written for the whole period would be gating against something it does not describe.