Available on the Enterprise plan. Contact sales to learn more.
Ona Intelligence or BYOK? Choose the right API
Ona meters AI usage one of two ways, depending on how your organization is set up. The two models have separate APIs:| Your setup | How usage is metered | Use |
|---|---|---|
| Ona Intelligence (Ona-managed models) | Credits (OCUs) consumed as you use environments and AI | This API |
| BYOK (your own provider keys) | Spend in your billing currency, via BYOK rate cards | AI cost usage API |
FAILED_PRECONDITION with enterprise credit usage is not enabled for BYOK-only organizations, and the cost endpoints return empty usage for organizations on Ona Intelligence.
Authentication
All endpoints accept a Bearer token: a personal access token (acts as you) or a service account token (owned by the organization, recommended for ongoing automation).filter.subject to their own user identity (this self-access path is for user tokens, not service accounts).
Request format
Every endpoint is a POST with a JSON body:| Parameter | Required | Description |
|---|---|---|
organizationId | Yes | Your organization ID. |
dateRange | Report, export | startTime and endTime as RFC-3339 timestamps. Both dates are inclusive; time-of-day is ignored. The report is capped at 31 days; the export may cover up to a year. |
asOf | Cumulative, list | Point in time to compute month-to-date usage up to. Defaults to now. |
timezone | No | IANA timezone name (for example Europe/London) used to bucket daily usage. Defaults to UTC. |
pagination | List | pageSize and token for paging. |
- Credits are floating-point values (for example
12.5). Budgets (creditBudget) are whole credits. usageTypeisUSAGE_TYPE_ENVIRONMENT(environment runtime) orUSAGE_TYPE_AGENTIC(agent activity).- Token counts are returned as JSON strings, per protobuf JSON encoding.
- Fields at their default value are omitted.
creditBudget,utilizationPercent, andoverBudgetappear on a user only when a budget applies,overBudgetandisServiceAccountonly when true, and an unset budget or zero usage leaves the field out entirely. periodStartmarks the start of the billing period; usage before it is excluded.
Daily usage report
Returns one entry per day: org-wide credits by usage type, plus per-user, per-team, per-environment, and per-conversation breakdowns (top consumers with the rest grouped into an “Others” bucket), and a per-model breakdown of agent usage. Endpoint:POST https://app.gitpod.io/api/gitpod.v1.BillingService/GetCreditUsageReport
Request:
userId (or teamId, environmentId, agentExecutionId) marks the “Others” bucket. Each userUsage entry also carries a usageByModel breakdown with the same shape as the day-level one shown here; teamUsage, environmentUsage, and conversationUsage do not. Token types (BYOK_RATE_CARD_TOKEN_TYPE_INPUT, _OUTPUT, _CACHE_READ, _CACHE_WRITE) apply to both Ona Intelligence and BYOK usage.
To restrict the report to one subject, set filter.subject:
filter.subject is set, each day’s userUsage contains only that subject (no “Others” bucket), and the org, team, environment, and conversation breakdowns are omitted.
Cumulative period usage
Returns period-to-date totals for the organization, each team (with its credit allocation), members not on any team, and per-user month-to-date usage with budgets. Endpoint:POST https://app.gitpod.io/api/gitpod.v1.BillingService/GetCumulativeCreditUsage
Request:
teamUsage returns all teams (no top-N limit). The userUsage list is not paginated or capped; for large organizations prefer the paginated list endpoint below. Each user carries a usageByModel breakdown; budget fields appear only when a monthly budget applies (overBudget only when the user is over it), and noCap is true for users exempted from limits.
Per-user usage list
Returns per-user month-to-date usage with budgets, paginated. Ordered by total credits descending by default so the highest spenders appear first. Endpoint:POST https://app.gitpod.io/api/gitpod.v1.BillingService/ListEnterpriseUserCreditUsage
Request:
nextToken) is the last user’s ID. budgetSource is ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_ORGANIZATION, _USER, or _NONE. Sort fields: SORT_FIELD_USAGE (default, total credits), SORT_FIELD_DISPLAY_NAME, SORT_FIELD_BUDGET, SORT_FIELD_BUDGET_USED. The default usage ordering paginates over any number of users. The other three sorts compute the order in memory and are limited to organizations with at most 10,000 users; beyond that, use SORT_FIELD_USAGE. Because month-to-date figures are recomputed per request, hold asOf stable across a paginated walk to keep page tokens valid.
CSV export
Returns a short-lived, signed download URL for a gzip-compressed CSV. The download must be made by the same principal that requested it, carrying its own bearer token. Endpoint:POST https://app.gitpod.io/api/gitpod.v1.BillingService/GetCreditUsageExport
Request:
groupBy is CREDIT_USAGE_EXPORT_GROUP_BY_DAILY_SUMMARY (per-user daily summary, the default) or CREDIT_USAGE_EXPORT_GROUP_BY_RESOURCE (per-environment and per-conversation breakdown).