analyzing-expensive-users
यह क्या करती है
यह स्किल आपके AI उपयोग के डेटा में सबसे ज़्यादा लागत वाले उपयोगकर्ताओं को क्रम से लगाती है और कारण समझाती है। यह उन टीमों के लिए है जो AI फ़ीचर चलाती हैं और जानना चाहती हैं कि खर्च कहाँ जा रहा है।
कब इस्तेमाल करें
- ✓जब आप जानना चाहें कि कौन से उपयोगकर्ता या अकाउंट AI पर सबसे ज़्यादा खर्च करवा रहे हैं।
- ✓जब आपका AI बिल बढ़ गया हो और उस बढ़ोतरी के पीछे के उपयोगकर्ता खोजने हों।
- ✓जब आपको महँगी बातचीत के उदाहरण चाहिए ताकि देख सकें कि क्या हुआ।
Skill का लिंक
https://github.com/PostHog/posthog/blob/master/products/ai_observability/skills/analyzing-expensive-users/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस महीने मेरे सबसे महँगे AI उपयोगकर्ता कौन हैं, और उनकी लागत इतनी ज़्यादा किस वजह से है?”
हर हफ़्ते 5 नई skills, 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 observability डेटा चाहिए, जो हर मॉडल कॉल की लागत दर्ज करता है।
जानकारी
लेखक का मूल विवरण
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
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
depot-ci
41kयह आपके एजेंट को Depot CI वर्कफ़्लो सेट अप करने, चलाने और माइग्रेट करने में मदद करती है, साथ ही रन के लॉग पढ़ने में।
depot-container-builds
41kयह आपके एजेंट को Depot के रिमोट बिल्डर पर Docker इमेज बनाने में मदद करती है, जिसमें मल्टी-प्लेटफ़ॉर्म इमेज और बिल्ड सुधार शामिल हैं।
depot-github-runners
41kयह आपके एजेंट को GitHub Actions जॉब Depot के मैनेज्ड रनर पर ले जाने, रनर का साइज़ और लेबल चुनने, और रनर सेटअप की समस्याएँ ठीक करने में मदद करती है।
editing-agents-md
41kयह आपके एजेंट को तय करने में मदद करती है कि कोई नियम AGENTS.md या CLAUDE.md में जाए या नहीं, और उसे ऐसे लिखे कि फ़ाइल भारी न हो।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।