Spend & telemetry
Every proxied request writes one row to local SQLite with Basis: "inferred". The proxy is single-operator and local; it does not certify savings and does not project them into monthly totals. The proxy is BSL 1.1.
The store lives at ~/.caveman/caveman.db unless CAVEMAN_DB overrides it. It uses pure-Go SQLite and implements the proxy's TelemetrySink.
What gets recorded
A row captures metadata, not payload contents: provider, model, route, status, latency, byte counts, token usage parsed from the provider response, and derived cost. Recording is best-effort. A write failure is logged and does not break traffic.
Every row is inferred, full stop
The standalone proxy writes Basis: "inferred" on every row. It never writes verified. Local figures are not re-projected to monthly savings.
Reading the spend: caveman-proxy stats
The stats subcommand opens the store, aggregates across all recorded requests, and
prints the summary as JSON, then exits.
./bin/caveman-proxy statsA representative output shape (example values — yours reflect your own traffic):
{
"requests": 128,
"total_cost_usd": 4.371928,
"savings_usd": 0.612045,
"basis": "inferred"
}requests is the row count. total_cost_usd and savings_usd are sums across local rows. basis is always "inferred" in standalone.
The honesty invariants
Three rules bind this store, and they are correctness, not style:
- Inferred only. Standalone records
inferredon every row. - Never monthly. Summary output reflects rows that actually ran.
- Best-effort. Failed telemetry writes are logged and dropped; traffic still goes through.