Package com.axelor.ai.governance
Interface AiQuotaService
- All Known Implementing Classes:
AiQuotaServiceImpl
public interface AiQuotaService
Usage limits from
AiUsagePolicy: the monthly token quota and the request rate limit, each
the maximum across the active policies that apply to the user: the global ones, and those listing
one of their roles, their group or themselves. Admins (see AiPermissionService.isAiAdmin(com.axelor.auth.db.User))
have neither.
Only user-initiated sources (CHAT, API) are counted; background calls (titles,
the subject, session notes, summaries, recaps, embeddings) are excluded per v1 spec.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcheckMonthlyTokenQuota(User user) ThrowsAiExceptionwhen the user's chat-panel turns (CHAT) have consumed at least as many tokens as their role-resolved monthly quota.Per-user rate limit in requests/second.tokenQuotaMonthly(User user) Monthly token budget (inputTokens + outputTokens) for the user.
-
Method Details
-
checkMonthlyTokenQuota
ThrowsAiExceptionwhen the user's chat-panel turns (CHAT) have consumed at least as many tokens as their role-resolved monthly quota. Programmatic and background calls never count. Admins and users with no quota set are always permitted. -
tokenQuotaMonthly
Monthly token budget (inputTokens + outputTokens) for the user.nullmeans unlimited — the case for admins and users noAiUsagePolicyapplies to. -
rateLimit
Per-user rate limit in requests/second.nullmeans no limit — admins, and users noAiUsagePolicyapplies to.
-