feat: meter AI usage
This commit is contained in:
@@ -55,10 +55,13 @@ master profile text ────────────┘ │
|
||||
overwritten. This is deliberately distinct from `AiWorkspaceNote` (a one-row-per-type *cache* for
|
||||
candidate-fit/focus-plan). History gives the user restore/reuse (re-surface a past result), compare
|
||||
(view two side by side), copy, and delete. `ResultJson` is `{ text, meta? }`; `Provider` records which
|
||||
provider produced it. Tenant-scoped (owner query filter), cascades with the application.
|
||||
provider produced it. Each row also stores input/output character counts and a conservative estimated
|
||||
token count (characters ÷ 4); the estimate is provider-neutral because the sidecar currently returns
|
||||
text rather than provider billing metadata. Tenant-scoped (owner query filter), cascades with the application.
|
||||
|
||||
API (`AiWorkspaceController`, `/api/jobapplications/{id}/ai`): `GET modules` (+ current provider),
|
||||
`POST generate`, `GET history?module=`, `DELETE history/{id}`.
|
||||
`POST generate`, `GET history?module=`, `DELETE history/{id}`. `GET /api/ai/usage` returns current-month
|
||||
and all-time totals; the workspace displays the monthly calls and estimated tokens.
|
||||
|
||||
## Provider abstraction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user