I will check the existing files in the project to understand the structure and available libraries.
I will read package.json to see which icon libraries or charting libraries are already installed in this project.
I will install lucide-react so we have a comprehensive set of icons for AI engineering, token metrics, models, latency, filtering, and theme toggling.
I will check index.html to see the default title and meta tags.
I will update index.html to set a title ("TokenPulse — AI Engineering & LLM Token Analytics Dashboard") and improve styling for smooth dark/light mode transitions.
I will read src/index.css.
I will update src/index.css to add custom font utilities, scrollbar styling, and smooth SVG transition helpers.
I will create src/types/analytics.ts with TypeScript interfaces for the token analytics metrics, time-series data, models, endpoints, filters, and API request logs.
I will create src/data/mockTokenData.ts with model pricing specifications, realistic time-series data generators, API log generators, and filter/aggregation functions.
I will update src/data/mockTokenData.ts to use logs in generateTimeSeries to scale the volume dynamically with filtered search results, and remove unused parameters cleanly.
I will fix the unused variables in src/data/mockTokenData.ts.
I will update computeModelMetrics in src/data/mockTokenData.ts so there are no unused parameters.
I will update computeDashboardData to pass only filteredLogs to computeModelMetrics.
I will create src/context/ThemeContext.tsx to manage Dark and Light mode toggling with localStorage persistence and document root class updates.
I will create src/components/navbar/Header.tsx containing the branding, interactive date-range selector, environment/model/endpoint filters, live stream simulator toggle, calculator modal trigger, and theme toggle.
I will remove the unused MODEL_PRICING import from src/components/navbar/Header.tsx.
I will create src/components/navbar/FilterBar.tsx to display active filter tags, keyword search input, and summary counts of the filtered dataset.
I will remove unused imports from src/components/navbar/FilterBar.tsx.
I will create src/components/kpi/KpiSection.tsx with 6 interactive engineering KPI summary cards featuring trend indicators, mini sparkline charts, prompt vs completion ratio bars, and tooltips.
I will remove the unused HelpCircle import from src/components/kpi/KpiSection.tsx.
I will create src/components/charts/LineChartTime.tsx with interactive SVG series toggles, gradient area fills, hover crosshair, and floating engineering tooltips.
I will remove the unused Sparkles and Zap imports from src/components/charts/LineChartTime.tsx.
I will create src/components/charts/DonutChartModel.tsx with SVG donut segments, interactive hover preview in the center, token vs dollar spend toggle, and an engineering legend table.
I will remove the unused Check import from src/components/charts/DonutChartModel.tsx.
I will create src/components/charts/BarChartEndpoint.tsx with interactive stacked/grouped SVG bar charts, endpoint latency comparisons, error rate badges, and hover tooltips.
I will remove the unused BarChart2 import from src/components/charts/BarChartEndpoint.tsx.
I will create src/components/charts/CacheEfficiencyCard.tsx to display prompt caching efficiency gauges, model discount comparisons, and engineering optimization tips.
I will fix the typo in src/components/charts/CacheEfficiencyCard.tsx.
I will create src/components/table/LogDetailModal.tsx to let engineers inspect raw API request payloads, TTFT latency metrics, token breakdowns, and pricing calculations.
I will create src/components/tools/CostCalculatorModal.tsx to let engineers simulate and compare token costs and prompt caching savings across all available LLMs.
I will clean up unused imports in src/components/tools/CostCalculatorModal.tsx.
I will create src/components/table/TokenLogTable.tsx with multi-column sorting, pagination, CSV/JSON export, HTTP status filtering, and clickable rows to trigger payload inspection.
I will remove unused imports from src/components/table/TokenLogTable.tsx.
I will read src/App.tsx.
I will now replace src/App.tsx with the complete interactive token analytics dashboard, integrating the ThemeProvider, live stream simulator, filter state, KPI summary cards, SVG charts, sortable table, and inspection/calculator modals.
I will remove the unused Terminal and ExternalLink imports from src/App.tsx.
I will adjust the React import in src/App.tsx to fix the unused variable lint warning.
I will now build the project to verify there are no TypeScript or bundling errors.
I have created TokenPulse, an interactive token analytics and observability dashboard aimed at AI engineers.
What Was Built:
-
Top Navigation & Global Live Filters (Header.tsx, FilterBar.tsx)
- Interactive Date-Range Selector:
24h, 7d, 30d, 90d.
- Segment & Environment Filters: Filter live by Environment (
Production, Staging, Development, CI-Evals), LLM Model (GPT-4o, Claude 3.5 Sonnet, DeepSeek R1, o3-mini, Gemini 1.5 Pro, Claude 3 Haiku, GPT-4o Mini), or API Endpoint (/v1/chat/completions, /v1/embeddings, etc.).
- Live Stream Simulation Toggle: Injects new realistic token request logs every 3 seconds, updating every KPI card, chart, and table in real time with toast alerts.
- Dark Mode Toggle: System and manual theme switching with localStorage persistence (
ThemeContext.tsx).
- Active Filter Bar: Filter pills with one-click removal and keyword search across request IDs, prompts, and task tags.
-
6 Interactive KPI Summary Cards (KpiSection.tsx)
- Total Tokens Consumed: With period-over-period trend badge (
+14.8%) and mini SVG sparkline chart.
- Prompt vs Completion Ratio: Displays visual ratio progress bar (
2.57 : 1) and prompt vs completion split.
- Estimated Spend ($ USD): Calculated using official OpenAI/Anthropic/DeepSeek provider pricing tables with prompt caching discounts.
- Avg Latency & TTFT (ms): Displays Time to First Token (
182 ms) and Total Duration (425 ms) with negative trend badges (-8.5% faster).
- Prompt Cache Hit Rate (%): Tracks cache utilization (
54.2%) and calculated dollar savings ($18.42 saved).
- Throughput & Volume: Tracks average tokens/second (
68 tok/s) and total requests.
- All cards feature interactive hover tooltips explaining engineering metrics.
-
Smooth SVG Charts with Interactive Hover Tooltips & Series Toggles
- : An interactive area/line chart with series checkboxes (, , , ). Hovering over any data point reveals a vertical crosshair and floating tooltip with exact timestamps, token counts, cost, and TTFT.
Files built: index.html, src/index.css, src/types/analytics.ts, src/data/mockTokenData.ts, src/context/ThemeContext.tsx, src/components/navbar/Header.tsx, src/components/navbar/FilterBar.tsx, src/components/kpi/KpiSection.tsx, src/components/charts/LineChartTime.tsx, src/components/charts/DonutChartModel.tsx, src/components/charts/BarChartEndpoint.tsx, src/components/charts/CacheEfficiencyCard.tsx, src/components/table/LogDetailModal.tsx, src/components/tools/CostCalculatorModal.tsx, src/components/table/TokenLogTable.tsx, src/App.tsx