AI usage dashboard: tokens and cost by service
🔍 Problem Statement
As a business user, I have no visibility into the cost consumed by Pelcro's AI services, which prevents me from tracking and managing my AI spend.
💡 User Story
As a business user, I want a dashboard showing token consumption and cost broken down by AI service, so that I can monitor and manage my AI usage.
🎯 Definition of Done (DoD)
✔ Given AI usage across services, when a business user opens the AI usage dashboard, then tokens consumed and associated cost are displayed per service (e.g. AI coding agent, AI customer service).
✔ This change will impact UI and API, specifically a new AI usage/metering endpoint and the dashboard.
✔ All AI projects use the centralized LangfuseTracer::trace() method, which detects and sets account_id, site_id and user_id as trace tags on every trace, at all times.
✔ An hourly cron job pulls the previous day's usage from Langfuse and saves only what is required (date, account, service, cost, input tokens, output tokens) in a local table. The dashboard reads from that table, not from Langfuse.
✔ The cron job stays within the Langfuse Metrics API rate limit (100 requests/hour on Core, shared org-wide) and handles 429 responses by waiting for Retry-After and retrying.
✔ This solution will include the following limitations: per-service aggregation only.
Log in to comment and vote
No comments yet
Be the first to share your thoughts.