Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(usage): scan Cursor, Grok, and OpenCode alongside Claude and Codex #6057

Closedlawrence-millard(GitHub profile, opens in a new tab)wants to merge 7 commits intomain fromrefs/pull/6057/headopened View on GitHub

What Changed

  • Extend the Usage scan beyond Claude/Codex so every built-in provider contributes daily (provider, model) buckets: Grok (~/.grok/logs/unified.jsonl), OpenCode (opencode*.db), and Cursor (usage-events CSV via local state.vscdb auth).
  • Bump USAGE_CONTRACT_VERSION to 4 and teach web + mobile usage chrome the new provider kinds.
  • Add a Cursor/OpenUsage pricing supplement and CSV slug aliases so auto, Composer, and other export names get API-equivalent costs instead of staying unpriced behind LiteLLM’s $0 OpenRouter auto stub.

Why

The Usage page only mirrored Claude/Codex local transcripts, so Cursor/Grok/OpenCode spend was invisible even when those CLIs were the ones doing the work. Cursor Auto and Composer also showed up as unpriced because public rate tables do not carry Cursor-native slugs. This keeps the existing scan → bucket → merge pipeline and fills the missing sources the same way OpenUsage does.

UI Changes

Before: Usage chart/legend only listed Claude Code and Codex.

After: the same page also shows Cursor, Grok, and OpenCode series (when those sources have data), including priced Cursor auto:

Usage page after: OpenCode, Cursor, Codex, Claude Code with priced auto

Validation

  • vp test run apps/server/src/usage/usageTranscripts.test.ts apps/server/src/usage/usageOpenCode.test.ts apps/server/src/usage/usageCursor.test.ts apps/server/src/usage/usagePricing.test.ts apps/server/src/usage/usageScanCache.test.ts packages/shared/src/usageMerge.test.ts apps/web/src/components/usage/UsageProviderChart.test.ts
  • Targeted typecheck for contracts, shared, server, web, and mobile

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • No animation or interaction changes require a video

Created with Composer in Cursor.

Made with Cursor

Note

Add Cursor, Grok, and OpenCode as usage sources alongside Claude and Codex

  • Extends the usage pipeline to scan Cursor state DB, Grok unified.jsonl, and OpenCode SQLite databases, fetching Cursor usage via authenticated CSV export from Cursor's API.
  • Adds usageCursor.ts and usageOpenCode.ts for provider-specific parsing, and extends usageTranscripts.ts to parse Grok log lines.
  • Adds pricing supplements, fast-variant multipliers, and slug alias rules in usagePricing.ts to resolve rates for Cursor and Grok model names not covered by public catalogs.
  • Updates web and mobile UI provider registries with labels, colors, and icons for the three new providers.
  • Risk: Cursor usage requires a live HTTP fetch to Cursor's export API using tokens read from the local state DB; network or auth failures are surfaced as per-source status messages rather than hard errors.
Macroscope summarized dcb8b54.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: cd9eab12-0588-4d11-88d9-b8f056995938

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR adds significant new functionality: scanning usage from Cursor (via network API with OAuth), Grok (log file parsing), and OpenCode (SQLite database reading). The substantial new integrations, network calls, and data processing logic warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Effect service conventions review of the new usage providers.

      One finding: the Cursor path performs outbound HTTP with the global fetch instead of the HttpClient service that UsageService already acquires from the environment, so that dependency is hidden from the Effect environment (no test layer, tracing, or interruption). Everything else in the diff (namespace imports of effect/* subpaths, Context.Service + make + layer shape, named imports for the pure usageOpenCode/usageTranscripts/usagePricing helpers, contract/scan-cache widening) matches the conventions.

      Posted via Macroscope — Effect Service Conventions
    5. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9157eae777f2cf204f6e94d715e7dd27689eb594. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.