analyzing-expensive-users
하는 일
이 스킬은 AI 사용 데이터에서 비용을 가장 많이 쓰는 사용자의 순위를 매기고 그 이유를 설명합니다. AI 기능을 운영하면서 지출이 어디로 가는지 알고 싶은 팀을 위한 것입니다.
사용하는 경우
- ✓어떤 사용자나 계정이 AI 지출을 가장 많이 유발하는지 알고 싶을 때.
- ✓AI 청구 금액이 올라서 증가의 원인이 된 사용자를 찾아야 할 때.
- ✓비싼 대화의 예시를 보고 무슨 일이 있었는지 확인하고 싶을 때.
스킬 링크
https://github.com/PostHog/posthog/blob/master/products/ai_observability/skills/analyzing-expensive-users/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이번 달 가장 비용이 많이 드는 AI 사용자는 누구이고, 무엇이 그렇게 비싸게 만드나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
시간 범위에 따라 사용자를 비용 순으로 정렬하고, 일반적인 사용량과 비교합니다. 모델, 프롬프트 길이, 재시도, 출력 크기 같은 요인을 확인한 뒤, 이유가 분명하도록 비싼 요청의 실제 예시를 몇 개 보여 줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Analyzing expensive users
Use this skill when the user wants to understand the most expensive users in AI observability. The job is not just to rank users by cost. The useful answer explains what makes the top users expensive: volume, model choice, prompt size, output size, cache behavior, retries/errors, trace type, feature or tenant dimensions, and representative trace examples.
For general cost rollups, also use exploring-llm-costs. For reading
individual traces, also use exploring-llm-traces.
Tools
| Tool | Purpose |
|---|---|
posthog:execute-sql |
Rank users and compare their metrics against the project baseline |
posthog:query-llm-traces-list |
Find high-cost traces for a specific user (by person UUID) |
posthog:query-llm-trace |
Read representative traces to explain what actually happened |
posthog:read-data-schema |
Discover custom event or person properties before grouping by them |
posthog:generate-app-url |
Build region- and project-qualified links back to the UI |
Core rules
- Start with a bounded time range. If the user does not specify one, use the last 30 days and say so. If the user provides a link or existing filters, preserve the date range, test-account filter, and property filters.
- Start from generated-call spend. The per-user ranking query groups
$ai_generationrows bydistinct_id, withtraces,generations,errors,total_cost,first_seen, andlast_seen. This is the best first pass for finding expensive users. - For full spend by user, include embeddings deliberately. Broader cost
rollups should include
event IN ('$ai_generation', '$ai_embedding'), but call out when the event set changes. - Filter trace-id defaults when interpreting users. Some SDKs use
$ai_trace_idasdistinct_idwhen no user is set. For identified users, excludedistinct_id = properties.$ai_trace_idand flag how much spend becomes unattributed. - Do not guess custom dimensions. Discover event and person properties
before grouping by
feature,tenant_id,plan,workflow_name, or similar customer-specific fields. - Read traces before explaining causality. Aggregates identify suspects; representative traces show whether the user is expensive because of a real workflow, retries, loops, large context, tool-heavy generations, or other behavior.
Workflow
1. Rank users by generated-call spend
Use this first when the question asks for the most expensive users:
posthog:execute-sql
SELECT
distinct_id,
argMax(email, timestamp) AS email,
argMax(name, timestamp) AS name,
argMax(person_id, timestamp) AS person_uuid,
countDistinctIf(ai_trace_id, notEmpty(ai_trace_id)) AS traces,
count() AS generations,
countIf(notEmpty(ai_error) OR ai_is_error = 'true') AS errors,
round(sum(ai_total_cost_usd), 4) AS total_cost,
round(avg(ai_total_cost_usd), 6) AS avg_cost_per_generation,
sum(ai_input_tokens) AS input_tokens,
sum(ai_output_tokens) AS output_tokens,
min(timestamp) AS first_seen,
max(timestamp) AS last_seen
FROM (
SELECT
distinct_id,
timestamp,
person_id,
toString(properties.$ai_trace_id) AS ai_trace_id,
toFloat(properties.$ai_total_cost_usd) AS ai_total_cost_usd,
toString(properties.$ai_error) AS ai_error,
toString(properties.$ai_is_error) AS ai_is_error,
toInt(properties.$ai_input_tokens) AS ai_input_tokens,
toInt(properties.$ai_output_tokens) AS ai_output_tokens,
toString(person.properties.email) AS email,
toString(person.properties.name) AS name
FROM events
WHERE event = '$ai_generation'
AND timestamp >= now() - INTERVAL 30 DAY
)
GROUP BY distinct_id
ORDER BY total_cost DESC
LIMIT 25
If the user is asking for identified users, add this
inside the inner WHERE clause:
AND (
properties.$ai_trace_id IS NULL
OR distinct_id != properties.$ai_trace_id
)
Project only the explicit label columns you need, such as email and name.
Never select the raw person.properties object or a tuple containing it: it
serializes the full property blob into the result and leaks personal data far
beyond a label. I
자주 묻는 질문
어떤 시간 범위를 사용하나요?
범위를 지정하지 않으면 최근 30일을 사용하며, 답변에 그렇다고 밝힙니다.
실제 대화를 보여 줄 수 있나요?
네. 대표적인 트레이스를 열어서 각 비싼 요청이 무엇을 했는지 확인할 수 있습니다.
추가 설정이 필요한가요?
PostHog에 AI 관측 데이터가 있어야 합니다. 이 데이터는 각 모델 호출의 비용을 기록합니다.
상세 정보
작성자의 원본 설명
Analyze the most expensive users in AI observability and explain why they cost so much. Use when the user asks about top spenders, expensive users, per-user LLM cost, user-level cost drivers, or patterns behind high AI observability spend.
repo: PostHog/posthog
인기도
- GitHub 스타
- 41k
- 순위
- #6826
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
depot-ci
41k에이전트가 GitHub Actions 대안인 Depot CI 워크플로를 설정하고 실행하도록 돕습니다. 기존 워크플로 이전과 실행 로그 읽기를 포함합니다.
depot-container-builds
41k에이전트가 Depot 원격 빌더에서 Docker 이미지를 빌드하도록 돕습니다. 다중 플랫폼 이미지, 레지스트리 푸시, 빌드 실패 수정을 포함합니다.
depot-github-runners
41k에이전트가 GitHub Actions 작업을 Depot 관리형 러너로 옮기고, 러너 크기와 라벨을 고르도록 돕습니다.
editing-agents-md
41k에이전트가 규칙을 AGENTS.md나 CLAUDE.md 중 어디에 둘지 정하고, 파일을 키우지 않으면서 잘 지켜지도록 쓰게 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.