Skip to content

fix(usage): price Cursor Claude model aliases - #13830

Open
duncan-vc wants to merge 1 commit into
pingdotgg:mainfrom
duncan-vc:fix/cursor-usage-accounting
Open

duncan-vc wants to merge 1 commit into
pingdotgg:mainfrom
duncan-vc:fix/cursor-usage-accounting

Conversation

@duncan-vc

@duncan-vc duncan-vc commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Cursor reports Claude model IDs such as claude-4.5-sonnet and claude-4.6-opus-high-thinking. The rate table uses claude-sonnet-4-5 and claude-opus-4-6, so these records still show zero cache savings after #13731. When Cursor omits a cost, the same mismatch leaves the record unpriced.

Extend the existing Cursor rate-name helper to normalize version-first Claude names and strip recognized effort/thinking suffixes in either order. The reader keeps the original display model; provider-reported costs and exact-model custom prices retain their existing precedence. All clients receive the corrected server usage summary.

The version-first name is documented in Cursor's usage API examples, and the -high-thinking ordering is already present in this repo's Cursor provider fixtures. No existing open PR covers this normalization gap.

Validation:

  • The new pricing regression fails on current main with unpriced instead of modelPriced, then passes with the fix.
  • 46 focused tests passed across usage pricing, transcript readers, and aggregation, including preserved provider-reported costs and display model names.
  • Server typecheck, targeted lint, formatting, and git diff --check passed.
  • No browser or live-provider run; this is a server parsing/pricing change with no client UI edits.

Model: GPT-6. Harness: Codex.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected pricing for Cursor usage reported with version-first Claude model names, including reasoning and speed variants.
    • Preserved reported provider costs when available.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 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 production change alters Cursor usage pricing and cache-savings calculations by normalizing additional Claude model aliases. Although the logic is localized and tested, pricing/metering changes require human review.

You can add or adjust custom eligibility rules. Learn more.

@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: Advanced

Run ID: 172ca919-6985-4bca-909d-38164a430354

📥 Commits

Reviewing files that changed from the base of the PR and between 95030dc and 3acfa41.

📒 Files selected for processing (3)
  • apps/server/src/usage/cursorUsageReader.ts
  • apps/server/src/usage/usagePricing.test.ts
  • apps/server/src/usage/usageTranscriptReader.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Cursor Claude model names now map to canonical rate-table keys after supported trailing modifiers are removed. Pricing and transcript tests cover version-first names and provider-reported costs.

Changes

Cursor Claude rate model normalization

Layer / File(s) Summary
Normalize Cursor model names and validate rate lookup
apps/server/src/usage/cursorUsageReader.ts, apps/server/src/usage/usagePricing.test.ts, apps/server/src/usage/usageTranscriptReader.test.ts
cursorRateModel strips supported trailing modifiers and maps version-first Claude names to family-first rate-table keys. Tests cover canonical pricing, cache savings, provider-reported cost precedence, and transcript model fields.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 3acfa

The Cursor Claude alias change has no identified issue that needs resolution before merge; normal checks still apply.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 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 and concisely identifies the main change: pricing Cursor Claude model aliases.
Description check ✅ Passed The description explains what changed, why it changed, UI impact, and validation results. It omits the template's Checklist section, but the required information is otherwise mostly complete.
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
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant