Skip to content

feat: add relay cost attribution estimator#1

Open
orban wants to merge 6 commits into
mainfrom
feat/cost-attribution-estimator
Open

feat: add relay cost attribution estimator#1
orban wants to merge 6 commits into
mainfrom
feat/cost-attribution-estimator

Conversation

@orban
Copy link
Copy Markdown
Owner

@orban orban commented Apr 3, 2026

Summary

  • add component invocation telemetry for relay hooks (post_tool_use, pack, pre_compact, reload, nudge)
  • add configurable per-component cost model (config.cost_model) and backward-compatible state backfill
  • compute/store deterministic per-component and total estimated cost in metrics.last_cost_report during pack
  • track async extraction attempts/runs and attribute extraction as its own component
  • document /relay costs command behavior and estimator limits in docs
  • add tests for schema defaults/backfill, counter helpers, deterministic attribution math, config fallback, and report formatting

Assumptions

  • this is an internal operational estimator for relay subsystem activity, not provider billing truth
  • costs are attributed by invocation counts multiplied by configurable unit rates

Example output

/relay costs reports a component table: invocation count, unit cost, estimated subtotal, plus total estimated cost and assumptions.

Validation

  • python -m pytest hooks/scripts/test_hooks.py -q (162 passed)

Note

Values are modeled estimates, not measured cloud billing data.

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