omnibus-instrument-llm-analytics
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.
What this skill does
# Add PostHog LLM analytics Use this skill to add PostHog LLM analytics that trace AI model usage in new or changed code. Use it after implementing LLM features or reviewing PRs to ensure all generations are captured with token counts, latency, and costs. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any provider or framework. Supported providers: OpenAI, Azure OpenAI, Anthropic, Google, Cohere, Mistral, Perplexity, DeepSeek, Groq, Together AI, Fireworks AI, xAI, Cerebras, Hugging Face, Ollama, OpenRouter. Supported frameworks: LangChain, LlamaIndex, CrewAI, AutoGen, DSPy, LangGraph, Pydantic AI, Vercel AI, LiteLLM, Instructor, Semantic Kernel, Mirascope, Mastra, SmolAgents, OpenAI Agents. Proxy/gateway: Portkey, Helicone. ## Instructions Follow these steps IN ORDER: STEP 1: Analyze the codebase and detect the LLM stack. - Look for LLM provider SDKs (openai, anthropic, google-generativeai, etc.) and AI frameworks (langchain, llamaindex, crewai, etc.) in dependency files and imports. - Look for lockfiles to determine the package manager. - Check for existing PostHog or observability setup. If PostHog is already installed and LLM tracing is configured, skip to STEP 4 to add tracing for any new LLM calls. STEP 2: Research instrumentation. (Skip if PostHog LLM tracing is already set up.) 2.1. Find the reference file below that matches the detected provider or framework — it is the source of truth for callback setup, middleware configuration, and event capture. Read it now. 2.2. If no reference matches, use manual-capture.md as a fallback — it covers the generic event capture approach that works with any provider. STEP 3: Install the PostHog SDK. (Skip if PostHog is already set up.) - Add the PostHog SDK and any required callback/integration packages. - Do not manually edit dependency files — use the package manager's install command. - Always install packages as a background task. Don't await completion; proceed with other work immediately. STEP 4: Add LLM tracing. - Instrument LLM calls to capture input tokens, output tokens, model name, latency, and costs for every generation. - Follow the provider-specific reference for the exact callback/middleware setup. - Do not alter the fundamental architecture of existing files. Make additions minimal and targeted. - You must read a file immediately before attempting to write it. STEP 5: Link to users. - Associate LLM generations with identified users via distinct IDs when possible. STEP 6: Set up environment variables. - If an env-file-tools MCP server is connected, use check_env_keys then set_env_values to configure the PostHog API key and host. - Reference these environment variables in code instead of hardcoding them. ## 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. 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.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.