API / get-model-usage-via-analytics-api

API

Get model usage with the Analytics API

Pull team-level AI model usage with GET https://api.cursor.com/analytics/team/models. Official reference: Analytics API → Model Usage.

Authenticate with Basic auth (API key as username, empty password). Create keys at Cursor Dashboard → API Keys. Most Analytics endpoints need scope admin:*. Availability: Enterprise only. Team-level rate limit: 100 requests per minute per team (by-user Analytics endpoints: 50/min).

Query parameters

Parameter Rules
startDate Optional. Default: 7 days ago. Prefer YYYY-MM-DD, or shortcuts now / today / yesterday / Nd. Max range 30 days. Time is ignored.
endDate Optional. Default: today. Same formats as startDate.
users Optional. Comma-separated emails and/or public user ids (user_…). Mix formats allowed.

Request

curl -X GET "https://api.cursor.com/analytics/team/models" \
  -u YOUR_API_KEY:

Filter to a cohort:

curl -X GET "https://api.cursor.com/analytics/team/models?startDate=7d&endDate=today&users=alice@example.com,bob@example.com" \
  -u YOUR_API_KEY:

Example response:

{
  "data": [
    {
      "date": "2025-01-15",
      "model_breakdown": {
        "claude-sonnet-4.5": {
          "messages": 1250,
          "users": 28
        },
        "gpt-4o": {
          "messages": 450,
          "users": 15
        },
        "claude-opus-4.5": {
          "messages": 320,
          "users": 12
        }
      }
    }
  ],
  "params": {
    "metric": "models",
    "teamId": 12345,
    "startDate": "2025-01-01",
    "endDate": "2025-01-31"
  }
}

Response fields

Field Type Meaning
date string Day covered (YYYY-MM-DD)
model_breakdown object Map of model id → usage counters for that day
model_breakdown.<modelId>.messages number Messages attributed to that model
model_breakdown.<modelId>.users number Distinct users who used that model
params.metric string Echoes models
params.teamId number Team id
params.startDate / params.endDate string Resolved range

Model keys in model_breakdown are dynamic strings from the sample (e.g. claude-sonnet-4.5, gpt-4o). Parse the object keys at runtime; the set of keys follows the team’s model mix.

Caching

Reuse response ETag headers with If-None-Match. 304 Not Modified does not count against the rate limit. Analytics endpoints advertise Cache-Control: public, max-age=900. See API Overview → Caching.

Pitfalls

  • Assuming a fixed list of model ids — the breakdown map keys change as the team’s model mix changes.
  • Crossing the 30-day date cap.
  • Calling Admin/Organization model-access configuration endpoints for usage volume — those configure which models are allowed. Usage volume is this Analytics models metric.
  • Ignoring users when you only need a subset — filtering cuts query work and payload size.

Sibling how-tos: Get agent edits, Get tab usage, Get daily active users.