Skip to content

feat: runtime pricing overrides via config #1198

@xiaoMaJia707

Description

@xiaoMaJia707

What do you want to change?

Add runtime pricing overrides via ccusage.json, and make the Pi adapter respect CostMode when calculating cost.
Today Pi logs always write usage.cost.total = 0, and the Pi parser takes that value verbatim. That means Pi usage shows $0.00 in Auto mode even when token usage is present.
I'd like to:

  • make Pi use calculate_cost_for_usage(...) instead of trusting usage.cost.total
  • add a pricingOverrides config section so users can override per-model pricing and context limits at runtime

Why?

Fuzzy model matching already covers most naming differences, so the built-in pricing works well in many cases.
But there are still real cases where users need local overrides:

  • Pi logs do not include usable cost data
  • private deployments / internal proxies may use non-public pricing
  • LiteLLM pricing can be stale
  • custom models may need maxInputTokens
  • some models may not be in LiteLLM yet

How? (optional)

  • Add pricingOverrides to config, keyed by model name
  • Extend PricingMap to apply overrides after embedded / LiteLLM pricing is loaded
  • Allow overrides for token pricing fields, cache pricing, fastMultiplier, and maxInputTokens
  • Pass the resolved pricing map into Pi parsing so Pi cost follows normal Display / Auto / Calculate behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions