#1810·ccusage

pricingOverrides is silently ignored for the pi subcommand (works correctly for claude)

Author: mixxerCreated Sep 27, 2026Updated Sep 27, 2026
Labelsbugpriority:mediumtriage:needs-review

Bug description

pricingOverrides from a config file works correctly for the claude subcommand, but is silently ignored for the pi subcommand. Prices for pi-tracked custom/local-gateway models always compute as $0.00, even when the override contains an obviously-wrong extreme value.

Reproduction

  1. Have some usage data under ~/.pi/agent/sessions/**/*.jsonl for a model that isn't in the bundled LiteLLM pricing data (e.g. a custom OpenAI-compatible gateway model).
  2. Create a config file:
json
{
  "$schema": "https://ccusage.com/config-schema.json",
  "defaults": {
    "pricingOverrides": {
      "[pi] my-custom-model": {
        "inputCostPerToken": 999,
        "outputCostPerToken": 999
      }
    }
  }
}
  1. Run:
bash
ccusage --config ./config.json pi monthly --json
  1. The cost field for [pi] my-custom-model in modelBreakdowns is still 0, even with an absurd override rate of 999.

Comparison — claude subcommand works as expected

Using the same override shape but targeting a model name from claude usage data (e.g. claude-sonnet-5) and running ccusage --config ./config.json claude monthly --json DOES apply the override — the cost for that model jumps to a correspondingly huge number. So pricingOverrides itself is implemented and works; it's specifically the pi subcommand's cost calculation path that never consults it.

What I tried (all failed to move the pi subcommand's cost off zero)

  • defaults.pricingOverrides (top-level, matches the documented example)
  • pi.defaults.pricingOverrides (namespaced under the pi agent)
  • pi.commands.monthly.pricingOverrides (command-scoped)
  • All of the above simultaneously, with both [pi] <model> and bare <model> as the key
  • Extreme values (999) to rule out a rounding/precision issue rather than a total no-op

Environment

  • ccusage version: 20.0.24 (latest at time of writing)
  • Installed via npm install -g ccusage
  • Tested on both Node v22.23.2 (macOS and Linux) — same result on both
  • Also confirmed that an intentionally malformed --config file (invalid JSON) produces no error and the command still runs — suggesting config loading may be silently swallowing failures, though I couldn't confirm whether that's the same root cause as the pi-specific issue above (the claude subcommand does successfully apply overrides from a well-formed file, so config loading isn't universally broken).

Expected behavior

pricingOverrides should apply to pi subcommand cost calculations the same way it does for claude, codex, etc.