ai_credit_usage
Creates, updates, deletes, gets or lists an ai_credit_usage resource.
Overview
| Name | ai_credit_usage |
| Type | Resource |
| Id | github.billing.ai_credit_usage |
Fields
The following fields are returned by SELECT queries:
- get_github_billing_ai_credit_usage_report_user
Response when getting a billing AI credit usage report
| Name | Datatype | Description |
|---|---|---|
discountAmount | number | Discount amount of the usage line item. |
discountQuantity | number | Discount quantity of the usage line item. |
grossAmount | number | Gross amount of the usage line item. |
grossQuantity | number | Gross quantity of the usage line item. |
model | string | Model name. |
netAmount | number | Net amount of the usage line item. |
netQuantity | number | Net quantity of the usage line item. |
pricePerUnit | number | Price per unit of the usage line item. |
product | string | Product name. |
sku | string | SKU name. |
unitType | string | Unit type of the usage line item. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_github_billing_ai_credit_usage_report_user | select | username | year, month, day, model, product | Gets a report of AI credit usage for a user. Note: Only data from the past 24 months is accessible via this endpoint. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
username | string | The handle for the GitHub user account. |
day | integer | If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used. |
model | string | The model name to query usage for. The name is not case sensitive. |
month | integer | If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used. |
product | string | The product name to query usage for. The name is not case sensitive. |
year | integer | If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year. |
SELECT examples
- get_github_billing_ai_credit_usage_report_user
Gets a report of AI credit usage for a user.
Note: Only data from the past 24 months is accessible via this endpoint.
SELECT
discountAmount,
discountQuantity,
grossAmount,
grossQuantity,
model,
netAmount,
netQuantity,
pricePerUnit,
product,
sku,
unitType
FROM github.billing.ai_credit_usage
WHERE username = '{{ username }}' -- required
AND year = '{{ year }}'
AND month = '{{ month }}'
AND day = '{{ day }}'
AND model = '{{ model }}'
AND product = '{{ product }}'
;