Skip to main content
You can enable analytics to trace interactions and performance. The helper option below turns on collection and configures PostHog.
func ConfigureAnalytics(did, tid string) ai.Option

Environment variables

POSTHOG_KEY=phc_...
POSTHOG_ENDPOINT=https://app.posthog.com

Enabling in your client

kai := ai.NewKarmaAI(
	ai.GPT4o,         // pick a model
  ai.OpenAI,        // pick a provider
  ai.ConfigureAnalytics("user-123", "trace-abc"),
)
With analytics on, Karma AI will capture user prompts, tool calls (if MCP/tools enabled), and AI responses under your identifiers.