Events: AI use in tokens, not rand (for 2.3.0); contracts: token fields on the AI status

Site settings → AI, the usage tables and the 80% email show input/output
tokens and the percentage; the rand amounts from the Hub are dropped on
arrival. AiCall stores each call's tokens (migration ai_tokens). v2
/ai/status and /ai/usage carry tokens instead of cents. Needs Hub 2.0.1
for the token figures; older Hubs show the percentage only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 10:59:36 +02:00
co-authored by Claude Opus 5.5
parent e8853cf0c8
commit 38ebce24ab
17 changed files with 725 additions and 169 deletions
+69 -31
View File
@@ -37676,11 +37676,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */
@@ -37739,11 +37744,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */
@@ -37768,18 +37778,21 @@ export interface operations {
};
people: {
uses: number;
chargedCents: number;
inputTokens: number;
outputTokens: number;
userId: string | null;
name: string;
}[];
helpers: {
uses: number;
chargedCents: number;
inputTokens: number;
outputTokens: number;
helper: string;
}[];
days: {
uses: number;
chargedCents: number;
inputTokens: number;
outputTokens: number;
day: string;
}[];
};
@@ -37945,11 +37958,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */
@@ -38041,11 +38059,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */
@@ -38127,11 +38150,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */
@@ -38220,11 +38248,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */
@@ -38313,11 +38346,16 @@ export interface operations {
capReached: boolean;
/** @description false: the Hub couldn't be reached just now */
available: boolean;
/** @description The monthly allowance, in cents */
capCents: number;
/** @description Used this month, in cents (fractions of a cent) */
usedCents: number;
/** @description How much of this month's allowance is used (0–100) */
usedPercent: number;
/** @description Input tokens used this month by all the church's products (null from a Hub before 2.0.1) */
usedInputTokens: number | null;
/** @description Output tokens used this month */
usedOutputTokens: number | null;
/** @description About how many input tokens the monthly allowance holds, if half of it went on input (an estimate: cached prompts cost less) */
capInputTokens: number | null;
/** @description About how many output tokens the allowance holds, if half of it went on output */
capOutputTokens: number | null;
/** @description YYYY-MM-DD */
renewsOn: string | null;
/** @description Each helper switched on or off in Site settings → AI */