llma-cc-ingest
Manually send a Claude Code session log to PostHog LLM Analytics
Set up PostHog LLM Analytics to capture Claude Code sessions
> /plugin marketplace add PostHog/ai-plugin > /plugin install posthog@posthog
How it fires
How this command gets triggered: by you, by Claude, or both.
/llma-cc-setupContext preview
What this command does when you run it.
Set up PostHog LLM Analytics to capture Claude Code sessions
name: posthog:llma-cc-setup description: Set up PostHog LLM Analytics to capture Claude Code sessions argument-hint: [api-key] allowed-tools: Bash(echo:*),Bash(cat:*),Bash(mkdir:*)
Help the user configure PostHog LLM Analytics for Claude Code session capture.
When enabled, every Claude Code session is automatically sent to PostHog's LLM Analytics as `$ai_generation`, `$ai_span`, and `$ai_trace` events — giving visibility into model usage, token consumption, tool calls, and costs.
Both `POSTHOG_LLMA_CC_ENABLED=true` and `POSTHOG_API_KEY` are required. Set them via environment variables — either in your shell profile or in Claude Code's settings.json `env` block.
1. Check if the env vars are already set 2. If the user provided an API key as an argument (`$ARGUMENTS`), guide them to set it 3. Help them choose US or EU hosting 4. Offer them a choice of how to configure
For global setup, add to `~/.claude/settings.json`:
{
"env": {
"POSTHOG_LLMA_CC_ENABLED": "true",
"POSTHOG_API_KEY": "phc_...",
"POSTHOG_HOST": "https://eu.i.posthog.com"
}
}For per-project setup, add to `.claude/settings.local.json`:
{
"env": {
"POSTHOG_LLMA_CC_ENABLED": "true",
"POSTHOG_API_KEY": "phc_...",
"POSTHOG_HOST": "https://eu.i.posthog.com"
}
}To tag all events with custom properties (e.g. for filtering in PostHog):
{
"env": {
"POSTHOG_LLMA_CC_ENABLED": "true",
"POSTHOG_API_KEY": "phc_...",
"POSTHOG_LLMA_CUSTOM_PROPERTIES": "{\"ai_product\": \"my-app\", \"team\": \"platform\"}"
}
}export POSTHOG_LLMA_CC_ENABLED=true
export POSTHOG_API_KEY="phc_..."
export POSTHOG_HOST="https://eu.i.posthog.com" # for EU, omit for US
export POSTHOG_LLMA_CUSTOM_PROPERTIES='{"ai_product": "my-app"}' # optionalecho "POSTHOG_LLMA_CC_ENABLED=${POSTHOG_LLMA_CC_ENABLED:-(not set, defaults to false)}"
echo "POSTHOG_API_KEY=${POSTHOG_API_KEY:-(not set)}"
echo "POSTHOG_HOST=${POSTHOG_HOST:-(not set, defaults to US)}"
echo "POSTHOG_LLMA_PRIVACY_MODE=${POSTHOG_LLMA_PRIVACY_MODE:-(not set, defaults to false)}"
echo "POSTHOG_LLMA_CUSTOM_PROPERTIES=${POSTHOG_LLMA_CUSTOM_PROPERTIES:-(not set)}"Official PostHog plugin for AI clients. Access PostHog products directly from your AI coding tool.
Repo: PostHog/ai-plugin
Manually send a Claude Code session log to PostHog LLM Analytics
Check if Claude Code sessions are being sent to PostHog LLM Analytics