Skip to content

pricing drift --apply should recalculate historical costs in DB #83

Description

@nujovich

Problem

When hermes telemetry pricing drift --apply updates pricing.yaml with corrected prices, historical costs in the telemetry DB remain frozen with old (higher) prices. The dashboard mixes old-price and new-price costs, making budget tracking unreliable.

Real-world example

Model Old price New price
moonshotai/kimi-k2.6 $0.66/$3.41 $0.5472/$2.736
deepseek-v4-pro $0.435/$0.87 $0.348/$0.696
  • Cron session with 4.9M tokens: dashboard shows $3.78, real cost ~$3.25 (−14%)
  • Telegram session with 460K tokens: dashboard shows $0.30, real cost ~$0.19 (−37%)

Suggested behavior

After pricing drift --apply, recalculate cost_usd in llm_calls for rows where estimated=0 and provider_assumed=0 (they had explicit pricing at the old rate). Could be a --recalculate flag or a separate pricing recalculate subcommand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions