본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트41k · #6826

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/ai_observability/skills/analyzing-expensive-users/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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_generation rows by distinct_id, with traces, generations, errors, total_cost, first_seen, and last_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_id as distinct_id when no user is set. For identified users, exclude distinct_id = properties.$ai_trace_id and 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬