Skip to content

fix(usage): price Cursor cache savings by base model - #13731

Merged
Yash-Singh1 merged 1 commit into
mainfrom
fix/cursor-usage-cache-savings
Sep 26, 2026
Merged

Yash-Singh1 merged 1 commit into
mainfrom
fix/cursor-usage-cache-savings

Conversation

@Yash-Singh1

@Yash-Singh1 Yash-Singh1 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

What 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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 26, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown
Contributor

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: success

Scenario 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.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Review in Change Stack →

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 ed809f7 and 5c77e7d.

📒 Files selected for processing (4)
  • apps/server/src/usage/cursorUsageReader.ts
  • apps/server/src/usage/usagePricing.test.ts
  • apps/server/src/usage/usagePricing.ts
  • apps/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.ts
UsageRecord adds an optional rateModel. Cursor records populate it with a normalized model name.
Use rateModel for pricing lookups
apps/server/src/usage/usagePricing.ts, apps/server/src/usage/usagePricing.test.ts
Rate-table lookups for usage pricing and cache savings use rateModel when present, otherwise model. 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: t3dotgg

Merge Risk: ⚪ Minimal · up to 5c77e

Cursor 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
Yash-Singh1 merged commit aade3a6 into main Sep 26, 2026
24 checks passed
@Yash-Singh1
Yash-Singh1 deleted the fix/cursor-usage-cache-savings branch September 26, 2026 00:27
@Yash-Singh1
Yash-Singh1 restored the fix/cursor-usage-cache-savings branch September 26, 2026 00:28
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 26, 2026
## What's Changed
* feat(desktop): honor the standard OTLP variables in the main process and WSL backends by @yordis in pingdotgg/t3code#13641
* fix(web): restore compact provider instance badges by @t3-code[bot] in pingdotgg/t3code#13700
* perf(mobile): lighter Home rows away from the viewport by @AKolenda in pingdotgg/t3code#13702
* fix(usage): price Cursor cache savings by base model by @Yash-Singh1 in pingdotgg/t3code#13731
* perf(mobile): render Home rows further ahead while scrolling by @AKolenda in pingdotgg/t3code#13705
* refactor(observability): name each service after its application by @yordis in pingdotgg/t3code#13699
* perf(server): stop remapping every thread on each thread event by @t3dotgg in pingdotgg/t3code#13720
* Remove unused items tracking from Claude adapter state by @t3dotgg in pingdotgg/t3code#13718
* feat(observability): name the command on subprocess spans by @t3dotgg in pingdotgg/t3code#13701
* fix(cli): t3 triage points agents at log files that exist by @t3dotgg in pingdotgg/t3code#13685
* fix(server): the SQLite WAL file shrinks back after large writes by @t3dotgg in pingdotgg/t3code#13684
* feat(cli): summarize the server trace file from the command line by @t3dotgg in pingdotgg/t3code#13698
* perf(server): pull request sync reads only threads with linked pull requests by @t3dotgg in pingdotgg/t3code#13704

## New Contributors
* @AKolenda made their first contribution in pingdotgg/t3code#13702

**Full Changelog**: pingdotgg/t3code@v0.0.43-nightly.20260925.2269...v0.0.43-nightly.20260926.2282

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.43-nightly.20260926.2282
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant