Skip to content

fix(usage): fetch and compute Cursor quota/usage - #3367

Open
Villoh wants to merge 1 commit into
decolua:masterfrom
Villoh:fix/cursor-usage-quota
Open

fix(usage): fetch and compute Cursor quota/usage#3367
Villoh wants to merge 1 commit into
decolua:masterfrom
Villoh:fix/cursor-usage-quota

Conversation

@Villoh

@Villoh Villoh commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • register Cursor's Connect RPC dashboard endpoints (api2.cursor.sh DashboardService/GetCurrentPeriodUsage + GetPlanInfo) in the provider registry and flip features.usage so cursor joins USAGE_SUPPORTED_PROVIDERS
  • add getCursorUsage (open-sse/services/usage/cursor.js): POSTs GetCurrentPeriodUsage with the existing Bearer token + empty proto body, maps totalPercentUsed/autoPercentUsed/apiPercentUsed into the same percent-quota shape Claude/Codex already use, with a best-effort plan name from GetPlanInfo
  • wire the new handler into USAGE_HANDLERS and add the cursor case to parseQuotaData

Root cause

getUsageForProvider had no cursor entry in USAGE_HANDLERS at all, so every Cursor connection just fell through to the generic { message: "Usage API not implemented for cursor" } fallback — no request was ever made and the dashboard never showed real quota data.

Scope

Individual/Pro percent-of-limit accounts only. Team/enterprise pooled-dollar accounts and the request-based legacy fallback (cursor.com/api/usage + CSV export) aren't covered — noted inline in the registry so it's easy to pick up if reports come in from those account shapes.

Tests

  • cd tests && npx vitest run unit/cursor-usage.test.js (new — request shape, percent mapping, ratio fallback, error paths)
  • node tests/__baseline__/verify-providers.mjs (registry snapshot re-verified byte-for-byte, only the new usage/features fields differ, both already excluded from the diff check)
  • Manually verified against a live Cursor Pro connection in the dashboard — Total/Auto/API usage now render with correct percentages and reset countdown.

9Router never called any Cursor usage endpoint — getUsageForProvider
had no cursor handler in USAGE_HANDLERS, so the dashboard just showed
"Usage API not implemented for cursor".

- open-sse/providers/registry/cursor.js: register the Connect RPC
  usage/plan endpoints (api2.cursor.sh DashboardService) and flip
  features.usage so cursor joins USAGE_SUPPORTED_PROVIDERS.
- open-sse/services/usage/cursor.js: new handler — POSTs
  GetCurrentPeriodUsage (Bearer auth, empty proto body), maps
  totalPercentUsed/autoPercentUsed/apiPercentUsed into the same
  percent-quota shape claude/codex use, with plan name from the
  optional GetPlanInfo call.
- open-sse/services/usage.js: wire cursor into USAGE_HANDLERS.
- ProviderLimits/utils.js: add the cursor case to parseQuotaData.
- tests/unit/cursor-usage.test.js: request shape, percent mapping,
  fallback ratio, and error-path coverage.

Scope: individual/Pro percent-of-limit accounts only. Team/enterprise
pooled-dollar accounts and the request-based legacy fallback
(cursor.com/api/usage + CSV export) aren't covered — noted in the
registry comment for whoever picks that up next.

Verified against a live Cursor Pro connection in the dashboard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant