Skip to content

Implement CostTracker with daily budget limits #378

@bug-ops

Description

@bug-ops

Epic: #366

Description

Track token usage and estimated cost per model with configurable daily budget cap.

Design

[cost]
enabled = true
max_daily_cents = 500

Tasks

  • CostTracker struct with record_usage(model, prompt_tokens, completion_tokens)
  • Per-model pricing table (configurable, defaults for Claude/OpenAI/Ollama)
  • check_budget() -> Result<(), BudgetExhausted>
  • Agent loop calls check_budget() before each LLM request
  • Daily reset at midnight UTC
  • TUI metrics panel shows current spend / budget
  • Unit tests with mock pricing

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions