[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-posthog-analyzing-expensive-users":3,"mdc--dpo7qc-key":48,"related-org-posthog-analyzing-expensive-users":2151,"related-repo-posthog-analyzing-expensive-users":2312},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":43,"sourceUrl":46,"mdContent":47},"analyzing-expensive-users","analyze expensive users in 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.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"posthog","PostHog","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fposthog.png",[12,16,17,20],{"name":13,"slug":14,"type":15},"Observability","observability","tag",{"name":9,"slug":8,"type":15},{"name":18,"slug":19,"type":15},"Cost Optimization","cost-optimization",{"name":21,"slug":22,"type":15},"Analytics","analytics",35568,"https:\u002F\u002Fgithub.com\u002FPostHog\u002Fposthog","2026-07-28T05:34:11.117757",null,2977,[29,30,22,31,32,33,34,35,36,37,38,39,40,41,42],"ab-testing","ai-analytics","cdp","data-warehouse","experiments","feature-flags","javascript","product-analytics","python","react","session-replay","surveys","typescript","web-analytics",{"repoUrl":24,"stars":23,"forks":27,"topics":44,"description":45},[29,30,22,31,32,33,34,35,36,37,38,39,40,41,42],"🦔 PostHog is an all-in-one developer platform for building successful products. We offer product analytics, web analytics, session replay, error tracking, feature flags, experimentation, surveys, data warehouse, a CDP, and an AI product assistant to help debug your code, ship features faster, and keep all your usage and customer data in one stack.","https:\u002F\u002Fgithub.com\u002FPostHog\u002Fposthog\u002Ftree\u002FHEAD\u002Fproducts\u002Fai_observability\u002Fskills\u002Fanalyzing-expensive-users","---\nname: analyzing-expensive-users\ndescription: >\n  Analyze the most expensive users in AI observability and explain why they cost so much.\n  Use when the user asks about top spenders, expensive users, per-user LLM cost,\n  user-level cost drivers, or patterns behind high AI observability spend.\n---\n\n# Analyzing expensive users\n\nUse this skill when the user wants to understand the most expensive users in\nAI observability. The job is not just to rank users by cost. The useful answer\nexplains what makes the top users expensive: volume, model choice, prompt size,\noutput size, cache behavior, retries\u002Ferrors, trace type, feature or tenant\ndimensions, and representative trace examples.\n\nFor general cost rollups, also use `exploring-llm-costs`. For reading\nindividual traces, also use `exploring-llm-traces`.\n\n## Tools\n\n| Tool                            | Purpose                                                            |\n| ------------------------------- | ------------------------------------------------------------------ |\n| `posthog:execute-sql`           | Rank users and compare their metrics against the project baseline  |\n| `posthog:query-llm-traces-list` | Find high-cost traces for a specific user                          |\n| `posthog:query-llm-trace`       | Read representative traces to explain what actually happened       |\n| `posthog:read-data-schema`      | Discover custom event or person properties before grouping by them |\n| `posthog:generate-app-url`      | Build region- and project-qualified links back to the UI           |\n\n## Core rules\n\n- **Start with a bounded time range.** If the user does not specify one, use the\n  last 30 days and say so. If the user provides a link or existing filters,\n  preserve the date range, test-account filter, and property filters.\n- **Start from generated-call spend.** The per-user ranking query groups\n  `$ai_generation` rows by `distinct_id`, with `traces`, `generations`,\n  `errors`, `total_cost`, `first_seen`, and `last_seen`. This is the best\n  first pass for finding expensive users.\n- **For full spend by user, include embeddings deliberately.** Broader cost\n  rollups should include `event IN ('$ai_generation', '$ai_embedding')`, but\n  call out when the event set changes.\n- **Filter trace-id defaults when interpreting users.** Some SDKs use\n  `$ai_trace_id` as `distinct_id` when no user is set. For identified users,\n  exclude `distinct_id = properties.$ai_trace_id` and flag how much spend\n  becomes unattributed.\n- **Do not guess custom dimensions.** Discover event and person properties\n  before grouping by `feature`, `tenant_id`, `plan`, `workflow_name`, or similar\n  customer-specific fields.\n- **Read traces before explaining causality.** Aggregates identify suspects;\n  representative traces show whether the user is expensive because of a real\n  workflow, retries, loops, large context, tool-heavy generations, or other\n  behavior.\n\n## Workflow\n\n### 1. Rank users by generated-call spend\n\nUse this first when the question asks for the most expensive users:\n\n```sql\nposthog:execute-sql\nSELECT\n    distinct_id,\n    argMax(email, timestamp) AS email,\n    argMax(name, timestamp) AS name,\n    countDistinctIf(ai_trace_id, notEmpty(ai_trace_id)) AS traces,\n    count() AS generations,\n    countIf(notEmpty(ai_error) OR ai_is_error = 'true') AS errors,\n    round(sum(ai_total_cost_usd), 4) AS total_cost,\n    round(avg(ai_total_cost_usd), 6) AS avg_cost_per_generation,\n    sum(ai_input_tokens) AS input_tokens,\n    sum(ai_output_tokens) AS output_tokens,\n    min(timestamp) AS first_seen,\n    max(timestamp) AS last_seen\nFROM (\n    SELECT\n        distinct_id,\n        timestamp,\n        toString(properties.$ai_trace_id) AS ai_trace_id,\n        toFloat(properties.$ai_total_cost_usd) AS ai_total_cost_usd,\n        toString(properties.$ai_error) AS ai_error,\n        toString(properties.$ai_is_error) AS ai_is_error,\n        toInt(properties.$ai_input_tokens) AS ai_input_tokens,\n        toInt(properties.$ai_output_tokens) AS ai_output_tokens,\n        toString(person.properties.email) AS email,\n        toString(person.properties.name) AS name\n    FROM events\n    WHERE event = '$ai_generation'\n        AND timestamp >= now() - INTERVAL 30 DAY\n)\nGROUP BY distinct_id\nORDER BY total_cost DESC\nLIMIT 25\n```\n\nIf the user is asking for identified users, add this\ninside the inner `WHERE` clause:\n\n```sql\nAND (\n    properties.$ai_trace_id IS NULL\n    OR distinct_id != properties.$ai_trace_id\n)\n```\n\nProject only the explicit label columns you need, such as `email` and `name`.\nNever select the raw `person.properties` object or a tuple containing it: it\nserializes the full property blob into the result and leaks personal data far\nbeyond a label. If a user has no email or name, fall back to `distinct_id`.\n\n### 2. Establish the baseline\n\nThe top user is only meaningful relative to everyone else. Run a per-user\nbaseline so you can say whether a user is expensive because they have more\ngenerations, more traces, higher cost per generation, longer prompts, longer\noutputs, or a higher error rate.\n\n```sql\nposthog:execute-sql\nWITH per_user AS (\n    SELECT\n        distinct_id,\n        count() AS generations,\n        countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n        countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors,\n        sum(toFloat(properties.$ai_total_cost_usd)) AS total_cost,\n        avg(toFloat(properties.$ai_total_cost_usd)) AS avg_cost_per_generation,\n        avg(toInt(properties.$ai_input_tokens)) AS avg_input_tokens,\n        avg(toInt(properties.$ai_output_tokens)) AS avg_output_tokens\n    FROM events\n    WHERE event = '$ai_generation'\n        AND timestamp >= now() - INTERVAL 30 DAY\n    GROUP BY distinct_id\n)\nSELECT\n    count() AS users,\n    round(sum(total_cost), 4) AS total_cost,\n    round(avg(total_cost), 4) AS avg_cost_per_user,\n    round(quantile(0.5)(total_cost), 4) AS p50_user_cost,\n    round(quantile(0.9)(total_cost), 4) AS p90_user_cost,\n    round(quantile(0.99)(total_cost), 4) AS p99_user_cost,\n    round(avg(avg_cost_per_generation), 6) AS avg_cost_per_generation,\n    round(avg(avg_input_tokens), 0) AS avg_input_tokens,\n    round(avg(avg_output_tokens), 0) AS avg_output_tokens,\n    round(sum(errors) \u002F nullIf(sum(generations), 0), 4) AS error_rate\nFROM per_user\n```\n\nWhen reporting top users, include each user's share of total spend and how many\nmultiples above p50\u002Fp90 they are. That makes the skew obvious.\n\n### 3. Decompose the top user's cost drivers\n\nFor each top user worth explaining, break their spend down by model and token\neconomics.\n\n```sql\nposthog:execute-sql\nSELECT\n    toString(properties.$ai_provider) AS provider,\n    toString(properties.$ai_model) AS model,\n    count() AS generations,\n    countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation,\n    sum(toInt(properties.$ai_input_tokens)) AS input_tokens,\n    sum(toInt(properties.$ai_output_tokens)) AS output_tokens,\n    sum(toInt(properties.$ai_reasoning_tokens)) AS reasoning_tokens,\n    sum(toInt(properties.$ai_cache_read_input_tokens)) AS cache_read_tokens,\n    sum(toInt(properties.$ai_cache_creation_input_tokens)) AS cache_write_tokens,\n    round(sum(toFloat(properties.$ai_input_cost_usd)), 4) AS input_cost,\n    round(sum(toFloat(properties.$ai_output_cost_usd)), 4) AS output_cost,\n    round(sum(toFloat(properties.$ai_request_cost_usd)), 4) AS request_cost,\n    round(sum(toFloat(properties.$ai_web_search_cost_usd)), 4) AS web_search_cost,\n    countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors\nFROM events\nWHERE event = '$ai_generation'\n    AND timestamp >= now() - INTERVAL 30 DAY\n    AND distinct_id = '\u003Cdistinct_id>'\nGROUP BY provider, model\nORDER BY total_cost DESC\n```\n\nInterpret the result using this decision tree:\n\n- **High generations, ordinary cost per generation** means volume is the driver.\n- **High cost per generation, ordinary volume** means expensive models, long\n  context, long outputs, reasoning tokens, web-search fees, or request fees are\n  the driver.\n- **High input tokens** usually points to context bloat, repeated conversation\n  history, large retrieved documents, or missing truncation.\n- **High output or reasoning tokens** points to verbose answers, chain-of-thought\n  style reasoning models, missing output limits, or tool loops.\n- **Low cache reuse with high repeated input** points to missed prompt caching.\n  Use the cache formula from `exploring-llm-costs\u002Freferences\u002Fcache-accounting.md`.\n- **High errors or many high-cost traces** points to retries, failed tool calls,\n  or loops. Read traces before saying which one.\n- **High request or web-search cost** points to provider flat fees or tool-heavy\n  generations, not token volume alone.\n\n### 4. Compare the top user against everyone else\n\nRun the same model or token breakdown for the whole project, then compare. Do\nnot rely on raw totals only. You want statements like \"this user used the same\nmodels as everyone else, but had 9x more generations\" or \"their volume was\nnormal, but 82% of spend went to a high-cost model that is rare elsewhere.\"\n\nUseful comparisons:\n\n- Top user's share of total project cost\n- Top user's generations and traces versus p50\u002Fp90 user\n- Average cost per generation versus project average\n- Input tokens per generation versus project average\n- Output or reasoning tokens per generation versus project average\n- Error rate versus project average\n- Model mix versus global model mix\n- Cache-hit rate versus global cache-hit rate for the same model\n\n### 5. Find the user's expensive traces\n\nUse SQL for the ranked trace list, then read representative traces with\n`posthog:query-llm-trace`.\n\n```sql\nposthog:execute-sql\nSELECT\n    toString(properties.$ai_trace_id) AS trace_id,\n    count() AS generations,\n    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation,\n    sum(toInt(properties.$ai_input_tokens)) AS input_tokens,\n    sum(toInt(properties.$ai_output_tokens)) AS output_tokens,\n    countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors,\n    min(timestamp) AS started_at,\n    max(timestamp) AS ended_at\nFROM events\nWHERE event = '$ai_generation'\n    AND timestamp >= now() - INTERVAL 30 DAY\n    AND distinct_id = '\u003Cdistinct_id>'\n    AND notEmpty(toString(properties.$ai_trace_id))\nGROUP BY trace_id\nORDER BY total_cost DESC\nLIMIT 10\n```\n\nOpen at least the top 2-3 traces for the user:\n\n```json\nposthog:query-llm-trace\n{\n  \"traceId\": \"\u003Ctrace_id>\",\n  \"dateRange\": { \"date_from\": \"-30d\" }\n}\n```\n\nLook for the first concrete pattern that explains the aggregate:\n\n- repeated tool calls or retry loops\n- large context windows or repeated retrieved documents\n- long multi-turn sessions\n- expensive model selected for ordinary tasks\n- many small calls from the same workflow\n- verbose outputs or unconstrained reasoning\n- web-search or request-fee-heavy calls\n- errors that still incurred model cost\n\n### 6. Check custom dimensions when the aggregate is ambiguous\n\nIf the top user appears expensive but the model\u002Ftoken breakdown does not explain\nwhy, discover custom event properties on `$ai_generation` and group by the\nlikely product dimensions. Common examples are `feature`, `tenant_id`,\n`organization_id`, `workflow_name`, `agent`, `route`, or `environment`, but do\nnot guess.\n\n1. Call `posthog:read-data-schema` with `kind: \"event_properties\"` and\n   `event_name: \"$ai_generation\"`.\n2. For promising fields, call `posthog:read-data-schema` with\n   `kind: \"event_property_values\"` to confirm actual values.\n3. Group the top user's cost by the discovered property.\n\n```sql\nposthog:execute-sql\nSELECT\n    toString(properties.\u003Cproperty_name>) AS dimension,\n    count() AS generations,\n    countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation\nFROM events\nWHERE event = '$ai_generation'\n    AND timestamp >= now() - INTERVAL 30 DAY\n    AND distinct_id = '\u003Cdistinct_id>'\n    AND isNotNull(properties.\u003Cproperty_name>)\nGROUP BY dimension\nORDER BY total_cost DESC\nLIMIT 20\n```\n\nThis is often the difference between \"user 123 is expensive\" and \"their\ncontract-review workflow is expensive because every run feeds a 90k-token\ndocument to the most costly model.\"\n\n## Constructing UI links\n\nUse `posthog:generate-app-url` for links. Do not hardcode the host because the\nproject may be in a different region.\n\n- Traces list: `generate-app-url { \"url\": \"\u002Fai-observability\u002Ftraces\" }`\n- Single trace: `generate-app-url { \"url\": \"\u002Fai-observability\u002Ftraces\u002F{id}\", \"params\": { \"id\": \"\u003Ctrace_id>\" } }`\n\nFor a single trace, append `?timestamp=\u003Curl_encoded_started_at>` when you have\nthe trace timestamp so the UI opens the right time window.\n\n## Response shape\n\nLead with the answer, not the queries. A good response has:\n\n1. **Top users** - ranked by total cost, with total cost, share of spend,\n   generations, traces, average cost per generation, and error rate. Identify\n   each user by a label only (email, name, or `distinct_id`). Do not print raw\n   `person.properties` objects or other personal fields the user did not ask for.\n2. **Why they are expensive** - one or two concrete drivers per user, compared\n   against the baseline.\n3. **Evidence** - model\u002Ftoken\u002Fcache\u002Fcustom-dimension breakdowns plus linked\n   example traces you read.\n4. **Likely levers** - specific optimization ideas tied to the observed driver:\n   reduce context, cap output, use a cheaper model for a workflow, improve\n   caching, fix retry loops, or split a feature's traffic.\n5. **Caveats** - whether the result includes embeddings, excludes trace-id\n   defaults, or uses a different event set than the initial ranking.\n\nAvoid generic advice. \"Use cheaper models\" is not useful unless the data shows\nthat model mix is the driver. \"Reduce prompt size\" is not useful unless input\ntokens are high relative to the baseline.\n",{"data":49,"body":50},{"name":4,"description":6},{"type":51,"children":52},"root",[53,61,67,89,96,209,215,403,409,416,421,731,744,782,817,823,828,1051,1056,1062,1067,1262,1267,1347,1353,1358,1363,1406,1412,1423,1570,1575,1714,1719,1762,1768,1828,1884,2001,2006,2012,2024,2049,2062,2068,2073,2140,2145],{"type":54,"tag":55,"props":56,"children":57},"element","h1",{"id":4},[58],{"type":59,"value":60},"text","Analyzing expensive users",{"type":54,"tag":62,"props":63,"children":64},"p",{},[65],{"type":59,"value":66},"Use this skill when the user wants to understand the most expensive users in\nAI observability. The job is not just to rank users by cost. The useful answer\nexplains what makes the top users expensive: volume, model choice, prompt size,\noutput size, cache behavior, retries\u002Ferrors, trace type, feature or tenant\ndimensions, and representative trace examples.",{"type":54,"tag":62,"props":68,"children":69},{},[70,72,79,81,87],{"type":59,"value":71},"For general cost rollups, also use ",{"type":54,"tag":73,"props":74,"children":76},"code",{"className":75},[],[77],{"type":59,"value":78},"exploring-llm-costs",{"type":59,"value":80},". For reading\nindividual traces, also use ",{"type":54,"tag":73,"props":82,"children":84},{"className":83},[],[85],{"type":59,"value":86},"exploring-llm-traces",{"type":59,"value":88},".",{"type":54,"tag":90,"props":91,"children":93},"h2",{"id":92},"tools",[94],{"type":59,"value":95},"Tools",{"type":54,"tag":97,"props":98,"children":99},"table",{},[100,119],{"type":54,"tag":101,"props":102,"children":103},"thead",{},[104],{"type":54,"tag":105,"props":106,"children":107},"tr",{},[108,114],{"type":54,"tag":109,"props":110,"children":111},"th",{},[112],{"type":59,"value":113},"Tool",{"type":54,"tag":109,"props":115,"children":116},{},[117],{"type":59,"value":118},"Purpose",{"type":54,"tag":120,"props":121,"children":122},"tbody",{},[123,141,158,175,192],{"type":54,"tag":105,"props":124,"children":125},{},[126,136],{"type":54,"tag":127,"props":128,"children":129},"td",{},[130],{"type":54,"tag":73,"props":131,"children":133},{"className":132},[],[134],{"type":59,"value":135},"posthog:execute-sql",{"type":54,"tag":127,"props":137,"children":138},{},[139],{"type":59,"value":140},"Rank users and compare their metrics against the project baseline",{"type":54,"tag":105,"props":142,"children":143},{},[144,153],{"type":54,"tag":127,"props":145,"children":146},{},[147],{"type":54,"tag":73,"props":148,"children":150},{"className":149},[],[151],{"type":59,"value":152},"posthog:query-llm-traces-list",{"type":54,"tag":127,"props":154,"children":155},{},[156],{"type":59,"value":157},"Find high-cost traces for a specific user",{"type":54,"tag":105,"props":159,"children":160},{},[161,170],{"type":54,"tag":127,"props":162,"children":163},{},[164],{"type":54,"tag":73,"props":165,"children":167},{"className":166},[],[168],{"type":59,"value":169},"posthog:query-llm-trace",{"type":54,"tag":127,"props":171,"children":172},{},[173],{"type":59,"value":174},"Read representative traces to explain what actually happened",{"type":54,"tag":105,"props":176,"children":177},{},[178,187],{"type":54,"tag":127,"props":179,"children":180},{},[181],{"type":54,"tag":73,"props":182,"children":184},{"className":183},[],[185],{"type":59,"value":186},"posthog:read-data-schema",{"type":54,"tag":127,"props":188,"children":189},{},[190],{"type":59,"value":191},"Discover custom event or person properties before grouping by them",{"type":54,"tag":105,"props":193,"children":194},{},[195,204],{"type":54,"tag":127,"props":196,"children":197},{},[198],{"type":54,"tag":73,"props":199,"children":201},{"className":200},[],[202],{"type":59,"value":203},"posthog:generate-app-url",{"type":54,"tag":127,"props":205,"children":206},{},[207],{"type":59,"value":208},"Build region- and project-qualified links back to the UI",{"type":54,"tag":90,"props":210,"children":212},{"id":211},"core-rules",[213],{"type":59,"value":214},"Core rules",{"type":54,"tag":216,"props":217,"children":218},"ul",{},[219,231,303,321,354,393],{"type":54,"tag":220,"props":221,"children":222},"li",{},[223,229],{"type":54,"tag":224,"props":225,"children":226},"strong",{},[227],{"type":59,"value":228},"Start with a bounded time range.",{"type":59,"value":230}," If the user does not specify one, use the\nlast 30 days and say so. If the user provides a link or existing filters,\npreserve the date range, test-account filter, and property filters.",{"type":54,"tag":220,"props":232,"children":233},{},[234,239,241,247,249,255,257,263,265,271,273,279,280,286,287,293,295,301],{"type":54,"tag":224,"props":235,"children":236},{},[237],{"type":59,"value":238},"Start from generated-call spend.",{"type":59,"value":240}," The per-user ranking query groups\n",{"type":54,"tag":73,"props":242,"children":244},{"className":243},[],[245],{"type":59,"value":246},"$ai_generation",{"type":59,"value":248}," rows by ",{"type":54,"tag":73,"props":250,"children":252},{"className":251},[],[253],{"type":59,"value":254},"distinct_id",{"type":59,"value":256},", with ",{"type":54,"tag":73,"props":258,"children":260},{"className":259},[],[261],{"type":59,"value":262},"traces",{"type":59,"value":264},", ",{"type":54,"tag":73,"props":266,"children":268},{"className":267},[],[269],{"type":59,"value":270},"generations",{"type":59,"value":272},",\n",{"type":54,"tag":73,"props":274,"children":276},{"className":275},[],[277],{"type":59,"value":278},"errors",{"type":59,"value":264},{"type":54,"tag":73,"props":281,"children":283},{"className":282},[],[284],{"type":59,"value":285},"total_cost",{"type":59,"value":264},{"type":54,"tag":73,"props":288,"children":290},{"className":289},[],[291],{"type":59,"value":292},"first_seen",{"type":59,"value":294},", and ",{"type":54,"tag":73,"props":296,"children":298},{"className":297},[],[299],{"type":59,"value":300},"last_seen",{"type":59,"value":302},". This is the best\nfirst pass for finding expensive users.",{"type":54,"tag":220,"props":304,"children":305},{},[306,311,313,319],{"type":54,"tag":224,"props":307,"children":308},{},[309],{"type":59,"value":310},"For full spend by user, include embeddings deliberately.",{"type":59,"value":312}," Broader cost\nrollups should include ",{"type":54,"tag":73,"props":314,"children":316},{"className":315},[],[317],{"type":59,"value":318},"event IN ('$ai_generation', '$ai_embedding')",{"type":59,"value":320},", but\ncall out when the event set changes.",{"type":54,"tag":220,"props":322,"children":323},{},[324,329,331,337,339,344,346,352],{"type":54,"tag":224,"props":325,"children":326},{},[327],{"type":59,"value":328},"Filter trace-id defaults when interpreting users.",{"type":59,"value":330}," Some SDKs use\n",{"type":54,"tag":73,"props":332,"children":334},{"className":333},[],[335],{"type":59,"value":336},"$ai_trace_id",{"type":59,"value":338}," as ",{"type":54,"tag":73,"props":340,"children":342},{"className":341},[],[343],{"type":59,"value":254},{"type":59,"value":345}," when no user is set. For identified users,\nexclude ",{"type":54,"tag":73,"props":347,"children":349},{"className":348},[],[350],{"type":59,"value":351},"distinct_id = properties.$ai_trace_id",{"type":59,"value":353}," and flag how much spend\nbecomes unattributed.",{"type":54,"tag":220,"props":355,"children":356},{},[357,362,364,370,371,377,378,384,385,391],{"type":54,"tag":224,"props":358,"children":359},{},[360],{"type":59,"value":361},"Do not guess custom dimensions.",{"type":59,"value":363}," Discover event and person properties\nbefore grouping by ",{"type":54,"tag":73,"props":365,"children":367},{"className":366},[],[368],{"type":59,"value":369},"feature",{"type":59,"value":264},{"type":54,"tag":73,"props":372,"children":374},{"className":373},[],[375],{"type":59,"value":376},"tenant_id",{"type":59,"value":264},{"type":54,"tag":73,"props":379,"children":381},{"className":380},[],[382],{"type":59,"value":383},"plan",{"type":59,"value":264},{"type":54,"tag":73,"props":386,"children":388},{"className":387},[],[389],{"type":59,"value":390},"workflow_name",{"type":59,"value":392},", or similar\ncustomer-specific fields.",{"type":54,"tag":220,"props":394,"children":395},{},[396,401],{"type":54,"tag":224,"props":397,"children":398},{},[399],{"type":59,"value":400},"Read traces before explaining causality.",{"type":59,"value":402}," Aggregates identify suspects;\nrepresentative traces show whether the user is expensive because of a real\nworkflow, retries, loops, large context, tool-heavy generations, or other\nbehavior.",{"type":54,"tag":90,"props":404,"children":406},{"id":405},"workflow",[407],{"type":59,"value":408},"Workflow",{"type":54,"tag":410,"props":411,"children":413},"h3",{"id":412},"_1-rank-users-by-generated-call-spend",[414],{"type":59,"value":415},"1. Rank users by generated-call spend",{"type":54,"tag":62,"props":417,"children":418},{},[419],{"type":59,"value":420},"Use this first when the question asks for the most expensive users:",{"type":54,"tag":422,"props":423,"children":428},"pre",{"className":424,"code":425,"language":426,"meta":427,"style":427},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","posthog:execute-sql\nSELECT\n    distinct_id,\n    argMax(email, timestamp) AS email,\n    argMax(name, timestamp) AS name,\n    countDistinctIf(ai_trace_id, notEmpty(ai_trace_id)) AS traces,\n    count() AS generations,\n    countIf(notEmpty(ai_error) OR ai_is_error = 'true') AS errors,\n    round(sum(ai_total_cost_usd), 4) AS total_cost,\n    round(avg(ai_total_cost_usd), 6) AS avg_cost_per_generation,\n    sum(ai_input_tokens) AS input_tokens,\n    sum(ai_output_tokens) AS output_tokens,\n    min(timestamp) AS first_seen,\n    max(timestamp) AS last_seen\nFROM (\n    SELECT\n        distinct_id,\n        timestamp,\n        toString(properties.$ai_trace_id) AS ai_trace_id,\n        toFloat(properties.$ai_total_cost_usd) AS ai_total_cost_usd,\n        toString(properties.$ai_error) AS ai_error,\n        toString(properties.$ai_is_error) AS ai_is_error,\n        toInt(properties.$ai_input_tokens) AS ai_input_tokens,\n        toInt(properties.$ai_output_tokens) AS ai_output_tokens,\n        toString(person.properties.email) AS email,\n        toString(person.properties.name) AS name\n    FROM events\n    WHERE event = '$ai_generation'\n        AND timestamp >= now() - INTERVAL 30 DAY\n)\nGROUP BY distinct_id\nORDER BY total_cost DESC\nLIMIT 25\n","sql","",[429],{"type":54,"tag":73,"props":430,"children":431},{"__ignoreMap":427},[432,443,452,461,470,479,488,497,506,515,524,533,542,551,560,569,578,587,596,605,614,623,632,641,650,659,668,677,686,695,704,713,722],{"type":54,"tag":433,"props":434,"children":437},"span",{"class":435,"line":436},"line",1,[438],{"type":54,"tag":433,"props":439,"children":440},{},[441],{"type":59,"value":442},"posthog:execute-sql\n",{"type":54,"tag":433,"props":444,"children":446},{"class":435,"line":445},2,[447],{"type":54,"tag":433,"props":448,"children":449},{},[450],{"type":59,"value":451},"SELECT\n",{"type":54,"tag":433,"props":453,"children":455},{"class":435,"line":454},3,[456],{"type":54,"tag":433,"props":457,"children":458},{},[459],{"type":59,"value":460},"    distinct_id,\n",{"type":54,"tag":433,"props":462,"children":464},{"class":435,"line":463},4,[465],{"type":54,"tag":433,"props":466,"children":467},{},[468],{"type":59,"value":469},"    argMax(email, timestamp) AS email,\n",{"type":54,"tag":433,"props":471,"children":473},{"class":435,"line":472},5,[474],{"type":54,"tag":433,"props":475,"children":476},{},[477],{"type":59,"value":478},"    argMax(name, timestamp) AS name,\n",{"type":54,"tag":433,"props":480,"children":482},{"class":435,"line":481},6,[483],{"type":54,"tag":433,"props":484,"children":485},{},[486],{"type":59,"value":487},"    countDistinctIf(ai_trace_id, notEmpty(ai_trace_id)) AS traces,\n",{"type":54,"tag":433,"props":489,"children":491},{"class":435,"line":490},7,[492],{"type":54,"tag":433,"props":493,"children":494},{},[495],{"type":59,"value":496},"    count() AS generations,\n",{"type":54,"tag":433,"props":498,"children":500},{"class":435,"line":499},8,[501],{"type":54,"tag":433,"props":502,"children":503},{},[504],{"type":59,"value":505},"    countIf(notEmpty(ai_error) OR ai_is_error = 'true') AS errors,\n",{"type":54,"tag":433,"props":507,"children":509},{"class":435,"line":508},9,[510],{"type":54,"tag":433,"props":511,"children":512},{},[513],{"type":59,"value":514},"    round(sum(ai_total_cost_usd), 4) AS total_cost,\n",{"type":54,"tag":433,"props":516,"children":518},{"class":435,"line":517},10,[519],{"type":54,"tag":433,"props":520,"children":521},{},[522],{"type":59,"value":523},"    round(avg(ai_total_cost_usd), 6) AS avg_cost_per_generation,\n",{"type":54,"tag":433,"props":525,"children":527},{"class":435,"line":526},11,[528],{"type":54,"tag":433,"props":529,"children":530},{},[531],{"type":59,"value":532},"    sum(ai_input_tokens) AS input_tokens,\n",{"type":54,"tag":433,"props":534,"children":536},{"class":435,"line":535},12,[537],{"type":54,"tag":433,"props":538,"children":539},{},[540],{"type":59,"value":541},"    sum(ai_output_tokens) AS output_tokens,\n",{"type":54,"tag":433,"props":543,"children":545},{"class":435,"line":544},13,[546],{"type":54,"tag":433,"props":547,"children":548},{},[549],{"type":59,"value":550},"    min(timestamp) AS first_seen,\n",{"type":54,"tag":433,"props":552,"children":554},{"class":435,"line":553},14,[555],{"type":54,"tag":433,"props":556,"children":557},{},[558],{"type":59,"value":559},"    max(timestamp) AS last_seen\n",{"type":54,"tag":433,"props":561,"children":563},{"class":435,"line":562},15,[564],{"type":54,"tag":433,"props":565,"children":566},{},[567],{"type":59,"value":568},"FROM (\n",{"type":54,"tag":433,"props":570,"children":572},{"class":435,"line":571},16,[573],{"type":54,"tag":433,"props":574,"children":575},{},[576],{"type":59,"value":577},"    SELECT\n",{"type":54,"tag":433,"props":579,"children":581},{"class":435,"line":580},17,[582],{"type":54,"tag":433,"props":583,"children":584},{},[585],{"type":59,"value":586},"        distinct_id,\n",{"type":54,"tag":433,"props":588,"children":590},{"class":435,"line":589},18,[591],{"type":54,"tag":433,"props":592,"children":593},{},[594],{"type":59,"value":595},"        timestamp,\n",{"type":54,"tag":433,"props":597,"children":599},{"class":435,"line":598},19,[600],{"type":54,"tag":433,"props":601,"children":602},{},[603],{"type":59,"value":604},"        toString(properties.$ai_trace_id) AS ai_trace_id,\n",{"type":54,"tag":433,"props":606,"children":608},{"class":435,"line":607},20,[609],{"type":54,"tag":433,"props":610,"children":611},{},[612],{"type":59,"value":613},"        toFloat(properties.$ai_total_cost_usd) AS ai_total_cost_usd,\n",{"type":54,"tag":433,"props":615,"children":617},{"class":435,"line":616},21,[618],{"type":54,"tag":433,"props":619,"children":620},{},[621],{"type":59,"value":622},"        toString(properties.$ai_error) AS ai_error,\n",{"type":54,"tag":433,"props":624,"children":626},{"class":435,"line":625},22,[627],{"type":54,"tag":433,"props":628,"children":629},{},[630],{"type":59,"value":631},"        toString(properties.$ai_is_error) AS ai_is_error,\n",{"type":54,"tag":433,"props":633,"children":635},{"class":435,"line":634},23,[636],{"type":54,"tag":433,"props":637,"children":638},{},[639],{"type":59,"value":640},"        toInt(properties.$ai_input_tokens) AS ai_input_tokens,\n",{"type":54,"tag":433,"props":642,"children":644},{"class":435,"line":643},24,[645],{"type":54,"tag":433,"props":646,"children":647},{},[648],{"type":59,"value":649},"        toInt(properties.$ai_output_tokens) AS ai_output_tokens,\n",{"type":54,"tag":433,"props":651,"children":653},{"class":435,"line":652},25,[654],{"type":54,"tag":433,"props":655,"children":656},{},[657],{"type":59,"value":658},"        toString(person.properties.email) AS email,\n",{"type":54,"tag":433,"props":660,"children":662},{"class":435,"line":661},26,[663],{"type":54,"tag":433,"props":664,"children":665},{},[666],{"type":59,"value":667},"        toString(person.properties.name) AS name\n",{"type":54,"tag":433,"props":669,"children":671},{"class":435,"line":670},27,[672],{"type":54,"tag":433,"props":673,"children":674},{},[675],{"type":59,"value":676},"    FROM events\n",{"type":54,"tag":433,"props":678,"children":680},{"class":435,"line":679},28,[681],{"type":54,"tag":433,"props":682,"children":683},{},[684],{"type":59,"value":685},"    WHERE event = '$ai_generation'\n",{"type":54,"tag":433,"props":687,"children":689},{"class":435,"line":688},29,[690],{"type":54,"tag":433,"props":691,"children":692},{},[693],{"type":59,"value":694},"        AND timestamp >= now() - INTERVAL 30 DAY\n",{"type":54,"tag":433,"props":696,"children":698},{"class":435,"line":697},30,[699],{"type":54,"tag":433,"props":700,"children":701},{},[702],{"type":59,"value":703},")\n",{"type":54,"tag":433,"props":705,"children":707},{"class":435,"line":706},31,[708],{"type":54,"tag":433,"props":709,"children":710},{},[711],{"type":59,"value":712},"GROUP BY distinct_id\n",{"type":54,"tag":433,"props":714,"children":716},{"class":435,"line":715},32,[717],{"type":54,"tag":433,"props":718,"children":719},{},[720],{"type":59,"value":721},"ORDER BY total_cost DESC\n",{"type":54,"tag":433,"props":723,"children":725},{"class":435,"line":724},33,[726],{"type":54,"tag":433,"props":727,"children":728},{},[729],{"type":59,"value":730},"LIMIT 25\n",{"type":54,"tag":62,"props":732,"children":733},{},[734,736,742],{"type":59,"value":735},"If the user is asking for identified users, add this\ninside the inner ",{"type":54,"tag":73,"props":737,"children":739},{"className":738},[],[740],{"type":59,"value":741},"WHERE",{"type":59,"value":743}," clause:",{"type":54,"tag":422,"props":745,"children":747},{"className":424,"code":746,"language":426,"meta":427,"style":427},"AND (\n    properties.$ai_trace_id IS NULL\n    OR distinct_id != properties.$ai_trace_id\n)\n",[748],{"type":54,"tag":73,"props":749,"children":750},{"__ignoreMap":427},[751,759,767,775],{"type":54,"tag":433,"props":752,"children":753},{"class":435,"line":436},[754],{"type":54,"tag":433,"props":755,"children":756},{},[757],{"type":59,"value":758},"AND (\n",{"type":54,"tag":433,"props":760,"children":761},{"class":435,"line":445},[762],{"type":54,"tag":433,"props":763,"children":764},{},[765],{"type":59,"value":766},"    properties.$ai_trace_id IS NULL\n",{"type":54,"tag":433,"props":768,"children":769},{"class":435,"line":454},[770],{"type":54,"tag":433,"props":771,"children":772},{},[773],{"type":59,"value":774},"    OR distinct_id != properties.$ai_trace_id\n",{"type":54,"tag":433,"props":776,"children":777},{"class":435,"line":463},[778],{"type":54,"tag":433,"props":779,"children":780},{},[781],{"type":59,"value":703},{"type":54,"tag":62,"props":783,"children":784},{},[785,787,793,795,801,803,809,811,816],{"type":59,"value":786},"Project only the explicit label columns you need, such as ",{"type":54,"tag":73,"props":788,"children":790},{"className":789},[],[791],{"type":59,"value":792},"email",{"type":59,"value":794}," and ",{"type":54,"tag":73,"props":796,"children":798},{"className":797},[],[799],{"type":59,"value":800},"name",{"type":59,"value":802},".\nNever select the raw ",{"type":54,"tag":73,"props":804,"children":806},{"className":805},[],[807],{"type":59,"value":808},"person.properties",{"type":59,"value":810}," object or a tuple containing it: it\nserializes the full property blob into the result and leaks personal data far\nbeyond a label. If a user has no email or name, fall back to ",{"type":54,"tag":73,"props":812,"children":814},{"className":813},[],[815],{"type":59,"value":254},{"type":59,"value":88},{"type":54,"tag":410,"props":818,"children":820},{"id":819},"_2-establish-the-baseline",[821],{"type":59,"value":822},"2. Establish the baseline",{"type":54,"tag":62,"props":824,"children":825},{},[826],{"type":59,"value":827},"The top user is only meaningful relative to everyone else. Run a per-user\nbaseline so you can say whether a user is expensive because they have more\ngenerations, more traces, higher cost per generation, longer prompts, longer\noutputs, or a higher error rate.",{"type":54,"tag":422,"props":829,"children":831},{"className":424,"code":830,"language":426,"meta":427,"style":427},"posthog:execute-sql\nWITH per_user AS (\n    SELECT\n        distinct_id,\n        count() AS generations,\n        countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n        countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors,\n        sum(toFloat(properties.$ai_total_cost_usd)) AS total_cost,\n        avg(toFloat(properties.$ai_total_cost_usd)) AS avg_cost_per_generation,\n        avg(toInt(properties.$ai_input_tokens)) AS avg_input_tokens,\n        avg(toInt(properties.$ai_output_tokens)) AS avg_output_tokens\n    FROM events\n    WHERE event = '$ai_generation'\n        AND timestamp >= now() - INTERVAL 30 DAY\n    GROUP BY distinct_id\n)\nSELECT\n    count() AS users,\n    round(sum(total_cost), 4) AS total_cost,\n    round(avg(total_cost), 4) AS avg_cost_per_user,\n    round(quantile(0.5)(total_cost), 4) AS p50_user_cost,\n    round(quantile(0.9)(total_cost), 4) AS p90_user_cost,\n    round(quantile(0.99)(total_cost), 4) AS p99_user_cost,\n    round(avg(avg_cost_per_generation), 6) AS avg_cost_per_generation,\n    round(avg(avg_input_tokens), 0) AS avg_input_tokens,\n    round(avg(avg_output_tokens), 0) AS avg_output_tokens,\n    round(sum(errors) \u002F nullIf(sum(generations), 0), 4) AS error_rate\nFROM per_user\n",[832],{"type":54,"tag":73,"props":833,"children":834},{"__ignoreMap":427},[835,842,850,857,864,872,880,888,896,904,912,920,927,934,941,949,956,963,971,979,987,995,1003,1011,1019,1027,1035,1043],{"type":54,"tag":433,"props":836,"children":837},{"class":435,"line":436},[838],{"type":54,"tag":433,"props":839,"children":840},{},[841],{"type":59,"value":442},{"type":54,"tag":433,"props":843,"children":844},{"class":435,"line":445},[845],{"type":54,"tag":433,"props":846,"children":847},{},[848],{"type":59,"value":849},"WITH per_user AS (\n",{"type":54,"tag":433,"props":851,"children":852},{"class":435,"line":454},[853],{"type":54,"tag":433,"props":854,"children":855},{},[856],{"type":59,"value":577},{"type":54,"tag":433,"props":858,"children":859},{"class":435,"line":463},[860],{"type":54,"tag":433,"props":861,"children":862},{},[863],{"type":59,"value":586},{"type":54,"tag":433,"props":865,"children":866},{"class":435,"line":472},[867],{"type":54,"tag":433,"props":868,"children":869},{},[870],{"type":59,"value":871},"        count() AS generations,\n",{"type":54,"tag":433,"props":873,"children":874},{"class":435,"line":481},[875],{"type":54,"tag":433,"props":876,"children":877},{},[878],{"type":59,"value":879},"        countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n",{"type":54,"tag":433,"props":881,"children":882},{"class":435,"line":490},[883],{"type":54,"tag":433,"props":884,"children":885},{},[886],{"type":59,"value":887},"        countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors,\n",{"type":54,"tag":433,"props":889,"children":890},{"class":435,"line":499},[891],{"type":54,"tag":433,"props":892,"children":893},{},[894],{"type":59,"value":895},"        sum(toFloat(properties.$ai_total_cost_usd)) AS total_cost,\n",{"type":54,"tag":433,"props":897,"children":898},{"class":435,"line":508},[899],{"type":54,"tag":433,"props":900,"children":901},{},[902],{"type":59,"value":903},"        avg(toFloat(properties.$ai_total_cost_usd)) AS avg_cost_per_generation,\n",{"type":54,"tag":433,"props":905,"children":906},{"class":435,"line":517},[907],{"type":54,"tag":433,"props":908,"children":909},{},[910],{"type":59,"value":911},"        avg(toInt(properties.$ai_input_tokens)) AS avg_input_tokens,\n",{"type":54,"tag":433,"props":913,"children":914},{"class":435,"line":526},[915],{"type":54,"tag":433,"props":916,"children":917},{},[918],{"type":59,"value":919},"        avg(toInt(properties.$ai_output_tokens)) AS avg_output_tokens\n",{"type":54,"tag":433,"props":921,"children":922},{"class":435,"line":535},[923],{"type":54,"tag":433,"props":924,"children":925},{},[926],{"type":59,"value":676},{"type":54,"tag":433,"props":928,"children":929},{"class":435,"line":544},[930],{"type":54,"tag":433,"props":931,"children":932},{},[933],{"type":59,"value":685},{"type":54,"tag":433,"props":935,"children":936},{"class":435,"line":553},[937],{"type":54,"tag":433,"props":938,"children":939},{},[940],{"type":59,"value":694},{"type":54,"tag":433,"props":942,"children":943},{"class":435,"line":562},[944],{"type":54,"tag":433,"props":945,"children":946},{},[947],{"type":59,"value":948},"    GROUP BY distinct_id\n",{"type":54,"tag":433,"props":950,"children":951},{"class":435,"line":571},[952],{"type":54,"tag":433,"props":953,"children":954},{},[955],{"type":59,"value":703},{"type":54,"tag":433,"props":957,"children":958},{"class":435,"line":580},[959],{"type":54,"tag":433,"props":960,"children":961},{},[962],{"type":59,"value":451},{"type":54,"tag":433,"props":964,"children":965},{"class":435,"line":589},[966],{"type":54,"tag":433,"props":967,"children":968},{},[969],{"type":59,"value":970},"    count() AS users,\n",{"type":54,"tag":433,"props":972,"children":973},{"class":435,"line":598},[974],{"type":54,"tag":433,"props":975,"children":976},{},[977],{"type":59,"value":978},"    round(sum(total_cost), 4) AS total_cost,\n",{"type":54,"tag":433,"props":980,"children":981},{"class":435,"line":607},[982],{"type":54,"tag":433,"props":983,"children":984},{},[985],{"type":59,"value":986},"    round(avg(total_cost), 4) AS avg_cost_per_user,\n",{"type":54,"tag":433,"props":988,"children":989},{"class":435,"line":616},[990],{"type":54,"tag":433,"props":991,"children":992},{},[993],{"type":59,"value":994},"    round(quantile(0.5)(total_cost), 4) AS p50_user_cost,\n",{"type":54,"tag":433,"props":996,"children":997},{"class":435,"line":625},[998],{"type":54,"tag":433,"props":999,"children":1000},{},[1001],{"type":59,"value":1002},"    round(quantile(0.9)(total_cost), 4) AS p90_user_cost,\n",{"type":54,"tag":433,"props":1004,"children":1005},{"class":435,"line":634},[1006],{"type":54,"tag":433,"props":1007,"children":1008},{},[1009],{"type":59,"value":1010},"    round(quantile(0.99)(total_cost), 4) AS p99_user_cost,\n",{"type":54,"tag":433,"props":1012,"children":1013},{"class":435,"line":643},[1014],{"type":54,"tag":433,"props":1015,"children":1016},{},[1017],{"type":59,"value":1018},"    round(avg(avg_cost_per_generation), 6) AS avg_cost_per_generation,\n",{"type":54,"tag":433,"props":1020,"children":1021},{"class":435,"line":652},[1022],{"type":54,"tag":433,"props":1023,"children":1024},{},[1025],{"type":59,"value":1026},"    round(avg(avg_input_tokens), 0) AS avg_input_tokens,\n",{"type":54,"tag":433,"props":1028,"children":1029},{"class":435,"line":661},[1030],{"type":54,"tag":433,"props":1031,"children":1032},{},[1033],{"type":59,"value":1034},"    round(avg(avg_output_tokens), 0) AS avg_output_tokens,\n",{"type":54,"tag":433,"props":1036,"children":1037},{"class":435,"line":670},[1038],{"type":54,"tag":433,"props":1039,"children":1040},{},[1041],{"type":59,"value":1042},"    round(sum(errors) \u002F nullIf(sum(generations), 0), 4) AS error_rate\n",{"type":54,"tag":433,"props":1044,"children":1045},{"class":435,"line":679},[1046],{"type":54,"tag":433,"props":1047,"children":1048},{},[1049],{"type":59,"value":1050},"FROM per_user\n",{"type":54,"tag":62,"props":1052,"children":1053},{},[1054],{"type":59,"value":1055},"When reporting top users, include each user's share of total spend and how many\nmultiples above p50\u002Fp90 they are. That makes the skew obvious.",{"type":54,"tag":410,"props":1057,"children":1059},{"id":1058},"_3-decompose-the-top-users-cost-drivers",[1060],{"type":59,"value":1061},"3. Decompose the top user's cost drivers",{"type":54,"tag":62,"props":1063,"children":1064},{},[1065],{"type":59,"value":1066},"For each top user worth explaining, break their spend down by model and token\neconomics.",{"type":54,"tag":422,"props":1068,"children":1070},{"className":424,"code":1069,"language":426,"meta":427,"style":427},"posthog:execute-sql\nSELECT\n    toString(properties.$ai_provider) AS provider,\n    toString(properties.$ai_model) AS model,\n    count() AS generations,\n    countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation,\n    sum(toInt(properties.$ai_input_tokens)) AS input_tokens,\n    sum(toInt(properties.$ai_output_tokens)) AS output_tokens,\n    sum(toInt(properties.$ai_reasoning_tokens)) AS reasoning_tokens,\n    sum(toInt(properties.$ai_cache_read_input_tokens)) AS cache_read_tokens,\n    sum(toInt(properties.$ai_cache_creation_input_tokens)) AS cache_write_tokens,\n    round(sum(toFloat(properties.$ai_input_cost_usd)), 4) AS input_cost,\n    round(sum(toFloat(properties.$ai_output_cost_usd)), 4) AS output_cost,\n    round(sum(toFloat(properties.$ai_request_cost_usd)), 4) AS request_cost,\n    round(sum(toFloat(properties.$ai_web_search_cost_usd)), 4) AS web_search_cost,\n    countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors\nFROM events\nWHERE event = '$ai_generation'\n    AND timestamp >= now() - INTERVAL 30 DAY\n    AND distinct_id = '\u003Cdistinct_id>'\nGROUP BY provider, model\nORDER BY total_cost DESC\n",[1071],{"type":54,"tag":73,"props":1072,"children":1073},{"__ignoreMap":427},[1074,1081,1088,1096,1104,1111,1119,1127,1135,1143,1151,1159,1167,1175,1183,1191,1199,1207,1215,1223,1231,1239,1247,1255],{"type":54,"tag":433,"props":1075,"children":1076},{"class":435,"line":436},[1077],{"type":54,"tag":433,"props":1078,"children":1079},{},[1080],{"type":59,"value":442},{"type":54,"tag":433,"props":1082,"children":1083},{"class":435,"line":445},[1084],{"type":54,"tag":433,"props":1085,"children":1086},{},[1087],{"type":59,"value":451},{"type":54,"tag":433,"props":1089,"children":1090},{"class":435,"line":454},[1091],{"type":54,"tag":433,"props":1092,"children":1093},{},[1094],{"type":59,"value":1095},"    toString(properties.$ai_provider) AS provider,\n",{"type":54,"tag":433,"props":1097,"children":1098},{"class":435,"line":463},[1099],{"type":54,"tag":433,"props":1100,"children":1101},{},[1102],{"type":59,"value":1103},"    toString(properties.$ai_model) AS model,\n",{"type":54,"tag":433,"props":1105,"children":1106},{"class":435,"line":472},[1107],{"type":54,"tag":433,"props":1108,"children":1109},{},[1110],{"type":59,"value":496},{"type":54,"tag":433,"props":1112,"children":1113},{"class":435,"line":481},[1114],{"type":54,"tag":433,"props":1115,"children":1116},{},[1117],{"type":59,"value":1118},"    countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n",{"type":54,"tag":433,"props":1120,"children":1121},{"class":435,"line":490},[1122],{"type":54,"tag":433,"props":1123,"children":1124},{},[1125],{"type":59,"value":1126},"    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n",{"type":54,"tag":433,"props":1128,"children":1129},{"class":435,"line":499},[1130],{"type":54,"tag":433,"props":1131,"children":1132},{},[1133],{"type":59,"value":1134},"    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation,\n",{"type":54,"tag":433,"props":1136,"children":1137},{"class":435,"line":508},[1138],{"type":54,"tag":433,"props":1139,"children":1140},{},[1141],{"type":59,"value":1142},"    sum(toInt(properties.$ai_input_tokens)) AS input_tokens,\n",{"type":54,"tag":433,"props":1144,"children":1145},{"class":435,"line":517},[1146],{"type":54,"tag":433,"props":1147,"children":1148},{},[1149],{"type":59,"value":1150},"    sum(toInt(properties.$ai_output_tokens)) AS output_tokens,\n",{"type":54,"tag":433,"props":1152,"children":1153},{"class":435,"line":526},[1154],{"type":54,"tag":433,"props":1155,"children":1156},{},[1157],{"type":59,"value":1158},"    sum(toInt(properties.$ai_reasoning_tokens)) AS reasoning_tokens,\n",{"type":54,"tag":433,"props":1160,"children":1161},{"class":435,"line":535},[1162],{"type":54,"tag":433,"props":1163,"children":1164},{},[1165],{"type":59,"value":1166},"    sum(toInt(properties.$ai_cache_read_input_tokens)) AS cache_read_tokens,\n",{"type":54,"tag":433,"props":1168,"children":1169},{"class":435,"line":544},[1170],{"type":54,"tag":433,"props":1171,"children":1172},{},[1173],{"type":59,"value":1174},"    sum(toInt(properties.$ai_cache_creation_input_tokens)) AS cache_write_tokens,\n",{"type":54,"tag":433,"props":1176,"children":1177},{"class":435,"line":553},[1178],{"type":54,"tag":433,"props":1179,"children":1180},{},[1181],{"type":59,"value":1182},"    round(sum(toFloat(properties.$ai_input_cost_usd)), 4) AS input_cost,\n",{"type":54,"tag":433,"props":1184,"children":1185},{"class":435,"line":562},[1186],{"type":54,"tag":433,"props":1187,"children":1188},{},[1189],{"type":59,"value":1190},"    round(sum(toFloat(properties.$ai_output_cost_usd)), 4) AS output_cost,\n",{"type":54,"tag":433,"props":1192,"children":1193},{"class":435,"line":571},[1194],{"type":54,"tag":433,"props":1195,"children":1196},{},[1197],{"type":59,"value":1198},"    round(sum(toFloat(properties.$ai_request_cost_usd)), 4) AS request_cost,\n",{"type":54,"tag":433,"props":1200,"children":1201},{"class":435,"line":580},[1202],{"type":54,"tag":433,"props":1203,"children":1204},{},[1205],{"type":59,"value":1206},"    round(sum(toFloat(properties.$ai_web_search_cost_usd)), 4) AS web_search_cost,\n",{"type":54,"tag":433,"props":1208,"children":1209},{"class":435,"line":589},[1210],{"type":54,"tag":433,"props":1211,"children":1212},{},[1213],{"type":59,"value":1214},"    countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors\n",{"type":54,"tag":433,"props":1216,"children":1217},{"class":435,"line":598},[1218],{"type":54,"tag":433,"props":1219,"children":1220},{},[1221],{"type":59,"value":1222},"FROM events\n",{"type":54,"tag":433,"props":1224,"children":1225},{"class":435,"line":607},[1226],{"type":54,"tag":433,"props":1227,"children":1228},{},[1229],{"type":59,"value":1230},"WHERE event = '$ai_generation'\n",{"type":54,"tag":433,"props":1232,"children":1233},{"class":435,"line":616},[1234],{"type":54,"tag":433,"props":1235,"children":1236},{},[1237],{"type":59,"value":1238},"    AND timestamp >= now() - INTERVAL 30 DAY\n",{"type":54,"tag":433,"props":1240,"children":1241},{"class":435,"line":625},[1242],{"type":54,"tag":433,"props":1243,"children":1244},{},[1245],{"type":59,"value":1246},"    AND distinct_id = '\u003Cdistinct_id>'\n",{"type":54,"tag":433,"props":1248,"children":1249},{"class":435,"line":634},[1250],{"type":54,"tag":433,"props":1251,"children":1252},{},[1253],{"type":59,"value":1254},"GROUP BY provider, model\n",{"type":54,"tag":433,"props":1256,"children":1257},{"class":435,"line":643},[1258],{"type":54,"tag":433,"props":1259,"children":1260},{},[1261],{"type":59,"value":721},{"type":54,"tag":62,"props":1263,"children":1264},{},[1265],{"type":59,"value":1266},"Interpret the result using this decision tree:",{"type":54,"tag":216,"props":1268,"children":1269},{},[1270,1280,1290,1300,1310,1327,1337],{"type":54,"tag":220,"props":1271,"children":1272},{},[1273,1278],{"type":54,"tag":224,"props":1274,"children":1275},{},[1276],{"type":59,"value":1277},"High generations, ordinary cost per generation",{"type":59,"value":1279}," means volume is the driver.",{"type":54,"tag":220,"props":1281,"children":1282},{},[1283,1288],{"type":54,"tag":224,"props":1284,"children":1285},{},[1286],{"type":59,"value":1287},"High cost per generation, ordinary volume",{"type":59,"value":1289}," means expensive models, long\ncontext, long outputs, reasoning tokens, web-search fees, or request fees are\nthe driver.",{"type":54,"tag":220,"props":1291,"children":1292},{},[1293,1298],{"type":54,"tag":224,"props":1294,"children":1295},{},[1296],{"type":59,"value":1297},"High input tokens",{"type":59,"value":1299}," usually points to context bloat, repeated conversation\nhistory, large retrieved documents, or missing truncation.",{"type":54,"tag":220,"props":1301,"children":1302},{},[1303,1308],{"type":54,"tag":224,"props":1304,"children":1305},{},[1306],{"type":59,"value":1307},"High output or reasoning tokens",{"type":59,"value":1309}," points to verbose answers, chain-of-thought\nstyle reasoning models, missing output limits, or tool loops.",{"type":54,"tag":220,"props":1311,"children":1312},{},[1313,1318,1320,1326],{"type":54,"tag":224,"props":1314,"children":1315},{},[1316],{"type":59,"value":1317},"Low cache reuse with high repeated input",{"type":59,"value":1319}," points to missed prompt caching.\nUse the cache formula from ",{"type":54,"tag":73,"props":1321,"children":1323},{"className":1322},[],[1324],{"type":59,"value":1325},"exploring-llm-costs\u002Freferences\u002Fcache-accounting.md",{"type":59,"value":88},{"type":54,"tag":220,"props":1328,"children":1329},{},[1330,1335],{"type":54,"tag":224,"props":1331,"children":1332},{},[1333],{"type":59,"value":1334},"High errors or many high-cost traces",{"type":59,"value":1336}," points to retries, failed tool calls,\nor loops. Read traces before saying which one.",{"type":54,"tag":220,"props":1338,"children":1339},{},[1340,1345],{"type":54,"tag":224,"props":1341,"children":1342},{},[1343],{"type":59,"value":1344},"High request or web-search cost",{"type":59,"value":1346}," points to provider flat fees or tool-heavy\ngenerations, not token volume alone.",{"type":54,"tag":410,"props":1348,"children":1350},{"id":1349},"_4-compare-the-top-user-against-everyone-else",[1351],{"type":59,"value":1352},"4. Compare the top user against everyone else",{"type":54,"tag":62,"props":1354,"children":1355},{},[1356],{"type":59,"value":1357},"Run the same model or token breakdown for the whole project, then compare. Do\nnot rely on raw totals only. You want statements like \"this user used the same\nmodels as everyone else, but had 9x more generations\" or \"their volume was\nnormal, but 82% of spend went to a high-cost model that is rare elsewhere.\"",{"type":54,"tag":62,"props":1359,"children":1360},{},[1361],{"type":59,"value":1362},"Useful comparisons:",{"type":54,"tag":216,"props":1364,"children":1365},{},[1366,1371,1376,1381,1386,1391,1396,1401],{"type":54,"tag":220,"props":1367,"children":1368},{},[1369],{"type":59,"value":1370},"Top user's share of total project cost",{"type":54,"tag":220,"props":1372,"children":1373},{},[1374],{"type":59,"value":1375},"Top user's generations and traces versus p50\u002Fp90 user",{"type":54,"tag":220,"props":1377,"children":1378},{},[1379],{"type":59,"value":1380},"Average cost per generation versus project average",{"type":54,"tag":220,"props":1382,"children":1383},{},[1384],{"type":59,"value":1385},"Input tokens per generation versus project average",{"type":54,"tag":220,"props":1387,"children":1388},{},[1389],{"type":59,"value":1390},"Output or reasoning tokens per generation versus project average",{"type":54,"tag":220,"props":1392,"children":1393},{},[1394],{"type":59,"value":1395},"Error rate versus project average",{"type":54,"tag":220,"props":1397,"children":1398},{},[1399],{"type":59,"value":1400},"Model mix versus global model mix",{"type":54,"tag":220,"props":1402,"children":1403},{},[1404],{"type":59,"value":1405},"Cache-hit rate versus global cache-hit rate for the same model",{"type":54,"tag":410,"props":1407,"children":1409},{"id":1408},"_5-find-the-users-expensive-traces",[1410],{"type":59,"value":1411},"5. Find the user's expensive traces",{"type":54,"tag":62,"props":1413,"children":1414},{},[1415,1417,1422],{"type":59,"value":1416},"Use SQL for the ranked trace list, then read representative traces with\n",{"type":54,"tag":73,"props":1418,"children":1420},{"className":1419},[],[1421],{"type":59,"value":169},{"type":59,"value":88},{"type":54,"tag":422,"props":1424,"children":1426},{"className":424,"code":1425,"language":426,"meta":427,"style":427},"posthog:execute-sql\nSELECT\n    toString(properties.$ai_trace_id) AS trace_id,\n    count() AS generations,\n    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation,\n    sum(toInt(properties.$ai_input_tokens)) AS input_tokens,\n    sum(toInt(properties.$ai_output_tokens)) AS output_tokens,\n    countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors,\n    min(timestamp) AS started_at,\n    max(timestamp) AS ended_at\nFROM events\nWHERE event = '$ai_generation'\n    AND timestamp >= now() - INTERVAL 30 DAY\n    AND distinct_id = '\u003Cdistinct_id>'\n    AND notEmpty(toString(properties.$ai_trace_id))\nGROUP BY trace_id\nORDER BY total_cost DESC\nLIMIT 10\n",[1427],{"type":54,"tag":73,"props":1428,"children":1429},{"__ignoreMap":427},[1430,1437,1444,1452,1459,1466,1473,1480,1487,1495,1503,1511,1518,1525,1532,1539,1547,1555,1562],{"type":54,"tag":433,"props":1431,"children":1432},{"class":435,"line":436},[1433],{"type":54,"tag":433,"props":1434,"children":1435},{},[1436],{"type":59,"value":442},{"type":54,"tag":433,"props":1438,"children":1439},{"class":435,"line":445},[1440],{"type":54,"tag":433,"props":1441,"children":1442},{},[1443],{"type":59,"value":451},{"type":54,"tag":433,"props":1445,"children":1446},{"class":435,"line":454},[1447],{"type":54,"tag":433,"props":1448,"children":1449},{},[1450],{"type":59,"value":1451},"    toString(properties.$ai_trace_id) AS trace_id,\n",{"type":54,"tag":433,"props":1453,"children":1454},{"class":435,"line":463},[1455],{"type":54,"tag":433,"props":1456,"children":1457},{},[1458],{"type":59,"value":496},{"type":54,"tag":433,"props":1460,"children":1461},{"class":435,"line":472},[1462],{"type":54,"tag":433,"props":1463,"children":1464},{},[1465],{"type":59,"value":1126},{"type":54,"tag":433,"props":1467,"children":1468},{"class":435,"line":481},[1469],{"type":54,"tag":433,"props":1470,"children":1471},{},[1472],{"type":59,"value":1134},{"type":54,"tag":433,"props":1474,"children":1475},{"class":435,"line":490},[1476],{"type":54,"tag":433,"props":1477,"children":1478},{},[1479],{"type":59,"value":1142},{"type":54,"tag":433,"props":1481,"children":1482},{"class":435,"line":499},[1483],{"type":54,"tag":433,"props":1484,"children":1485},{},[1486],{"type":59,"value":1150},{"type":54,"tag":433,"props":1488,"children":1489},{"class":435,"line":508},[1490],{"type":54,"tag":433,"props":1491,"children":1492},{},[1493],{"type":59,"value":1494},"    countIf(notEmpty(toString(properties.$ai_error)) OR toString(properties.$ai_is_error) = 'true') AS errors,\n",{"type":54,"tag":433,"props":1496,"children":1497},{"class":435,"line":517},[1498],{"type":54,"tag":433,"props":1499,"children":1500},{},[1501],{"type":59,"value":1502},"    min(timestamp) AS started_at,\n",{"type":54,"tag":433,"props":1504,"children":1505},{"class":435,"line":526},[1506],{"type":54,"tag":433,"props":1507,"children":1508},{},[1509],{"type":59,"value":1510},"    max(timestamp) AS ended_at\n",{"type":54,"tag":433,"props":1512,"children":1513},{"class":435,"line":535},[1514],{"type":54,"tag":433,"props":1515,"children":1516},{},[1517],{"type":59,"value":1222},{"type":54,"tag":433,"props":1519,"children":1520},{"class":435,"line":544},[1521],{"type":54,"tag":433,"props":1522,"children":1523},{},[1524],{"type":59,"value":1230},{"type":54,"tag":433,"props":1526,"children":1527},{"class":435,"line":553},[1528],{"type":54,"tag":433,"props":1529,"children":1530},{},[1531],{"type":59,"value":1238},{"type":54,"tag":433,"props":1533,"children":1534},{"class":435,"line":562},[1535],{"type":54,"tag":433,"props":1536,"children":1537},{},[1538],{"type":59,"value":1246},{"type":54,"tag":433,"props":1540,"children":1541},{"class":435,"line":571},[1542],{"type":54,"tag":433,"props":1543,"children":1544},{},[1545],{"type":59,"value":1546},"    AND notEmpty(toString(properties.$ai_trace_id))\n",{"type":54,"tag":433,"props":1548,"children":1549},{"class":435,"line":580},[1550],{"type":54,"tag":433,"props":1551,"children":1552},{},[1553],{"type":59,"value":1554},"GROUP BY trace_id\n",{"type":54,"tag":433,"props":1556,"children":1557},{"class":435,"line":589},[1558],{"type":54,"tag":433,"props":1559,"children":1560},{},[1561],{"type":59,"value":721},{"type":54,"tag":433,"props":1563,"children":1564},{"class":435,"line":598},[1565],{"type":54,"tag":433,"props":1566,"children":1567},{},[1568],{"type":59,"value":1569},"LIMIT 10\n",{"type":54,"tag":62,"props":1571,"children":1572},{},[1573],{"type":59,"value":1574},"Open at least the top 2-3 traces for the user:",{"type":54,"tag":422,"props":1576,"children":1580},{"className":1577,"code":1578,"language":1579,"meta":427,"style":427},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","posthog:query-llm-trace\n{\n  \"traceId\": \"\u003Ctrace_id>\",\n  \"dateRange\": { \"date_from\": \"-30d\" }\n}\n","json",[1581],{"type":54,"tag":73,"props":1582,"children":1583},{"__ignoreMap":427},[1584,1593,1602,1645,1706],{"type":54,"tag":433,"props":1585,"children":1586},{"class":435,"line":436},[1587],{"type":54,"tag":433,"props":1588,"children":1590},{"style":1589},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[1591],{"type":59,"value":1592},"posthog:query-llm-trace\n",{"type":54,"tag":433,"props":1594,"children":1595},{"class":435,"line":445},[1596],{"type":54,"tag":433,"props":1597,"children":1599},{"style":1598},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[1600],{"type":59,"value":1601},"{\n",{"type":54,"tag":433,"props":1603,"children":1604},{"class":435,"line":454},[1605,1610,1616,1621,1626,1631,1637,1641],{"type":54,"tag":433,"props":1606,"children":1607},{"style":1598},[1608],{"type":59,"value":1609},"  \"",{"type":54,"tag":433,"props":1611,"children":1613},{"style":1612},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[1614],{"type":59,"value":1615},"traceId",{"type":54,"tag":433,"props":1617,"children":1618},{"style":1598},[1619],{"type":59,"value":1620},"\"",{"type":54,"tag":433,"props":1622,"children":1623},{"style":1598},[1624],{"type":59,"value":1625},":",{"type":54,"tag":433,"props":1627,"children":1628},{"style":1598},[1629],{"type":59,"value":1630}," \"",{"type":54,"tag":433,"props":1632,"children":1634},{"style":1633},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[1635],{"type":59,"value":1636},"\u003Ctrace_id>",{"type":54,"tag":433,"props":1638,"children":1639},{"style":1598},[1640],{"type":59,"value":1620},{"type":54,"tag":433,"props":1642,"children":1643},{"style":1598},[1644],{"type":59,"value":272},{"type":54,"tag":433,"props":1646,"children":1647},{"class":435,"line":463},[1648,1652,1657,1661,1665,1670,1674,1680,1684,1688,1692,1697,1701],{"type":54,"tag":433,"props":1649,"children":1650},{"style":1598},[1651],{"type":59,"value":1609},{"type":54,"tag":433,"props":1653,"children":1654},{"style":1612},[1655],{"type":59,"value":1656},"dateRange",{"type":54,"tag":433,"props":1658,"children":1659},{"style":1598},[1660],{"type":59,"value":1620},{"type":54,"tag":433,"props":1662,"children":1663},{"style":1598},[1664],{"type":59,"value":1625},{"type":54,"tag":433,"props":1666,"children":1667},{"style":1598},[1668],{"type":59,"value":1669}," {",{"type":54,"tag":433,"props":1671,"children":1672},{"style":1598},[1673],{"type":59,"value":1630},{"type":54,"tag":433,"props":1675,"children":1677},{"style":1676},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1678],{"type":59,"value":1679},"date_from",{"type":54,"tag":433,"props":1681,"children":1682},{"style":1598},[1683],{"type":59,"value":1620},{"type":54,"tag":433,"props":1685,"children":1686},{"style":1598},[1687],{"type":59,"value":1625},{"type":54,"tag":433,"props":1689,"children":1690},{"style":1598},[1691],{"type":59,"value":1630},{"type":54,"tag":433,"props":1693,"children":1694},{"style":1633},[1695],{"type":59,"value":1696},"-30d",{"type":54,"tag":433,"props":1698,"children":1699},{"style":1598},[1700],{"type":59,"value":1620},{"type":54,"tag":433,"props":1702,"children":1703},{"style":1598},[1704],{"type":59,"value":1705}," }\n",{"type":54,"tag":433,"props":1707,"children":1708},{"class":435,"line":472},[1709],{"type":54,"tag":433,"props":1710,"children":1711},{"style":1598},[1712],{"type":59,"value":1713},"}\n",{"type":54,"tag":62,"props":1715,"children":1716},{},[1717],{"type":59,"value":1718},"Look for the first concrete pattern that explains the aggregate:",{"type":54,"tag":216,"props":1720,"children":1721},{},[1722,1727,1732,1737,1742,1747,1752,1757],{"type":54,"tag":220,"props":1723,"children":1724},{},[1725],{"type":59,"value":1726},"repeated tool calls or retry loops",{"type":54,"tag":220,"props":1728,"children":1729},{},[1730],{"type":59,"value":1731},"large context windows or repeated retrieved documents",{"type":54,"tag":220,"props":1733,"children":1734},{},[1735],{"type":59,"value":1736},"long multi-turn sessions",{"type":54,"tag":220,"props":1738,"children":1739},{},[1740],{"type":59,"value":1741},"expensive model selected for ordinary tasks",{"type":54,"tag":220,"props":1743,"children":1744},{},[1745],{"type":59,"value":1746},"many small calls from the same workflow",{"type":54,"tag":220,"props":1748,"children":1749},{},[1750],{"type":59,"value":1751},"verbose outputs or unconstrained reasoning",{"type":54,"tag":220,"props":1753,"children":1754},{},[1755],{"type":59,"value":1756},"web-search or request-fee-heavy calls",{"type":54,"tag":220,"props":1758,"children":1759},{},[1760],{"type":59,"value":1761},"errors that still incurred model cost",{"type":54,"tag":410,"props":1763,"children":1765},{"id":1764},"_6-check-custom-dimensions-when-the-aggregate-is-ambiguous",[1766],{"type":59,"value":1767},"6. Check custom dimensions when the aggregate is ambiguous",{"type":54,"tag":62,"props":1769,"children":1770},{},[1771,1773,1778,1780,1785,1786,1791,1792,1798,1799,1804,1805,1811,1812,1818,1820,1826],{"type":59,"value":1772},"If the top user appears expensive but the model\u002Ftoken breakdown does not explain\nwhy, discover custom event properties on ",{"type":54,"tag":73,"props":1774,"children":1776},{"className":1775},[],[1777],{"type":59,"value":246},{"type":59,"value":1779}," and group by the\nlikely product dimensions. Common examples are ",{"type":54,"tag":73,"props":1781,"children":1783},{"className":1782},[],[1784],{"type":59,"value":369},{"type":59,"value":264},{"type":54,"tag":73,"props":1787,"children":1789},{"className":1788},[],[1790],{"type":59,"value":376},{"type":59,"value":272},{"type":54,"tag":73,"props":1793,"children":1795},{"className":1794},[],[1796],{"type":59,"value":1797},"organization_id",{"type":59,"value":264},{"type":54,"tag":73,"props":1800,"children":1802},{"className":1801},[],[1803],{"type":59,"value":390},{"type":59,"value":264},{"type":54,"tag":73,"props":1806,"children":1808},{"className":1807},[],[1809],{"type":59,"value":1810},"agent",{"type":59,"value":264},{"type":54,"tag":73,"props":1813,"children":1815},{"className":1814},[],[1816],{"type":59,"value":1817},"route",{"type":59,"value":1819},", or ",{"type":54,"tag":73,"props":1821,"children":1823},{"className":1822},[],[1824],{"type":59,"value":1825},"environment",{"type":59,"value":1827},", but do\nnot guess.",{"type":54,"tag":1829,"props":1830,"children":1831},"ol",{},[1832,1859,1879],{"type":54,"tag":220,"props":1833,"children":1834},{},[1835,1837,1842,1844,1850,1852,1858],{"type":59,"value":1836},"Call ",{"type":54,"tag":73,"props":1838,"children":1840},{"className":1839},[],[1841],{"type":59,"value":186},{"type":59,"value":1843}," with ",{"type":54,"tag":73,"props":1845,"children":1847},{"className":1846},[],[1848],{"type":59,"value":1849},"kind: \"event_properties\"",{"type":59,"value":1851}," and\n",{"type":54,"tag":73,"props":1853,"children":1855},{"className":1854},[],[1856],{"type":59,"value":1857},"event_name: \"$ai_generation\"",{"type":59,"value":88},{"type":54,"tag":220,"props":1860,"children":1861},{},[1862,1864,1869,1871,1877],{"type":59,"value":1863},"For promising fields, call ",{"type":54,"tag":73,"props":1865,"children":1867},{"className":1866},[],[1868],{"type":59,"value":186},{"type":59,"value":1870}," with\n",{"type":54,"tag":73,"props":1872,"children":1874},{"className":1873},[],[1875],{"type":59,"value":1876},"kind: \"event_property_values\"",{"type":59,"value":1878}," to confirm actual values.",{"type":54,"tag":220,"props":1880,"children":1881},{},[1882],{"type":59,"value":1883},"Group the top user's cost by the discovered property.",{"type":54,"tag":422,"props":1885,"children":1887},{"className":424,"code":1886,"language":426,"meta":427,"style":427},"posthog:execute-sql\nSELECT\n    toString(properties.\u003Cproperty_name>) AS dimension,\n    count() AS generations,\n    countDistinctIf(toString(properties.$ai_trace_id), notEmpty(toString(properties.$ai_trace_id))) AS traces,\n    round(sum(toFloat(properties.$ai_total_cost_usd)), 4) AS total_cost,\n    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation\nFROM events\nWHERE event = '$ai_generation'\n    AND timestamp >= now() - INTERVAL 30 DAY\n    AND distinct_id = '\u003Cdistinct_id>'\n    AND isNotNull(properties.\u003Cproperty_name>)\nGROUP BY dimension\nORDER BY total_cost DESC\nLIMIT 20\n",[1888],{"type":54,"tag":73,"props":1889,"children":1890},{"__ignoreMap":427},[1891,1898,1905,1913,1920,1927,1934,1942,1949,1956,1963,1970,1978,1986,1993],{"type":54,"tag":433,"props":1892,"children":1893},{"class":435,"line":436},[1894],{"type":54,"tag":433,"props":1895,"children":1896},{},[1897],{"type":59,"value":442},{"type":54,"tag":433,"props":1899,"children":1900},{"class":435,"line":445},[1901],{"type":54,"tag":433,"props":1902,"children":1903},{},[1904],{"type":59,"value":451},{"type":54,"tag":433,"props":1906,"children":1907},{"class":435,"line":454},[1908],{"type":54,"tag":433,"props":1909,"children":1910},{},[1911],{"type":59,"value":1912},"    toString(properties.\u003Cproperty_name>) AS dimension,\n",{"type":54,"tag":433,"props":1914,"children":1915},{"class":435,"line":463},[1916],{"type":54,"tag":433,"props":1917,"children":1918},{},[1919],{"type":59,"value":496},{"type":54,"tag":433,"props":1921,"children":1922},{"class":435,"line":472},[1923],{"type":54,"tag":433,"props":1924,"children":1925},{},[1926],{"type":59,"value":1118},{"type":54,"tag":433,"props":1928,"children":1929},{"class":435,"line":481},[1930],{"type":54,"tag":433,"props":1931,"children":1932},{},[1933],{"type":59,"value":1126},{"type":54,"tag":433,"props":1935,"children":1936},{"class":435,"line":490},[1937],{"type":54,"tag":433,"props":1938,"children":1939},{},[1940],{"type":59,"value":1941},"    round(avg(toFloat(properties.$ai_total_cost_usd)), 6) AS avg_cost_per_generation\n",{"type":54,"tag":433,"props":1943,"children":1944},{"class":435,"line":499},[1945],{"type":54,"tag":433,"props":1946,"children":1947},{},[1948],{"type":59,"value":1222},{"type":54,"tag":433,"props":1950,"children":1951},{"class":435,"line":508},[1952],{"type":54,"tag":433,"props":1953,"children":1954},{},[1955],{"type":59,"value":1230},{"type":54,"tag":433,"props":1957,"children":1958},{"class":435,"line":517},[1959],{"type":54,"tag":433,"props":1960,"children":1961},{},[1962],{"type":59,"value":1238},{"type":54,"tag":433,"props":1964,"children":1965},{"class":435,"line":526},[1966],{"type":54,"tag":433,"props":1967,"children":1968},{},[1969],{"type":59,"value":1246},{"type":54,"tag":433,"props":1971,"children":1972},{"class":435,"line":535},[1973],{"type":54,"tag":433,"props":1974,"children":1975},{},[1976],{"type":59,"value":1977},"    AND isNotNull(properties.\u003Cproperty_name>)\n",{"type":54,"tag":433,"props":1979,"children":1980},{"class":435,"line":544},[1981],{"type":54,"tag":433,"props":1982,"children":1983},{},[1984],{"type":59,"value":1985},"GROUP BY dimension\n",{"type":54,"tag":433,"props":1987,"children":1988},{"class":435,"line":553},[1989],{"type":54,"tag":433,"props":1990,"children":1991},{},[1992],{"type":59,"value":721},{"type":54,"tag":433,"props":1994,"children":1995},{"class":435,"line":562},[1996],{"type":54,"tag":433,"props":1997,"children":1998},{},[1999],{"type":59,"value":2000},"LIMIT 20\n",{"type":54,"tag":62,"props":2002,"children":2003},{},[2004],{"type":59,"value":2005},"This is often the difference between \"user 123 is expensive\" and \"their\ncontract-review workflow is expensive because every run feeds a 90k-token\ndocument to the most costly model.\"",{"type":54,"tag":90,"props":2007,"children":2009},{"id":2008},"constructing-ui-links",[2010],{"type":59,"value":2011},"Constructing UI links",{"type":54,"tag":62,"props":2013,"children":2014},{},[2015,2017,2022],{"type":59,"value":2016},"Use ",{"type":54,"tag":73,"props":2018,"children":2020},{"className":2019},[],[2021],{"type":59,"value":203},{"type":59,"value":2023}," for links. Do not hardcode the host because the\nproject may be in a different region.",{"type":54,"tag":216,"props":2025,"children":2026},{},[2027,2038],{"type":54,"tag":220,"props":2028,"children":2029},{},[2030,2032],{"type":59,"value":2031},"Traces list: ",{"type":54,"tag":73,"props":2033,"children":2035},{"className":2034},[],[2036],{"type":59,"value":2037},"generate-app-url { \"url\": \"\u002Fai-observability\u002Ftraces\" }",{"type":54,"tag":220,"props":2039,"children":2040},{},[2041,2043],{"type":59,"value":2042},"Single trace: ",{"type":54,"tag":73,"props":2044,"children":2046},{"className":2045},[],[2047],{"type":59,"value":2048},"generate-app-url { \"url\": \"\u002Fai-observability\u002Ftraces\u002F{id}\", \"params\": { \"id\": \"\u003Ctrace_id>\" } }",{"type":54,"tag":62,"props":2050,"children":2051},{},[2052,2054,2060],{"type":59,"value":2053},"For a single trace, append ",{"type":54,"tag":73,"props":2055,"children":2057},{"className":2056},[],[2058],{"type":59,"value":2059},"?timestamp=\u003Curl_encoded_started_at>",{"type":59,"value":2061}," when you have\nthe trace timestamp so the UI opens the right time window.",{"type":54,"tag":90,"props":2063,"children":2065},{"id":2064},"response-shape",[2066],{"type":59,"value":2067},"Response shape",{"type":54,"tag":62,"props":2069,"children":2070},{},[2071],{"type":59,"value":2072},"Lead with the answer, not the queries. A good response has:",{"type":54,"tag":1829,"props":2074,"children":2075},{},[2076,2100,2110,2120,2130],{"type":54,"tag":220,"props":2077,"children":2078},{},[2079,2084,2086,2091,2093,2098],{"type":54,"tag":224,"props":2080,"children":2081},{},[2082],{"type":59,"value":2083},"Top users",{"type":59,"value":2085}," - ranked by total cost, with total cost, share of spend,\ngenerations, traces, average cost per generation, and error rate. Identify\neach user by a label only (email, name, or ",{"type":54,"tag":73,"props":2087,"children":2089},{"className":2088},[],[2090],{"type":59,"value":254},{"type":59,"value":2092},"). Do not print raw\n",{"type":54,"tag":73,"props":2094,"children":2096},{"className":2095},[],[2097],{"type":59,"value":808},{"type":59,"value":2099}," objects or other personal fields the user did not ask for.",{"type":54,"tag":220,"props":2101,"children":2102},{},[2103,2108],{"type":54,"tag":224,"props":2104,"children":2105},{},[2106],{"type":59,"value":2107},"Why they are expensive",{"type":59,"value":2109}," - one or two concrete drivers per user, compared\nagainst the baseline.",{"type":54,"tag":220,"props":2111,"children":2112},{},[2113,2118],{"type":54,"tag":224,"props":2114,"children":2115},{},[2116],{"type":59,"value":2117},"Evidence",{"type":59,"value":2119}," - model\u002Ftoken\u002Fcache\u002Fcustom-dimension breakdowns plus linked\nexample traces you read.",{"type":54,"tag":220,"props":2121,"children":2122},{},[2123,2128],{"type":54,"tag":224,"props":2124,"children":2125},{},[2126],{"type":59,"value":2127},"Likely levers",{"type":59,"value":2129}," - specific optimization ideas tied to the observed driver:\nreduce context, cap output, use a cheaper model for a workflow, improve\ncaching, fix retry loops, or split a feature's traffic.",{"type":54,"tag":220,"props":2131,"children":2132},{},[2133,2138],{"type":54,"tag":224,"props":2134,"children":2135},{},[2136],{"type":59,"value":2137},"Caveats",{"type":59,"value":2139}," - whether the result includes embeddings, excludes trace-id\ndefaults, or uses a different event set than the initial ranking.",{"type":54,"tag":62,"props":2141,"children":2142},{},[2143],{"type":59,"value":2144},"Avoid generic advice. \"Use cheaper models\" is not useful unless the data shows\nthat model mix is the driver. \"Reduce prompt size\" is not useful unless input\ntokens are high relative to the baseline.",{"type":54,"tag":2146,"props":2147,"children":2148},"style",{},[2149],{"type":59,"value":2150},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2152,"total":2311},[2153,2160,2172,2184,2197,2212,2228,2245,2259,2274,2284,2301],{"slug":4,"name":4,"fn":5,"description":6,"org":2154,"tags":2155,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2156,2157,2158,2159],{"name":21,"slug":22,"type":15},{"name":18,"slug":19,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":2161,"name":2161,"fn":2162,"description":2163,"org":2164,"tags":2165,"stars":23,"repoUrl":24,"updatedAt":2171},"auditing-endpoints","audit PostHog project endpoints","Audit every endpoint in a PostHog project for staleness, failed materialisations, and unused materialised versions. Use when the user asks \"what endpoints can I clean up?\", \"are any of my endpoints broken?\", \"which materialised versions are still being called?\", or wants a one-shot cleanup pass over the Endpoints product. Produces a prioritised report grouped by issue type, with recommended actions but does not modify anything without explicit confirmation.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2166,2167,2170],{"name":21,"slug":22,"type":15},{"name":2168,"slug":2169,"type":15},"Audit","audit",{"name":9,"slug":8,"type":15},"2026-06-08T08:08:33.693989",{"slug":2173,"name":2173,"fn":2174,"description":2175,"org":2176,"tags":2177,"stars":23,"repoUrl":24,"updatedAt":2183},"auditing-warehouse-source-health","audit PostHog data warehouse source health","Audit the health of a PostHog project's data warehouse sources and syncs — find every broken or degraded source connection, sync schema, and webhook channel. Use when the user asks \"why are my imports failing?\", \"what's broken with my sources?\", \"why is my warehouse data stale?\", or wants a one-shot triage of source\u002Fsync health before deciding where to dig in. Produces a prioritized report grouped by severity, with recommended next steps. For materialized-view health use `auditing-warehouse-view-health`; for a single failing sync use `diagnosing-failed-warehouse-syncs`.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2178,2179,2181,2182],{"name":2168,"slug":2169,"type":15},{"name":2180,"slug":32,"type":15},"Data Warehouse",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-06-18T08:22:57.67984",{"slug":2185,"name":2185,"fn":2186,"description":2187,"org":2188,"tags":2189,"stars":23,"repoUrl":24,"updatedAt":2196},"auditing-warehouse-view-health","audit PostHog materialized view health","Audit the health of a PostHog project's materialized views (saved queries) — find every failed materialization and flag unused or stale materialized views that cost storage and compute. Use when the user asks \"which of my views are broken?\", \"why is this materialized view failing?\", \"are any of my views wasting compute?\", or wants a one-shot triage of view health. For source\u002Fsync health use `auditing-warehouse-source-health`.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2190,2191,2192,2195],{"name":2168,"slug":2169,"type":15},{"name":2180,"slug":32,"type":15},{"name":2193,"slug":2194,"type":15},"Performance","performance",{"name":9,"slug":8,"type":15},"2026-06-18T08:25:10.936787",{"slug":2198,"name":2198,"fn":2199,"description":2200,"org":2201,"tags":2202,"stars":23,"repoUrl":24,"updatedAt":2211},"authoring-error-tracking-alerts","author PostHog error tracking alerts","Author error tracking alerts that fire when an issue is created, reopened, or starts spiking. Use when the user asks to set up error notifications, route exceptions to Slack\u002Fwebhook\u002FLinear, or evaluate which error events are worth alerting on. Covers trigger-event selection, integration choice, dedup against existing alerts, and shipping with the canonical message body shape.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2203,2206,2209,2210],{"name":2204,"slug":2205,"type":15},"Alerting","alerting",{"name":2207,"slug":2208,"type":15},"Debugging","debugging",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-06-18T08:24:40.318583",{"slug":2213,"name":2213,"fn":2214,"description":2215,"org":2216,"tags":2217,"stars":23,"repoUrl":24,"updatedAt":2227},"authoring-log-alerts","author log alerts in PostHog","Author useful, low-noise log alerts on services in a PostHog project. Use when the user asks to set up alerts for their logs, suggest alerts they should add, or evaluate whether a service is worth monitoring. Covers service triage, baseline characterisation, threshold drafting, back-testing via simulate, and shipping with a notification destination.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2218,2219,2222,2223,2226],{"name":21,"slug":22,"type":15},{"name":2220,"slug":2221,"type":15},"Monitoring","monitoring",{"name":13,"slug":14,"type":15},{"name":2224,"slug":2225,"type":15},"Operations","operations",{"name":9,"slug":8,"type":15},"2026-07-18T05:10:54.430898",{"slug":2229,"name":2229,"fn":2230,"description":2231,"org":2232,"tags":2233,"stars":23,"repoUrl":24,"updatedAt":2244},"building-workflows","build and edit PostHog workflows","Build, edit, test, enable, and monitor PostHog workflows over MCP. Author the action\u002Fedge graph so it runs and opens cleanly in the visual editor, then change drafts surgically with patch operations. Use when asked to build, set up, automate, change, fix, or debug a workflow, campaign, broadcast, drip sequence, or event-triggered automation in the workflows product.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2234,2237,2240,2241],{"name":2235,"slug":2236,"type":15},"Automation","automation",{"name":2238,"slug":2239,"type":15},"MCP","mcp",{"name":9,"slug":8,"type":15},{"name":2242,"slug":2243,"type":15},"Workflow Automation","workflow-automation","2026-07-28T05:34:12.167015",{"slug":2246,"name":2246,"fn":2247,"description":2248,"org":2249,"tags":2250,"stars":23,"repoUrl":24,"updatedAt":2258},"check-posthog-loading","inspect PostHog SDK loading across URLs","Inspect how the PostHog JavaScript SDK is loaded across a list of URLs. Use to confirm consistent installation across pages, find pages missing the snippet, detect mismatched API keys or hosts between pages, and verify the load method (head snippet vs deferred vs array.js).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2251,2252,2253,2256,2257],{"name":21,"slug":22,"type":15},{"name":2207,"slug":2208,"type":15},{"name":2254,"slug":2255,"type":15},"Frontend","frontend",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-05-07T05:56:19.828048",{"slug":2260,"name":2260,"fn":2261,"description":2262,"org":2263,"tags":2264,"stars":23,"repoUrl":24,"updatedAt":2273},"consuming-endpoints-from-client-code","integrate PostHog endpoints into client applications","Wire a PostHog endpoint into a client app or SDK. Covers fetching the OpenAPI spec, generating a typed client with openapi-generator or @hey-api\u002Fopenapi-ts, sending the right auth header, shaping the variables payload (HogQL code_name vs insight breakdown property), handling rate-limit and materialised-endpoint error responses. Use when the user says \"how do I call my endpoint\", \"generate a client for this\", or \"what auth header do I use\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2265,2268,2269,2270],{"name":2266,"slug":2267,"type":15},"API Development","api-development",{"name":2254,"slug":2255,"type":15},{"name":9,"slug":8,"type":15},{"name":2271,"slug":2272,"type":15},"SDK","sdk","2026-06-08T08:08:34.929454",{"slug":2275,"name":2275,"fn":2276,"description":2277,"org":2278,"tags":2279,"stars":23,"repoUrl":24,"updatedAt":2283},"copying-endpoints-across-projects","copy PostHog endpoints across projects","Copy a PostHog endpoint (a saved HogQL\u002Finsight query exposed as an API route) to another project in the same organization, or duplicate it under a new name in the same project. Use when the user wants to duplicate an endpoint, promote an endpoint from staging to production, replicate an endpoint's query\u002Fvariables\u002Ffreshness config in another workspace, or clone an endpoint to iterate on it. Unlike feature flags and experiments, endpoints have NO native cross-project copy tool — this skill covers the read-then-recreate flow (endpoint-get then endpoint-create), the active-project switching it requires, name-collision checks, and the safe defaults (land unmaterialised in the target, verify with endpoint-run). Does not cover editing endpoint versions (see managing-endpoint-versions) or authoring a brand-new endpoint from scratch (see creating-an-endpoint).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2280,2281,2282],{"name":2266,"slug":2267,"type":15},{"name":2224,"slug":2225,"type":15},{"name":9,"slug":8,"type":15},"2026-07-15T05:29:58.442727",{"slug":2285,"name":2285,"fn":2286,"description":2287,"org":2288,"tags":2289,"stars":23,"repoUrl":24,"updatedAt":2300},"creating-ai-subscription","schedule recurring AI-generated PostHog reports","Create a recurring AI-generated PostHog report — schedule a free-text prompt to run on a cron, with the LLM-synthesized markdown delivered to email or Slack on each tick. Use when the user wants a recurring AI summary of X on any cadence (daily, weekly, monthly, yearly) rather than a one-off report. (To attach an AI summary to an existing insight\u002Fdashboard subscription instead of a free-text prompt, see `managing-subscriptions` and its `summary_enabled` option.)\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2290,2291,2293,2294,2297],{"name":2235,"slug":2236,"type":15},{"name":2292,"slug":792,"type":15},"Email",{"name":9,"slug":8,"type":15},{"name":2295,"slug":2296,"type":15},"Reporting","reporting",{"name":2298,"slug":2299,"type":15},"Slack","slack","2026-06-09T07:32:27.935712",{"slug":2302,"name":2302,"fn":2303,"description":2304,"org":2305,"tags":2306,"stars":23,"repoUrl":24,"updatedAt":2310},"creating-an-endpoint","create PostHog API endpoints","Create a PostHog endpoint with the right shape on the first try — covers query kind choice, name conventions, what to expose as variables (HogQL code_name vs insight breakdown), data_freshness_seconds, and whether to materialise on day one. Use when the user says \"create an endpoint\", \"expose this query as an API\", \"turn this insight into an endpoint\", or asks for help structuring a new endpoint. Steers away from common mistakes: materialising a query with cohort breakdowns or compare mode, inline-only variables on a materialised endpoint, unbounded date ranges, ambiguous names.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2307,2308,2309],{"name":21,"slug":22,"type":15},{"name":2266,"slug":2267,"type":15},{"name":9,"slug":8,"type":15},"2026-06-08T08:08:29.624498",231,{"items":2313,"total":2363},[2314,2321,2327,2334,2341,2348,2356],{"slug":4,"name":4,"fn":5,"description":6,"org":2315,"tags":2316,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2317,2318,2319,2320],{"name":21,"slug":22,"type":15},{"name":18,"slug":19,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":2161,"name":2161,"fn":2162,"description":2163,"org":2322,"tags":2323,"stars":23,"repoUrl":24,"updatedAt":2171},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2324,2325,2326],{"name":21,"slug":22,"type":15},{"name":2168,"slug":2169,"type":15},{"name":9,"slug":8,"type":15},{"slug":2173,"name":2173,"fn":2174,"description":2175,"org":2328,"tags":2329,"stars":23,"repoUrl":24,"updatedAt":2183},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2330,2331,2332,2333],{"name":2168,"slug":2169,"type":15},{"name":2180,"slug":32,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":2185,"name":2185,"fn":2186,"description":2187,"org":2335,"tags":2336,"stars":23,"repoUrl":24,"updatedAt":2196},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2337,2338,2339,2340],{"name":2168,"slug":2169,"type":15},{"name":2180,"slug":32,"type":15},{"name":2193,"slug":2194,"type":15},{"name":9,"slug":8,"type":15},{"slug":2198,"name":2198,"fn":2199,"description":2200,"org":2342,"tags":2343,"stars":23,"repoUrl":24,"updatedAt":2211},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2344,2345,2346,2347],{"name":2204,"slug":2205,"type":15},{"name":2207,"slug":2208,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":2213,"name":2213,"fn":2214,"description":2215,"org":2349,"tags":2350,"stars":23,"repoUrl":24,"updatedAt":2227},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2351,2352,2353,2354,2355],{"name":21,"slug":22,"type":15},{"name":2220,"slug":2221,"type":15},{"name":13,"slug":14,"type":15},{"name":2224,"slug":2225,"type":15},{"name":9,"slug":8,"type":15},{"slug":2229,"name":2229,"fn":2230,"description":2231,"org":2357,"tags":2358,"stars":23,"repoUrl":24,"updatedAt":2244},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2359,2360,2361,2362],{"name":2235,"slug":2236,"type":15},{"name":2238,"slug":2239,"type":15},{"name":9,"slug":8,"type":15},{"name":2242,"slug":2243,"type":15},61]