Skip to content

fix: use catalog cache read multipliers in client savings - #1071

Open
Elioooon wants to merge 2 commits into
workweave:mainfrom
Elioooon:fix/pi-cache-read-multiplier
Open

fix: use catalog cache read multipliers in client savings#1071
Elioooon wants to merge 2 commits into
workweave:mainfrom
Elioooon:fix/pi-cache-read-multiplier

Conversation

@Elioooon

Copy link
Copy Markdown

Summary

  • generate each model's effective cache-read multiplier alongside client pricing
  • use routed and requested model multipliers independently in Pi and Claude Code savings calculations
  • include cache-read multipliers in the Pi pricing version and verify generated artifacts against the catalog

Fixes #1003.

Validation

  • go test ./cmd/genprices ./internal/observability/otel
  • bun test install/pi-router/test/savings.test.ts (8 passed)
  • bash install/tests/cc-statusline_test.sh (47 passed)
  • bash -n install/cc-statusline.sh install/install.sh
  • git diff --check origin/main...HEAD

Scope

Cache creation remains at the existing 1.25x multiplier; this change is limited to cache reads. Missing prices or multipliers continue to fail closed instead of reporting fabricated savings.

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

This conforms to our conventions — no changes needed, and thank you, this is a careful piece of work.

Reviewed against root AGENTS.md and the existing pricing patterns. A few things I liked: the multipliers come from catalog.Pricing.EffectiveCacheReadMultiplier() rather than a hand-maintained table, so internal/router/catalog stays the single source of truth; the cache_read block goes inside the generated BEGIN/END_GENERATED_PRICES region and is produced by cmd/genprices instead of being hand-edited; routed and requested sides each get their own multiplier (the asymmetry is the actual bug, and the pi + statusline tests pin it with a concrete number rather than recomputing the formula); the missing-multiplier case still fails closed to 0 savings instead of fabricating a number; and folding the multiplier into pricingVersion's canonical string means a multiplier-only catalog change still invalidates stale on-disk copies. Keeping cache creation at 1.25× and saying so in the header comment is the right scope call.

Verified locally: go test ./cmd/genprices ./internal/observability/otel pass, re-running the generator produces no drift from the artifacts committed here, the install.sh embedded copy is byte-identical to install/cc-statusline.sh's block, bash -n clean on both scripts, and install/tests/cc-statusline_test.sh is 47/47.

@Elioooon
Elioooon force-pushed the fix/pi-cache-read-multiplier branch from 68a60b8 to cea6bbe Compare August 28, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant