/** * Session insights engine. * * Rich usage analytics from the stats tracker history. * * Provides: * - Per-model cost and request breakdown * - Daily activity trend (sparkline) * - Top sessions by cost * - Tool usage patterns * - Cost projections and efficiency metrics */ export interface InsightsReport { /** Window size in days */ days: number; /** Records within the window */ windowRecords: number; /** Total cost in window */ totalCostUsd: number; /** Total input tokens in window */ totalInputTokens: number; /** Total output tokens in window */ totalOutputTokens: number; /** Savings vs always using the Opus-tier baseline */ savedVsOpusUsd: number; /** Per-model breakdown, sorted by cost desc */ byModel: Array<{ model: string; requests: number; costUsd: number; inputTokens: number; outputTokens: number; avgLatencyMs: number; percentOfTotal: number; }>; /** Daily activity (last N days), oldest first */ daily: Array<{ date: string; requests: number; costUsd: number; }>; /** Projections */ projections: { avgCostPerDay: number; projectedMonthlyUsd: number; projectedYearlyUsd: number; }; /** Average request cost */ avgRequestCostUsd: number; /** Efficiency: cost per 1K tokens */ costPer1KTokens: number; /** * Cost breakdown by capability category. Lets the UI show a clean * "where did your USDC go" split alongside the per-model bar list. * - chat: LLM token-billed calls (anything with non-zero tokens) * - media: ImageGen / VideoGen / MusicGen (per_image / per_second / per_track) * - sandbox: Modal GPU sandbox lifecycle (create / exec / status / terminate) * * Categorization is by `model` name prefix: * - `modal/*` → sandbox * - rows with 0 input + 0 output tokens → media (image/video/music are * stored with 0 tokens by recordUsage; modal/* matches first) * - everything else → chat */ byCategory: { chatCostUsd: number; mediaCostUsd: number; sandboxCostUsd: number; sandboxRequests: number; }; } export declare function generateInsights(days?: number): InsightsReport; export declare function formatInsights(report: InsightsReport, days: number): string;