Token usage tracking for LLM, STT, and TTS calls and Usage Page. - #114
Conversation
…3 artifacts on preview
…and actor stamping
…oved task dispatching
|
| Filename | Overview |
|---|---|
| app/api/v1/routes/org_usage.py | Adds the usage reporting API, but its organization-only authorization still exposes data from workspaces inaccessible to restricted members. |
| app/services/usage/llm_usage.py | Implements Redis counters, PostgreSQL aggregation, durable committed-claim tracking, and orphan recovery; the current transaction structure addresses the previously reported replay paths. |
| app/services/ai/llm_gateway.py | Adds normalized usage recording around LiteLLM completion and batch-completion paths. |
| frontend/src/pages/usage/Usage.tsx | Implements the usage dashboard with date, grouping, filtering, and drill-down behavior. |
| app/migrations/068_usage_committed_claims.py | Adds the durable committed-claim table used to prevent already-applied Redis claims from being restored. |
Reviews (6): Last reviewed commit: "refactor: usage commited claims" | Re-trigger Greptile
|
Too many files changed for review (162 files, 100 file limit). Bypass the limit by tagging |
… for usage features
…tion in Docker and API
…rocess_evaluator_result.py
…ing and cache/Ui fixes
…r available models
…iguration for periodic job scheduling
…R(255) and add migration function
…on to clear cache before seeding pricing rates
…sage pricing routes; enhance usage snapshot billability checks
…eamline cost calculations for pending usage deltas
…ed references in the documentation
What Changed?
Added usage tracking for LLM, STT, and TTS calls, including voice agent usage.
/usagepage with filters and grouping.Why?
We need a centralized way to track AI usage across different products and voice agents without adding significant overhead to individual calls.
Usage is aggregated in Redis first and periodically flushed to Postgres, instead of creating a database record for every request. This keeps the system scalable while allowing usage to be viewed from a single Usage page.
How to Test?
/usagepage.Release Label
majorminorfixChecklist
CONTRIBUTING.mdguide.