Repository navigation
Description
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.
Activity
pullfrog commentedon Sep 27, 2026
github-actions commentedon Sep 27, 2026
Pullfrog triage: priority:medium
Kind: bug
Maintenance fit: needs review
Confidence: medium
Pullfrog was not highly confident; maintainer review is required. Docs promise pricingOverrides for pi models including [pi] prefixed keys, and pi code loads overrides, but the reporter shows zero cost with extreme override values while claude works. Root cause is unconfirmed between override lookup and auto mode preferring stored display cost, plus a separate silent config load observation, so human triage is needed.
Decision: left open for maintainer review.
ryoppippi commentedon Sep 27, 2026
@pullfrog implement a pr
pullfrog commentedon Sep 27, 2026
Fixed
pricingOverridesbeing ignored for thepisubcommand inAutomode.Root cause: the pi parser treated any stored
cost.totaldisplay cost as authoritative inAutomode, so a[pi] modeloverride never recalculated the cost. Claude has no stored cost for custom models, which is why it worked there.Changes on branch
pullfrog/1810-pi-pricing-overrides-auto:PricingMap::has_user_overrideinrust/crates/ccusage-core/src/pricing.rs(exact plus alias-resolved lookup).rust/adapters/pi/src/parser.rs,Automode now drops the stored display cost (for both cost and missing-pricing paths, default and named stores) when either the[pi]/[store]display key or raw model has a user override, so override rates win.Displaymode still shows stored cost, and non-overridden models are unchanged.auto_prefers_pricing_override_over_display_costcovering default/named stores, no-override passthrough, and Display passthrough.Validation:
ccusage-adapter-pi33 passed,ccusage-core183 passed,ccusage-adapter-all48 passed,ccusagebinary tests 79+11+4+3+1 passed;cargo fmt --checkandclippy -D warningsclean for touched crates.Could not open a PR:
pullfrog_push_branchfailed withremote: Permission to ccusage/ccusage.git denied to github-actions[bot]. fatal: unable to access 'https://github.com/ccusage/ccusage.git/': The requested URL returned error: 403. The commit is local onpullfrog/1810-pi-pricing-overrides-autoand the working tree is clean. A maintainer with push permission can push that branch and open the PR.Task list (5/5 completed)
Muse Spark Contributor(free via Pullfrog for OSS) | 𝕏