Skip to content

feat(cursor): show remaining included usage from dashboard limits API - #273

Open
florianbehrend wants to merge 3 commits into
chattymin:mainfrom
florianbehrend:feat/cursor-limits
Open

florianbehrend wants to merge 3 commits into
chattymin:mainfrom
florianbehrend:feat/cursor-limits

Conversation

@florianbehrend

@florianbehrend florianbehrend commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #272. Adds Cursor official limits to the popover — monthly included allowance, remaining dollars, and auto/API usage split — fetched from Cursor's undocumented Connect RPC endpoint on api2.cursor.sh.

  • Endpoint: POST /aiserver.v1.DashboardService/GetCurrentPeriodUsage (Bearer JWT + Connect-Protocol-Version: 1)
  • Auth: same local Cursor login as usage events (cursorAuth/accessToken in state.vscdb, or CURSOR_SESSION_TOKEN); on 401 retries once via cursorAuth/refreshToken
  • UI: Cursor tab shows monthly % bar, remaining spend, optional auto/API rows, billing-cycle reset countdown; menu bar limit line when Cursor was used today
  • Disable: respects CURSOR_USAGE_API=0 (shared with usage-events fetch)
  • Docs: README data sources + Privacy updated for api2.cursor.sh in en/ko/ja (13 outbound hosts)
image

Type of change

  • New feature
  • Bug fix
  • Refactor / cleanup
  • Documentation
  • Other:

Checklist

  • swift build passes locally
  • PR title and description are written in English
  • Tests added (CursorLimitsTests: JSON parsing, Bearer/Connect headers, used-percent fallback)
  • README Privacy + data sources updated

Test plan

  • swift build succeeds on macOS 14+
  • Signed-in Cursor session: popover Cursor tab shows Limits (official) with monthly % and remaining dollars matching dashboard
  • Expired JWT: session-expired notice appears; signing into Cursor IDE restores limits on next refresh
  • CURSOR_USAGE_API=0 skips both usage events and limits fetch
  • Menu bar limit line shows Cursor NN% when Cursor has usage today and limit display is enabled

Out of scope

  • Enterprise /auth/usage request-bucket plans
  • On-demand / team pooled spend (spendLimitUsage) UI

Fixes chattymin#272. Fetches Cursor's monthly included allowance from the
undocumented Connect RPC endpoint GetCurrentPeriodUsage on
api2.cursor.sh, using the same local Cursor login as usage events.

- CursorRateLimitsProvider with Bearer JWT auth and refresh retry
- Popover limits section: monthly %, remaining dollars, auto/API split
- Menu bar limit line when Cursor was used today
- README privacy/docs updated for api2.cursor.sh (en/ko/ja)
Swift requires memberwise initializer arguments to follow declaration
order; CI failed on totalPercentUsed before includedSpend.
Resolve README conflicts in all three locales: keep main's Aside provider
in the on-device list and re-add the api2.cursor.sh outbound host from this
branch (twelve -> thirteen hosts).
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.

feat(cursor): show remaining included usage from dashboard limits API

1 participant