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
+14
View File
@@ -7,6 +7,20 @@ and this project follows [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Changed
- **AI use is shown in tokens, not rand** (for 2.3.0; needs Hub 2.0.1 for the token figures). Site
settings → AI shows the percentage used, the input and output tokens used this month and an
estimated allowance in tokens; the per-person, per-helper and per-day tables show tokens instead
of cost. The 80% email names tokens instead of rand. The rand amounts the Hub sends are dropped
on arrival, so they never reach a browser. With a Hub before 2.0.1 only the percentage shows.
- **API (v2):** `GET /api/v2/ai/status` (and the `status` in every AI reply and in `/ai/usage`) no
longer has `capCents` / `usedCents`; it has `usedInputTokens`, `usedOutputTokens`,
`capInputTokens`, `capOutputTokens` (null from an older Hub). `/ai/usage` rows have
`inputTokens` / `outputTokens` instead of `chargedCents`.
- `AiCall` keeps each call's tokens (migration `20261117120000_ai_tokens`). Calls from before it
show 0 tokens.
## [2.1.1] - 2026-11-03
### Fixed