Skip to content

Operator inference-cost tracker under ?ops - #6

Merged
msitarzewski merged 1 commit into
mainfrom
feat/ops-cost-tracker
Aug 26, 2026
Merged

msitarzewski merged 1 commit into
mainfrom
feat/ops-cost-tracker

Conversation

@msitarzewski

Copy link
Copy Markdown
Owner

Summary

Adds an operator-only inference cost tracker (Hourly / Daily / Weekly / Monthly) behind the ?ops flag.

  • Records usage — call_inference captures the API usage block (even on empty responses, since those tokens are still billed); aggregate_once logs each call's tokens to a new inference_usage table. Pure-additive V2 schema — no migration, existing DBs gain it on next open.
  • Prices it — LLM_PRICES + inference_cost_usd (gpt-5.6-luna = $0.20/M in, $1.20/M out; local/unknown models free). read_feed sums per-model tokens over 1H/24H/7D/30D windows and attaches the dollar cost to the pipeline payload.
  • Shows it — a cost row in the header, gated by ?ops exactly like the pipeline-health strip and status pill (verified flex under ?ops, none for public).

Tests

New coverage for usage capture (including the empty-response path), pricing, and the windowed token sums. Suite green except pre-existing environment-only failures (Linux systemd service-handoff tests; one macOS socket-timing flake).

🤖 Generated with Claude Code

- Record token usage per inference call: call_inference captures the API usage
  block (even on empty responses — those tokens were still billed) and
  aggregate_once logs each call to a new additive inference_usage table
  (no migration; existing DBs gain it on next open).
- Price it: LLM_PRICES + inference_cost_usd (gpt-5.6-luna $0.20/M in, $1.20/M
  out; local/unknown models free). read_feed sums per-model tokens over
  1H/24H/7D/30D windows and attaches the dollar cost to the pipeline payload.
- Show it: an operator-only cost row in the header, gated by ?ops like the rest
  of the telemetry (hidden for public visitors).
- Tests for usage capture (incl. empty-response), pricing, and windowed sums.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@msitarzewski
msitarzewski merged commit 16ae398 into main Aug 26, 2026
12 checks passed
@msitarzewski
msitarzewski deleted the feat/ops-cost-tracker branch August 26, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant