Skip to content

Cursor usage always reports 0 — provider reads deprecated numRequests from /api/usage #7

Description

@leek

Summary

The Cursor menu bar entry always shows 0 usage, even for accounts with heavy activity. The root cause is that CursorUsageProvider reads the deprecated numRequests field from https://www.cursor.com/api/usage, which Cursor froze at 0 when it moved to credit/usage-based pricing in mid-2025.

Evidence

CursorUsageProvider.fetchUsageFromAPI() authenticates correctly (JWT is read from state.vscdb, the API returns HTTP 200), but the response body for a current-pricing account is:

{
  "gpt-4": { "numRequests": 0, "numRequestsTotal": 0, "numTokens": 0,
             "maxTokenUsage": null, "maxRequestUsage": null },
  "startOfMonth": "<redacted>"
}

CursorUsageProvider.swift:116 sums numRequests across the model buckets → 0. The account in question had hundreds of dollars of real model usage in the same billing period, so this is not a "no usage" case — the field itself is dead under the new pricing model.

This is consistent with the in-app note in SettingsView.swift:292: "Credit-based pricing since June 2025." The provider was never updated to match.

Where the real usage lives

Cursor's dashboard now reports usage from:

POST https://cursor.com/api/dashboard/get-aggregated-usage-events
Headers: Cookie: WorkosCursorSessionToken=<userId>::<jwt>
         Origin: https://cursor.com          # required — CSRF guard, 403 without it
         Content-Type: application/json
Body:    { "teamId": -1, "startDate": "<ms epoch>", "endDate": "<ms epoch>" }

Response (HTTP 200) includes per-model token breakdown plus authoritative totals:

{
  "aggregations": [ { "modelIntent": "...", "inputTokens": "...",
                      "outputTokens": "...", "totalCents": 12345.6, "tier": 1 }, ... ],
  "totalInputTokens": "...", "totalOutputTokens": "...",
  "totalCostCents": 53285.77
}

totalCostCents / 100 is the dollar spend the Cursor dashboard shows for the period.

Proposed fix

Switch the Cursor provider to report dollars spent this billing period (totalCostCents) against a per-plan USD allotment, using the .dollars unit that UsageData/UsageUnit and the UI (DetailPopoverView, UsageHistoryTabView) already support. The existing /api/usage call can be kept solely for startOfMonth (billing anchor + reset time).

I have a working patch + updated tests and will open a PR referencing this issue.

Environment

  • AgentBar main
  • macOS, Cursor desktop with local state.vscdb present and a valid session token
  • Account on Cursor's current credit-based pricing (Ultra), API reachable and returning 200

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions