useAiCredits
Refetched every time it mounts, because other apps spend from the same pool. CalluseRefreshAiCredits() after your own app spends.
number
This month’s spend, cap and balance.
string
The month,
YYYY-MM in UTC.string
ISO time of the next reset: the first of next month, UTC.
Record<string, number>
Credits per action, keyed
app.feature, for example { 'ask.message': 1 }.boolean
While
false, the server counts spending but never refuses a request.Handling a refusal
When the pool is empty, AI endpoints answer 402 withcode: 'AI_CREDITS_EXHAUSTED'. aiCreditsExhausted(error) returns that body, or null for any other error.
The 402 body also carries
feature, cost, used, limit and remaining.
Without React, use getAiCredits().