Repository navigation
fix(pi): honor pricing overrides in auto cost mode - #1816
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | c9630c4 | Commit Preview URL Branch Preview URL |
Oct 02 2026, 06:31 PM |
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
ccusage
commit: |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed head c9630c4 of PR #1816 against main, covering the Pi auto-mode pricing-override fix and its docs/tests.
- Pi auto-mode override precedence —
pricing_override_modelplussource_cost_for_modenow suppress the recordedusage.cost.totalwhen an override exists for the prefixed or bare model name, recalculating from tokens. - Store-aware pricing lookup —
store_pricing/store_pricing_atresolve the override key first viafind/find_at, keeping exact-match behavior for non-override display models. - Missing-pricing reporting —
missing_pricing_modelpaths use the override-resolved model with the suppressed source cost, so overridden custom models no longer surface as missing or silently cost$0.00. PricingMap::has_user_override— new helper checks the override map directly and throughCCUSAGE_MODEL_ALIASES, with alias-resolution test coverage.- Regression tests and docs — exact-cost assertions (5.0 recalculated vs 0.0 recorded) for default, named-store, and bare-key cases, plus override-key and cost-mode documentation.
The override precedence (prefixed display label wins over bare raw name), bare-key sharing across default and named stores, and unchanged display-mode behavior all match the documented intent. The new tests assert exact values that fail pre-fix, so they pin the behavior rather than absorbing it.
muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏

Pi's Auto cost mode preferred the session's stored
usage.cost.totalover explicitpricingOverrides, leaving custom gateway models at$0.00. Use the override for the prefixed or bare model name, including configured aliases, to calculate token costs for default and named Pi stores. Display mode still shows the recorded cost, and models without overrides retain their existing cost handling. Add regression coverage and document the override keys and cost modes.Closes #1810
Validation:
just check: all 11 Nix flake checks passed on this Macjust fmtandcargo fmt --all --manifest-path rust/Cargo.toml --checkjust typecheckjust test: 947 Rust tests and 34 Node tests passed; 3 existing Rust tests ignoredcargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets -- -D warningsjust hawk: 0 findingsCI is blocked by existing tirith findings in unchanged files: the base and PR commit both produce the same 17 findings (8 errors and 9 warnings) with tirith 0.4.2. Downstream tests and native builds were skipped; see the CI run.