pricingOverrides is silently ignored for the pi subcommand (works correctly for claude)
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
- Have some usage data under
~/.pi/agent/sessions/**/*.jsonlfor a model that isn't in the bundled LiteLLM pricing data (e.g. a custom OpenAI-compatible gateway model). - Create a config file:
{
"$schema": "https://ccusage.com/config-schema.json",
"defaults": {
"pricingOverrides": {
"[pi] my-custom-model": {
"inputCostPerToken": 999,
"outputCostPerToken": 999
}
}
}
}- Run:
ccusage --config ./config.json pi monthly --json- The
costfield for[pi] my-custom-modelinmodelBreakdownsis still0, even with an absurd override rate of999.
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 thepiagent)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
--configfile (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 thepi-specific issue above (theclaudesubcommand 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.
Source: ccusage/ccusage