aiCreditUsageSummary
Requires permission billing:ai_credit:read.
Windowed spend aggregate for the wallet page's KPI strip and burn sparkline.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query AiCreditUsageSummary {
aiCreditUsageSummary {
callCount
topFeature
topFeatureCreditsUsed
totalCreditsUsed
windowDays
daily {
creditsUsed
date
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query AiCreditUsageSummary {\n aiCreditUsageSummary {\n callCount\n topFeature\n topFeatureCreditsUsed\n totalCreditsUsed\n windowDays\n daily {\n creditsUsed\n date\n }\n }\n}"
}
EOF
Response:
{
"data": {
"aiCreditUsageSummary": {
"callCount": 0,
"topFeature": "string",
"topFeatureCreditsUsed": "string",
"totalCreditsUsed": "string",
"windowDays": 0,
"daily": [
{
"creditsUsed": "string",
"date": "string"
}
]
}
}
}
aiCreditUsageSummary(
windowDays: Int
): AiCreditUsageSummary!
Arguments
aiCreditUsageSummary.windowDays ● Int scalar
How many past days to include. Omit for the default window.
Type
AiCreditUsageSummary object
Totals over a period for the wallet page's figures and chart, worked out over the whole period.