Details on AI Code Tracking API

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.

  1. 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?
  2. 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.
  3. If an AI-suggested line is accepted and slightly modified, is it no longer counted as an AI line?
  4. Is the commit ID the same as the one shown in Git?

Thanks!

1 Like

hi @Jen I will answer your questions, due to many posts I did not find your thread earlier.

  1. Commits only from Cursor, not from other IDEs or GUIs as we have no access to those.
  2. As per point 1, only commits within Cursor are observable.
  3. It would be counted as accepted change. User may still adjust code independent of AI.
  4. All git based commits are unique IDs and will be shown in Git.
1 Like

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.

1 Like

hi @ssssssh what kind of indicators do you currently use?

Included Requests Used

@ssssssh Yes, the Cursor Admin API can return the Included Requests Used information per user, including details about the model and the token usage.

You can get this data from Admin API:

  • Use the /teams/filtered-usage-events endpoint. This returns granular usage events for your team.
  • Each usage event object includes:
    • userEmail: The user who performed the request
    • model: The AI model used (e.g., “gpt-5”, “claude-4-opus”)
    • kind: The usage type like “Included in Business” or “Usage-based”
    • requestsCosts: Requests used for this operation
    • If the call is token-based (isTokenBasedCall = true), a tokenUsage object:
      • inputTokens, outputTokens, cacheWriteTokens, cacheReadTokens, totalCents

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.

https://docs.cursor.com/en/account/teams/ai-code-tracking-api

I want to use “number of lines of code generated by AI” as this indicator, so I want to understand its principle

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.

  • nonAiLinesAdded, nonAiLinesDeleted: Manually added/deleted lines.

  • message: Commit message.

  • commitTs: Commit timestamp.

  • createdAt: When this data was ingested into the system.

For /analytics/ai-code/changes:

  • changeId: Unique identifier for the AI change.
  • userId, userEmail: Who made the change.
  • source: “TAB” (inline) or “COMPOSER” (tool).
  • model: AI model used, if available.
  • totalLinesAdded, totalLinesDeleted: How many lines were changed.
  • createdAt: Ingestion timestamp.
  • metadata: Array of impacted files, with each file including:
    • fileName
    • fileExtension
    • linesAdded
    • linesDeleted

Can the following 3 methods be counted?

  1. In Cursor, open the terminal and use git commit to submit the code
  2. In Cursor, submit code through the source control panel
  3. 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.

We can only count what occurs in Cursor IDE (Case 2) but I will ask the team if submission from terminal in Cursor are tracked (Case 1).

Case 3 (other IDE & terminals) can not be tracked as they are not within Cursor.

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”?

The counting is independent as it is per action:

  • User changes are counted as user changes
  • AI changes are counted as AI changes
  • Tab suggestions are counted as Tab suggestions.

From your scenario

  • When an AI suggested line from Tab is accepted it counts as Tab suggestion
  • When it is subsequently modified by user it counts also as user change for the user changed lines

So the answer is both. The same line can be modified by tab, user and AI in a sequence and count as a change for each.

(Composer is the original name for Chat Agent)