Skip to content
Trazum

1.36.0

The estimate stops guessing

Added#

optimize --from-log: the multiplication stops guessing. Every saving optimize prints is token delta × usage, and until now every part of the usage half was typed by a human — the real call count, output size, cache share and model were all guesses with defaults. --from-log <usage.jsonl> measures all four from the log, and the rendering names which figures are measured, because "measured × estimated" and "estimated × guessed" are different claims about the same dollar sign.

The refusals are the design: typed flags (--calls, --output-tokens, --cache-hit-rate, --model) are refused beside it — measuring and typing the same figure is a contradiction, not a preference order. Scaling to a month requires a full week of data, because three weekdays scaled up is a Tuesday with a multiplier; under the floor the figures cover exactly the period measured and nothing says "month". A label with no priced traffic is an error naming the labels that have some, never a $0 saving that reads as "worthless" instead of "unmeasured". The label resolves from --label or from the config's labels map read in reverse, with ambiguity refused by name. And --from-log implies --cost: a log with billed counts is proof of a metered API, whatever the terminal bills like.

Multi-model labels say which model the figures use and its share of spend; slices that never recorded output say their output half is $0 measured, not $0 assumed. New core module measured-profile.ts with measuredUsage() and labelCoverage(), both exported.

optimize --all-labels: which prompt to edit first. Every prompt in the config's labels map, optimised and priced against its own measured traffic, ranked by what the change is worth — ranked by traffic and not by prompt length, because a big prompt on a dead workload is worth less than a small one on a busy one. Requires --from-log: ranking savings that were all multiplied by the same typed guess ranks prompts by length and calls it a priority. Both coverage mismatches are named at the end: a label carrying measured spend with no prompt mapped (the workload nobody can optimise because nobody said where it lives), and a mapped prompt whose label has no traffic (retired, renamed, or a typo silently doing nothing). A mapped file that cannot be read is named too — the mapping exists; the file does not.