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. Pass bucket_minutes (5, 15, 30, or 60; the window may span at most 600 buckets) to additionally get by_bucket, a time-ascending series with per-bucket cost split into uncached input / output / cache read / cache creation components. Use refresh=true to bypass the 5-minute response cache.
Request
- Base URL: https://us.posthog.com
- URL: https://us.posthog.com/api/llm_analytics/@me/spend/
- Auth: HTTP bearer
Query parameters
When set, additionally return a by_bucket breakdown: a time-ascending UTC cost series for the scoped product at this bucket size in minutes, with per-bucket cost split into uncached input / output / cache read / cache creation components plus the matching token sums. Supported bucket sizes: 5, 15, 30, 60. The window may span at most 600 buckets of the chosen size (e.g. 50 hours at 5-minute buckets).
- 5 - 5
- 15 - 15
- 30 - 30
- 60 - 60
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.
End of the spend window. Accepts the same formats as date_from. Defaults to now when omitted.
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.
Required ai_product key to scope the tool / model / trace breakdowns to a single product. Only the following products are currently supported: posthog_code.
If true, bypass the result cache and re-run the underlying queries against ClickHouse.
Response
Changes
No recorded changes to this operation across all 1 revision of this API.