fix(usage): price Cursor cache savings by base model #13731
main fromfix/cursor-usage-cache-savings·merged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHubWhat Changed#
Cursor usage records now map tiered model names to their base model rate key. Cost and cache savings use that rate while provider-reported costs remain unchanged.
Why#
Cursor model names include tier and speed suffixes that do not match the pricing table keys. Mapping them to the base model lets cache savings use the correct rate.
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes
- I included a video for animation/interaction changes
Summary by CodeRabbit#
- Bug Fixes
- Cursor usage costs and cache savings now use matching base-model rates for recognized Claude and Grok variants, including names with tier or speed suffixes.
- When a provider reports a cost for a model variant, that reported cost is used. Models without a matching rate continue to show no cache savings.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 13.5 KiB 13.5 KiB −15 B (−0.1%) 15.1 KiB ✅ Codex Thread snapshot wire 7.1 KiB 7.1 KiB −4 B (−0.1%) 7.3 KiB ✅ Codex Live turn WebSocket wire 6.4 KiB 6.4 KiB −11 B (−0.2%) 7.8 KiB ✅ Codex Live turn WebSocket decoded 56.2 KiB 56.2 KiB 0 B (0.0%) 66.4 KiB ✅ Codex Live turn messages 9 9 0 (0.0%) 21 ✅ Claude Total thread wire 13.5 KiB 13.5 KiB −4 B (−0.0%) 15.1 KiB ✅ Claude Thread snapshot wire 7.1 KiB 7.1 KiB −3 B (−0.0%) 7.3 KiB ✅ Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB −1 B (−0.0%) 7.8 KiB ✅ Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅ Claude Live turn messages 9 9 0 (0.0%) 21 ✅ Baseline:
ed809f7· PR result:5c77e7d· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 114.0 KiB
- Claude decoded thread snapshot: 114.7 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Team
Run ID:
c2eef35d-37c7-4867-b174-3d6ee8f94bca📥 Commits
Reviewing files that changed from the base of the PR and between ed809f7ad274ebccdfbf029ccfd7ff2582fd486a and 5c77e7dec14bbc23e9cc798c2a1315c53ee5fd94.
📒 Files selected for processing (4)
apps/server/src/usage/cursorUsageReader.tsapps/server/src/usage/usagePricing.test.tsapps/server/src/usage/usagePricing.tsapps/server/src/usage/usageTranscripts.ts
Included review availability: This review used your included allowance. 9 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.
📝 Walkthrough
Walkthrough#
Cursor usage records now include a normalized rate-model key. Pricing and cache-savings calculations use that key for rate-table lookups when it is present, and otherwise use the displayed model name.
Changes#
Cursor rate-model pricing
Layer / File(s) Summary Define and populate rateModel
apps/server/src/usage/usageTranscripts.ts,apps/server/src/usage/cursorUsageReader.tsUsageRecordadds an optionalrateModel. Cursor records populate it with a normalized model name.Use rateModelfor pricing lookups
apps/server/src/usage/usagePricing.ts,apps/server/src/usage/usagePricing.test.tsRate-table lookups for usage pricing and cache savings use rateModelwhen present, otherwisemodel. Tests cover Cursor model variants, cache savings, and provider-reported cost precedence.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
t3dotggMerge Risk: ⚪ Minimal · up to
5c77eCursor usage pricing is ready to merge after normal checks; no actionable pricing regression was established.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Title check ✅ Passed The title clearly identifies the primary change: pricing Cursor cache savings by the base model. Description check ✅ Passed The description explains what changed and why, confirms the PR is focused, and does not require UI details because the changes are server-side. Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. - Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.Yash-Singh1(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This focused server change remaps Cursor’s tiered model names to base pricing keys and changes displayed usage pricing and cache-savings calculations. Because it directly affects production usage metering/pricing, it requires human review despite its limited scope.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).