aiCreditUsageHistory
Requires permission billing:ai_credit:read.
Recent AI usage (model calls metered against the wallet), most recent first.
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 AiCreditUsageHistory {
aiCreditUsageHistory {
id
createdAt
costCents
creditsUsed
creditsUsedDisplay
feature
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query AiCreditUsageHistory {\n aiCreditUsageHistory {\n id\n createdAt\n costCents\n creditsUsed\n creditsUsedDisplay\n feature\n }\n}"
}
EOF
Response:
{
"data": {
"aiCreditUsageHistory": [
{
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"costCents": "string",
"creditsUsed": "string",
"creditsUsedDisplay": "string",
"feature": "string"
}
]
}
}
aiCreditUsageHistory(
feature: String
limit: Int
model: String
offset: Int
): [AiUsageLogEntry!]!
Arguments
aiCreditUsageHistory.feature ● String scalar
Only usage for this AI feature.
aiCreditUsageHistory.limit ● Int scalar
Maximum number of records to return.
aiCreditUsageHistory.model ● String scalar
Only usage for this AI model.
aiCreditUsageHistory.offset ● Int scalar
Number of records to skip before the first one returned.
Type
AiUsageLogEntry object
One AI call and what it used.