I really appreciate the AI code tracking endpoint added to the Enterprise plan!
It will really help us learn more about the usage of Cursor in our codebases.
I have some questions regarding how the data is collected and measured.
Which commits are actually recorded? I assume it’s from git push in the Cursor terminal, but does it also count pushes from other IDEs or GUIs?
Can user settings prevent commit or code change data from being recorded (e.g., telemetry off)? Asking to check if there could be any user data missing from the API result.
If an AI-suggested line is accepted and slightly modified, is it no longer counted as an AI line?
Is the commit ID the same as the one shown in Git?
This feature is really useful for our team, but I want to understand how it works so I can confirm whether we can use it as a key indicator for our team.
This means you can fetch usage events by user and aggregate/inspect for:
Which requests came from included (subscription) quota
The model used for each request
Token-level statistics where available
Filter for kind: "Included in Business" if you want only those requests that are covered by the subscription (included requests). The data granularity is at the individual usage event level, so you may need to sum or group by user to get totals per user per month.
The “number of lines of code generated by AI” is calculated from each new or modified line of code in git: either an AI tool (such as Cursor’s TAB completions or Composer/Chat suggestions) or manual/human input.
Details:
Every time code is added or changed, Cursor’s tooling tags those edits as either “AI-generated” (via TAB completions or in Chat) or as “non-AI” (manual typing).
When a commit is made, the API aggregates how many lines in that commit were:
Added via TAB completions (AI inline suggestions)
Added via Composer (Chat)
Added manually (non-AI)
The sum of tabLinesAdded and composerLinesAdded for a commit/change gives you the total number of lines generated by AI for that operation.
These numbers can be viewed per-commit, per-developer, per-branch, or per-repo using the /analytics/ai-code/commits and /analytics/ai-code/changes endpoints, which report these fields as part of their responses.
The API response for AI code tracking contains, per commit or code change, a JSON object with the following key fields:
For AI Code changes only /analytics/ai-code/commits:
commitHash: Git commit hash.
userId: (Encoded ID) Who made the commit.
userEmail: Email of the developer.
repoName: Repository name.
branchName: Name of the branch.
isPrimaryBranch: Whether this is the default branch.
totalLinesAdded, totalLinesDeleted: Total lines changed in the commit.
tabLinesAdded, tabLinesDeleted: Lines changed using AI inline completions (TAB).
composerLinesAdded, composerLinesDeleted: Lines changed using AI Composer tool.
In Cursor, open the terminal and use git commit to submit the code
In Cursor, submit code through the source control panel
In Other IDE or Other terminals, such as iterms2
I tried to generate a rule through the agent, accepted it in chat, and finally submitted it through the source control panel. However, I found that these codes were not counted as AI generated.
Thank you for your response!
I have a follow-up question.
for “3. If an AI-suggested line is accepted and slightly modified, is it no longer counted as an AI line?”, you said “It would be counted as accepted change. User may still adjust code independent of AI.”.
Suppose a user accepts auto-complete (tab), fix that line a little, and commit the line. Will it be counted as tabLinesAdded? I’m a bit confused - even if the code is changed by a lot after the “tab”? Also, if so, is it same with the “composer”?