Skip to main content

When To Use This

Use tm cost to see what you spent and what KV caching saved you, without configuring a separate cost-tracking proxy. Spend comes from BillingTransaction.details (populated by the billing service at charge time, so it reconciles with the ledger). Cache savings is cached_tokens x input rate — what those tokens would have cost at full price, served at ~$0 by the cache. Cache savings is always computed over the exact window. Per-model dollar spend is calendar-month granular (one serverless transaction per user per month): --month YYYY-MM is exact, while --window 24h|7d|30d and --start/--end report the overlapping monthly spend (noted in the output).

Usage

Examples

Last 30-day spend + cache savings, per model.

Last 7-day total (per-model defaults to current month).

Exact calendar-month spend + savings for May 2026.

Exact-window spend + cache savings.

Machine-friendly JSON for piping into other tools.

Details

Show per-model serverless spend and KV-cache savings. Spend comes from BillingTransaction.details (authoritative, reconciles with the ledger; calendar-month granularity). Cache savings is computed as cached_tokens x input rate — the cost those tokens would have incurred at full input price, served at ~$0 thanks to caching — with cached tokens read from the serverless usage history for the exact window. Every view shows the same shape: a per-model table plus the serverless subtotal and total cache saved. --window 24h|7d|30d (rolling), --month YYYY-MM (exact calendar month), and --start/--end (exact range) just change the window. Cache savings is always window-exact; per-model dollar spend is calendar-month granular (the finest the ledger records), so every view except --month notes that.

Options

Inherited Global Options

Parent Command