Skip to main content

Module cost

Module cost 

Source
Expand description

Per-model proxy savings accounting.

Headroom’s per-model cost breakdown was the one metric a tester found clearer than lean-ctx’s single flat number. This module buckets request-side savings by model and prices them with the shared ModelPricing table so /status can report estimated USD avoided per model.

Honesty contract: token counts here are request-side estimates (the bytes the proxy removed before forwarding). They deliberately do NOT try to model re-reads the agent may perform later, so figures are conservative and labelled estimated in the output.

Structs§

ModelStat
One model’s aggregated, priced savings for the /status endpoint.

Functions§

record
Records one request’s request-side savings against its model bucket.
snapshot
Returns per-model stats, priced and sorted by USD saved (descending).