omnibus-instrument-llm-analytics

Instrument LLM calls with PostHog LLM Analytics to capture token counts, latency, and costs.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill omnibus-instrument-llm-analytics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: omnibus-instrument-llm-analytics
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/llm-analytics/skills/all
Command: npx skills add https://github.com/PostHog/skills --skill omnibus-instrument-llm-analytics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Add PostHog LLM analytics to trace AI model usage. Use after implementing LLM features or reviewing PRs to ensure all generations are captured with token counts, latency, and costs. Also handles initial PostHog SDK setup if not yet installed.

Core Features & Use Cases

  • Instrument LLM calls to produce $ai_generation events and traces, capturing model, input, tokens, latency, and costs.
  • Supports multiple providers and frameworks; integrates with existing LLM stacks for observability in dashboards.
  • Use cases include PR reviews, feature development, and monitoring of AI-assisted workflows.

Quick Start

Install the PostHog SDK and wrap your LLM client with the provided analytics wrapper to start capturing LLM generations.

Frequently Asked Questions about omnibus-instrument-llm-analytics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I instrument LLM calls for observability and cost tracking?

You can capture LLM costs and latency by wrapping your LLM clients with the PostHog analytics wrapper, which generates $ai_generation events containing token counts, model usage, and latency metrics.

Does PostHog LLM analytics work with multiple AI providers and frameworks?

PostHog LLM analytics supports multiple AI providers and frameworks, allowing you to integrate observability instrumentation into existing LLM stacks to monitor generation traces in your dashboards.

What events does the PostHog LLM analytics wrapper produce?

The PostHog LLM analytics wrapper produces $ai_generation events and traces that capture the model, input, token counts, latency, and costs for each LLM generation call.

How do I set up LLM analytics tracing if the PostHog SDK is not yet installed?

Setting up LLM analytics tracing without the PostHog SDK is handled by the instrumentation process, which configures the necessary environment variables and handles the initial SDK setup.

Can I use this LLM observability instrumentation for PR reviews and feature development?

You can use LLM observability instrumentation during feature development and PR reviews to ensure all AI-assisted workflow generations are captured with full cost and latency metrics.