llm-analytics-setup

PostHog LLM analytics setup supporting providers across all vendors.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "llm-analytics-setup" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-56d5eeea4e9647a1d472c40bf13abd11dd854c26ea1ce2840eb7db969407de67. Verify the upstream source and version against https://skills.sh/posthog/skills/llm-analytics-setup before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skills.sh

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

PostHog LLM analytics setup supporting providers across all vendors.

0 Downloads

Introduction source: third_party · posthog · 1.0.0 Reference

SkillPi interpretation

Tasks
PostHog LLM analytics for all supported providers
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: llm-analytics-setup
description: PostHog LLM analytics for all supported providers
metadata:
  author: PostHog
  version: 1.9.4

PostHog LLM analytics

This skill helps you add PostHog LLM analytics to any application using AI/LLM providers.

Reference files

  • references/openai.md - Openai llm analytics installation - docs
  • references/azure-openai.md - Azure openai llm analytics installation - docs
  • references/anthropic.md - Anthropic llm analytics installation - docs
  • references/google.md - Google llm analytics installation - docs
  • references/cohere.md - Cohere llm analytics installation - docs
  • references/mistral.md - Mistral llm analytics installation - docs
  • references/perplexity.md - Perplexity llm analytics installation - docs
  • references/deepseek.md - Deepseek llm analytics installation - docs
  • references/groq.md - Groq llm analytics installation - docs
  • references/together-ai.md - Together ai llm analytics installation - docs
  • references/fireworks-ai.md - Fireworks ai llm analytics installation - docs
  • references/xai.md - Xai llm analytics installation - docs
  • references/cerebras.md - Cerebras llm analytics installation - docs
  • references/hugging-face.md - Hugging face llm analytics installation - docs
  • references/ollama.md - Ollama llm analytics installation - docs
  • references/openrouter.md - Openrouter llm analytics installation - docs
  • references/langchain.md - Langchain llm analytics installation - docs
  • references/llamaindex.md - Llamaindex llm analytics installation - docs
  • references/crewai.md - Crewai llm analytics installation - docs
  • references/autogen.md - Autogen llm analytics installation - docs
  • references/dspy.md - Dspy llm analytics installation - docs
  • references/langgraph.md - Langgraph llm analytics installation - docs
  • references/pydantic-ai.md - Pydantic ai llm analytics installation - docs
  • references/vercel-ai.md - Vercel ai SDK llm analytics installation - docs
  • references/litellm.md - Litellm llm analytics installation - docs
  • references/instructor.md - Instructor llm analytics installation - docs
  • references/semantic-kernel.md - Semantic kernel llm analytics installation - docs
  • references/mirascope.md - Mirascope llm analytics installation - docs
  • references/mastra.md - Mastra llm analytics installation - docs
  • references/smolagents.md - Smolagents llm analytics installation - docs
  • references/openai-agents.md - Openai agents SDK llm analytics installation - docs
  • references/portkey.md - Portkey llm analytics installation - docs
  • references/helicone.md - Helicone llm analytics installation - docs
  • references/manual-capture.md - Manual capture llm analytics installation - docs
  • references/basics.md - Llm analytics basics - docs
  • references/traces.md - Traces - docs
  • references/calculating-costs.md - Calculating llm costs - docs

Each provider reference contains installation instructions, SDK setup, and code examples specific to that provider or framework. Find the reference that matches the user's stack and follow its instructions.

If the user's provider isn't listed, use manual-capture.md as a fallback — it covers the generic event capture approach that works with any provider.

Key principles

  • Environment variables: Always use environment variables for PostHog and LLM provider keys. Never hardcode them.
  • Minimal changes: Add LLM analytics alongside existing LLM calls. Don't replace or restructure existing code.
  • Trace all generations: Capture input tokens, output tokens, model name, latency, and costs for every LLM call.
  • Link to users: Associate LLM generations with identified users via distinct IDs when possible.
  • One provider at a time: Only instrument the provider(s) the user is actually using. Don't add instrumentation for providers not present in the codebase.

Framework guidelines

  • Remember that source code is available in the venv/site-packages directory
  • posthog is the Python SDK package name
  • Install dependencies with pip install posthog or pip install -r requirements.txt and do NOT use unquoted version specifiers like >= directly in shell commands
  • In CLIs and scripts: MUST call posthog.shutdown() before exit or all events are lost
  • Always use the Posthog() class constructor (instance-based API) instead of module-level posthog.api_key config
  • Always include enable_exception_autocapture=True in the Posthog() constructor to automatically track exceptions
  • NEVER send PII in capture() event properties — no emails, full names, phone numbers, physical addresses, IP addresses, or user-generated content
  • PII belongs in identify() person properties, NOT in capture() event properties. Safe event properties are metadata like message_length, form_type, boolean flags.
  • Register posthog_client.shutdown with atexit.register() to ensure all events are flushed on exit
  • The Python SDK has NO identify() method — use posthog_client.set(distinct_id=user_id, properties={...}) to set person properties, or use identify_context(user_id) within a context

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 支持广泛的 LLM 提供商和框架,包括 OpenAI、Azure、Anthropic、Google 等主流平台
  • 提供清晰的 fallback 方案(manual-capture.md)以覆盖未列出的提供商
  • 具有明确的实际应用场景,帮助用户快速集成 PostHog LLM 分析能力
Trigger Precision90/100

Highlights

  • description 明确说明支持所有提供商的 PostHog LLM 分析
  • 详细列出了支持的提供商和框架,触发词覆盖合理
  • 提供了清晰的 fallback 方案,边界清晰
Structure and Standards75/100

Areas to improve

  • 缺少端到端示例 Reported severity: Minor

    文档提供了详细的参考文件和实施指南,但缺少具体的端到端示例来展示完整的集成流程

    Recommendation: 建议添加一个完整的端到端示例,展示如何从环境变量设置到事件捕获的完整流程

Highlights

  • 文档结构清晰,包含 Key principles 和 Framework guidelines
  • 详细列出了所有支持的提供商和框架的参考文件
  • 提供了具体的实施建议和最佳实践
Execution Reliability70/100

Areas to improve

  • 缺少具体配置差异处理说明 Reported severity: Minor

    虽然提供了通用的实施指南,但未明确说明如何处理不同提供商的具体配置差异

    Recommendation: 建议为每个主要提供商添加具体的配置示例和常见问题处理方案

Highlights

  • 提供了详细的实施指南,包括环境变量使用、依赖安装、SDK 使用注意事项
  • 包含了重要的安全提醒,如避免发送 PII 数据
  • 提供了 SDK 使用的最佳实践,如使用实例化 API 和异常自动捕获
Evidence Verifiability (mean of the first four)80/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 69
  • Accounts, secrets or authorization

    Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.

    Mentioned in main document · lines 71

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.