Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

exploring-llm-costs

Skill by PostHog

Investigates LLM spend in PostHog, including total cost, breakdowns by model, user, trace or custom property, and cost regressions. Built for teams that track AI costs in PostHog and want to answer questions about their LLM bill.

  • Score 85
  • 41k stars
  • NOASSERTION
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install exploring-llm-costs

Built from the published package, never by AI.

git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/products/ai_observability/skills/exploring-llm-costs ~/.claude/skills/exploring-llm-costs

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install exploring-llm-costs in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

The exploring-llm-costs skill helps an AI assistant investigate LLM spend in PostHog. It covers total cost over time, cost by model, provider, user, trace or custom dimension, token and cache-hit economics, and cost regressions. PostHog attaches per-call cost metadata to $ai_generation and $ai_embedding events at ingestion.

The skill aggregates $ai_total_cost_usd over those two event types and sets a time range on every query. It can also trace the cost of a single trace, debug cost spikes, and turn results into insights, dashboards or alerts. It is written for users who ask how much they spend on LLMs, which feature or user is most expensive, or why cost jumped.

Written from the project's SKILL.md and checked against it.

What it can do

  • posthog:execute-sqlRuns ad-hoc HogQL for any cost aggregation.
  • posthog:query-trendsGets native cost trends with sums, breakdowns and comparisons.
  • posthog:query-llm-traces-listLists traces with rolled-up cost, token and error metrics.
  • posthog:query-llm-traceShows the cost breakdown of a single trace across its events.
  • posthog:read-data-schemaDiscovers custom properties available for cost breakdowns.
  • posthog:insight-createSaves a cost chart as an insight.
  • posthog:dashboard-createBundles cost insights into a dashboard.
  • posthog:alert-createSets an alert when cost crosses a threshold.
  • posthog:generate-app-urlBuilds region and project qualified links back to the PostHog UI.

What you need

  • PostHog project with $ai_generation and $ai_embedding events

Try asking

  • How much did we spend on LLMs in the last 30 days?
  • Which model is driving most of our LLM cost this month?
  • Why did our LLM cost spike last week? Break it down by model and user.

Good to know

  • Cost queries without a time range scan the full events table.
  • Custom pricing uses per-token prices, so check for unit mistakes.
  • Errored calls are included in totals unless the user asks to exclude them.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: products/ai_observability/skills/exploring-llm-costs/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md11 KB
  • references/breakdown-patterns.md7 KB
  • references/cache-accounting.md4 KB
  • references/cost-properties.md5 KB
  • references/cost-sources.md3 KB
Show all 7 files
  • references/materializing.md2 KB
  • references/regression-debugging.md4 KB

Alternatives to exploring-llm-costs

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

exploring-llm-costs: common questions

Which PostHog events are used for LLM cost?

The skill aggregates $ai_total_cost_usd over $ai_generation and $ai_embedding events. Components are not summed for rollups, and $ai_trace and $ai_span carry no rollup cost.

Does it show message content alongside cost?

Not directly. The source says message content lives on the posthog.ai_events table, and the exploring-llm-traces skill covers that.

Can it build dashboards and alerts?

Yes. The skill can create insights, bundle them into a dashboard, and create alerts when cost crosses a threshold.

How do I install exploring-llm-costs?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is exploring-llm-costs free?

The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.

Is exploring-llm-costs safe to use?

It scores 85 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to exploring-llm-costs?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

exploring-llm-costs Install

Add to stack

Loading.