ListEnterpriseAIUserUsage
Lists enterprise AI usage grouped by user with effective monthly budget data.
Reports BYOK token spend (cost and tokens) for each user and service account with attributed usage in the date range, including each subject’s effective monthly budget. Usage not attributed to a user or service account is excluded, so the sum across subjects can be less than the organization totals from GetEnterpriseAIUsageSummary. The credits field is not populated by this endpoint.
Budget fields (month_to_date_usage, utilization_percent, over_budget) are computed from usage inside the requested date range measured against the monthly limit. Send a range that starts on the first day of the month for true month-to-date figures.
Use this method to:
- Export per-user BYOK AI spend to external reporting
- Identify the highest spenders in the organization
- Track per-user budget utilization and over-budget users
Only available for enterprise organizations.
Examples
-
List user usage for January:
Returns per-user BYOK spend with effective budgets, highest spend first. Both dates are inclusive and the range must not exceed 31 days.
organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" dateRange: startTime: "2024-01-01T00:00:00Z" endTime: "2024-01-31T00:00:00Z"
Authorization
Requires billing:read_usage permission on the organization. Callers
without it can read their own usage by setting filter.subject to
themselves.
Body ParametersJSON
ListEnterpriseAIUserUsage
curl https://app.gitpod.io/api/gitpod.v1.BillingService/ListEnterpriseAIUserUsage \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $GITPOD_API_KEY" \
-d '{
"dateRange": {
"endTime": "2024-01-31T00:00:00Z",
"startTime": "2024-01-01T00:00:00Z"
},
"organizationId": "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
}'{
"calculatedAt": "2019-12-27T18:11:19.117Z",
"pagination": {
"nextToken": "nextToken"
},
"totalCount": 0,
"userUsage": [
{
"budgetSource": "ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_UNSPECIFIED",
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"displayName": "displayName",
"isServiceAccount": true,
"monthlyCostLimitMicrounits": "monthlyCostLimitMicrounits",
"monthToDateUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"noCap": true,
"overBudget": true,
"userId": "userId",
"utilizationPercent": 0
}
]
}Returns Examples
{
"calculatedAt": "2019-12-27T18:11:19.117Z",
"pagination": {
"nextToken": "nextToken"
},
"totalCount": 0,
"userUsage": [
{
"budgetSource": "ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_UNSPECIFIED",
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"displayName": "displayName",
"isServiceAccount": true,
"monthlyCostLimitMicrounits": "monthlyCostLimitMicrounits",
"monthToDateUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"noCap": true,
"overBudget": true,
"userId": "userId",
"utilizationPercent": 0
}
]
}