extractUsageFromMessages was summing ALL assistant messages, so each $ai_generation event reported a growing cumulative total — PostHog's sum() then massively over-counted costs (e.g. $634 reported vs $73 actual).
extractUsageFromMessages was summing ALL assistant messages, so each $ai_generation event reported a growing cumulative total — PostHog's sum() then massively over-counted costs (e.g. $634 reported vs $73 actual).