GetEnterpriseAIUsageTimeSeries
Returns daily enterprise AI usage totals for the organization.
Each day reports BYOK token spend (cost and tokens) with per-user, per-team, and per-model breakdowns. Per-user entries cover the top spenders with the remainder aggregated into an “Others” bucket; usage not attributed to a user or service account appears only in the daily totals. The credits field is not populated by this endpoint.
When filter.subject is set the response contains only that subject’s usage: daily totals and the team breakdown are omitted, and the model breakdown covers the subject only.
Use this method to:
- Chart daily BYOK AI spend over a date range
- Feed daily per-user usage into external dashboards
- Restrict the response to a single user or service account
Only available for enterprise organizations.
Examples
-
Get daily usage for January:
Returns one entry per day with per-user, per-team, and per-model breakdowns. 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.
Body ParametersJSON
GetEnterpriseAIUsageTimeSeries
curl https://app.gitpod.io/api/gitpod.v1.BillingService/GetEnterpriseAIUsageTimeSeries \
-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",
"dailyUsage": [
{
"date": "2019-12-27T18:11:19.117Z",
"budget": {
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"monthlyCostLimitMicrounits": "monthlyCostLimitMicrounits",
"monthlyCreditLimit": "monthlyCreditLimit",
"monthToDateUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"source": "ENTERPRISE_AI_USAGE_BUDGET_SOURCE_UNSPECIFIED",
"utilizationPercent": 0
},
"teamUsage": [
{
"budget": {
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"monthlyCostLimitMicrounits": "monthlyCostLimitMicrounits",
"monthlyCreditLimit": "monthlyCreditLimit",
"monthToDateUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"source": "ENTERPRISE_AI_USAGE_BUDGET_SOURCE_UNSPECIFIED",
"utilizationPercent": 0
},
"displayName": "displayName",
"teamId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"usageByTokenType": [
{
"tokenType": "BYOK_RATE_CARD_TOKEN_TYPE_UNSPECIFIED",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
}
}
]
}
],
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"usageByModel": [
{
"model": "model",
"unpricedUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"unpricedUsageByTokenType": [
{
"tokenType": "BYOK_RATE_CARD_TOKEN_TYPE_UNSPECIFIED",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
}
}
],
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"usageByTokenType": [
{
"tokenType": "BYOK_RATE_CARD_TOKEN_TYPE_UNSPECIFIED",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
}
}
]
}
],
"userUsage": [
{
"displayName": "displayName",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"userId": "userId"
}
]
}
]
}Returns Examples
{
"calculatedAt": "2019-12-27T18:11:19.117Z",
"dailyUsage": [
{
"date": "2019-12-27T18:11:19.117Z",
"budget": {
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"monthlyCostLimitMicrounits": "monthlyCostLimitMicrounits",
"monthlyCreditLimit": "monthlyCreditLimit",
"monthToDateUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"source": "ENTERPRISE_AI_USAGE_BUDGET_SOURCE_UNSPECIFIED",
"utilizationPercent": 0
},
"teamUsage": [
{
"budget": {
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"monthlyCostLimitMicrounits": "monthlyCostLimitMicrounits",
"monthlyCreditLimit": "monthlyCreditLimit",
"monthToDateUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"source": "ENTERPRISE_AI_USAGE_BUDGET_SOURCE_UNSPECIFIED",
"utilizationPercent": 0
},
"displayName": "displayName",
"teamId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"usageByTokenType": [
{
"tokenType": "BYOK_RATE_CARD_TOKEN_TYPE_UNSPECIFIED",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
}
}
]
}
],
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"usageByModel": [
{
"model": "model",
"unpricedUsage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"unpricedUsageByTokenType": [
{
"tokenType": "BYOK_RATE_CARD_TOKEN_TYPE_UNSPECIFIED",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
}
}
],
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"usageByTokenType": [
{
"tokenType": "BYOK_RATE_CARD_TOKEN_TYPE_UNSPECIFIED",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
}
}
]
}
],
"userUsage": [
{
"displayName": "displayName",
"usage": {
"costMicrounits": "costMicrounits",
"credits": 0,
"currency": "BILLING_CURRENCY_UNSPECIFIED",
"tokens": {
"cacheTokens": "cacheTokens",
"inputTokens": "inputTokens",
"outputTokens": "outputTokens",
"totalTokens": "totalTokens"
}
},
"userId": "userId"
}
]
}
]
}