provider AI observabilityllm_analytics GET
/api/llm_analytics/@me/spend/ @utdk/posthog
/api/llm_analytics/@me/spend/ llm_analytics_personal_spend_list
Return a structured personal LLM spend analysis for the requesting user. Pass `date_from` / `date_to` (absolute like `2026-04-23` or relative like `-7d`) to bound the window — defaults to the last 30 days, max 90 days. The `product=<ai_product>` query param is required and scopes the tool / model / day / trace breakdowns to a single product; supported values: posthog_code. `by_product` is always returned for cross-product visibility. `by_day` returns a day-ascending spend series for the scoped product. Use `refresh=true` to bypass the 5-minute response cache.
- date_from query
- Start of the spend window. Accepts absolute dates (`2026-04-23`) or relative strings (`-7d`, `-1m`, etc.) — same parser used elsewhere in PostHog. Defaults to `-30d`. The window between `date_from` and `date_to` cannot exceed 90 days.
- string
- date_to query
- End of the spend window. Accepts the same formats as `date_from`. Defaults to `now` when omitted.
- stringnull
- limit query
- Maximum number of rows to return per breakdown (1-200, defaults to 50). Each breakdown returns up to this many rows ordered by cost descending. Per-breakdown `truncated: true` indicates more rows exist beyond the limit.
- integer
- product query required
- Required `ai_product` key to scope the tool / model / trace breakdowns to a single product. Only the following products are currently supported: posthog_code.
- string
- refresh query
- If true, bypass the result cache and re-run the underlying queries against ClickHouse.
- boolean
Try it
Authentication
Configure credentials for PostHog API
Code snippet
Updates live as you fill in the form above.
TypeScript
import posthog from '@utdk/posthog';
await posthog.llmAnalyticsPersonalSpendList({
"date_from": "-30d",
"limit": 50,
"refresh": false
})