PostHog is an open-source product analytics platform that helps you understand user behavior. With PostHog’s LLM analytics, you can track and analyze your AI application usage.
In PostHog, navigate to your project settings:
phc_...)Go to Settings > Observability and toggle Enable Broadcast.

Click the edit icon next to PostHog and enter:
phc_...)https://us.i.posthog.com. For EU region, use https://eu.i.posthog.comClick Test Connection to verify the setup. The configuration only saves if the test passes.
Make an API request through OpenRouter and view the LLM analytics in your PostHog dashboard.

PostHog receives LLM analytics events with custom metadata included as event properties. Use the trace field to attach additional context to your analytics data.
user field maps to PostHog’s $ai_user property for user-level LLM analyticssession_id field maps to $ai_session_id for session groupingtrace are included as properties on the LLM analytics eventWhen Privacy Mode is enabled for this destination, the $ai_input and $ai_output_choices properties are excluded from events. All other analytics data — token usage, costs, model information, and custom metadata — is still sent normally.