Skip to content

feat: per-provider cost tracking with drain/reset for periodic reporting #4

Closed

Description

@stackbilt-admin

Context

AEGIS v1.70.0 added a CostTracker to its resilience module that accumulates per-provider costs (input/output tokens, request count, total cost). The standalone llm-providers package has a CostTracker in utils/cost-tracker.ts but it's more complex and less edge-friendly.

Desired Additions

  1. drain() method — snapshot + reset for periodic reporting (e.g. hourly cost digests)
  2. Token-level tracking — inputTokens and outputTokens per provider, not just cost
  3. Edge-friendly — no dependencies beyond what CF Workers supports

The existing CostTracker has cost optimization and weighted scoring that's useful but the basic accumulation + drain pattern is what AEGIS needs for parity.

Reference

aegis-daemon/web/src/kernel/resilience.ts — CostTracker class and ProviderCostEntry interface.

Activity

  1. added
    enhancement
    on Mar 30, 2026
  2. stackbilt-admin commented on Mar 30, 2026

    @stackbilt-admin
    MemberAuthor

    Shipped in 99b5220. drain() method, token-level tracking (inputTokens/outputTokens), ProviderCostEntry interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions