provider AI observabilityllm_analytics POST /api/projects/{project_id}/llm_analytics/summarization/
@utdk/posthog /api/projects/{project_id}/llm_analytics/summarization/
llm_analytics_summarization_create
Generate an AI-powered summary of an LLM trace or event. This endpoint analyzes the provided trace/event, generates a line-numbered text representation, and uses an LLM to create a concise summary with line references. **Two ways to use this endpoint:** 1. **By ID (recommended):** Pass `trace_id` or `generation_id` with an optional `date_from`/`date_to`. The backend fetches the data automatically. `summarize_type` is inferred. 2. **By data:** Pass the full trace/event data blob in `data` with `summarize_type`. This is how the frontend uses it. **Summary Format:** - Title (concise, max 10 words) - Mermaid flow diagram showing the main flow - 3-10 summary bullets with line references - "Interesting Notes" section for failures, successes, or unusual patterns - Line references in [L45] or [L45-52] format pointing to relevant sections The response includes the structured summary, the text representation, and metadata.
project_id path required
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
string

Try it

Authentication
Configure credentials for PostHog API
llmAnalyticsSummarizationCreate
POST/api/projects/{project_id}/llm_analytics/summarization/
Generate an AI-powered summary of an LLM trace or event. This endpoint analyzes the provided trace/event, generates a line-numbered text representation, and uses an LLM to create a concise summary with line references. **Two ways to use this endpoint:** 1. **By ID (recommended):** Pass `trace_id` or `generation_id` with an optional `date_from`/`date_to`. The backend fetches the data automatically. `summarize_type` is inferred. 2. **By data:** Pass the full trace/event data blob in `data` with `summarize_type`. This is how the frontend uses it. **Summary Format:** - Title (concise, max 10 words) - Mermaid flow diagram showing the main flow - 3-10 summary bullets with line references - "Interesting Notes" section for failures, successes, or unusual patterns - Line references in [L45] or [L45-52] format pointing to relevant sections The response includes the structured summary, the text representation, and metadata.

Parameters

required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Input

Type of entity to summarize. Inferred automatically when using trace_id or generation_id. * `trace` - trace * `event` - event

Summary detail level: 'minimal' for 3-5 points, 'detailed' for 5-10 points * `minimal` - minimal * `detailed` - detailed

Data to summarize. For traces: {trace, hierarchy}. For events: {event}. Not required when using trace_id or generation_id.

Force regenerate summary, bypassing cache

LLM model to use (defaults based on provider)

Trace ID to summarize. The backend fetches the trace data automatically. Requires date_from for efficient lookup.

Generation event UUID to summarize. The backend fetches the event data automatically. Requires date_from for efficient lookup.

Start of date range for ID-based lookup (e.g. '-7d' or '2026-01-01'). Defaults to -30d.

End of date range for ID-based lookup. Defaults to now.

Configure credentials above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import posthog from '@utdk/posthog';

await posthog.llmAnalyticsSummarizationCreate({
  "mode": "minimal",
  "force_refresh": false
})