- Add TokenUsageEntity to store per-request token consumption - Add TokenUsageService with cost calculation and statistics APIs - Record input/output/cache tokens per API call - Calculate estimated cost based on Claude pricing - Provide user/conversation/global stats aggregation - Support daily stats and top users ranking - Integrate token tracking in ClaudeAgentService - Track latency, tool calls, response length - Accumulate tokens across tool loop iterations - Add token_usages table to init-db.sql with proper indexes This enables: - Per-user token consumption tracking - Cost analysis and optimization - Future billing/quota features Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| admin-client | ||
| services | ||
| shared | ||
| web-client | ||