Observability

PostHog analytics

PostHog is an open-source product analytics platform. Track compression metrics as events to understand usage patterns and cost savings.

By Arjun Shah - Creator of SuperCompress - Updated 2026-07-03

PostHog integration

from posthog import PostHog
from supercompress import Compressor

ph = PostHog(api_key="...")
comp = Compressor()

def compress_and_track(context, query, user_id):
    result = comp.compress(context, query)
    ph.capture(user_id, "prompt_compressed", {
        "original_tokens": result.original_tokens,
        "kept_tokens": result.kept_tokens,
        "savings_pct": round(
            (1 - result.kept_tokens / max(result.original_tokens, 1)) * 100, 1
        )
    })
    return result

Frequently asked questions

Can I build a dashboard for compression savings?

Yes. PostHog's insight builder can aggregate token savings by user, day, or use case.

Does PostHog handle high-volume events?

Yes. PostHog is designed for high-volume event ingestion.

Build with less context

Put compression in front of your next LLM call.

Use the hosted API or run SuperCompress locally. Keep the evidence, drop the token waste, and measure the savings before it reaches your model.

Get an API keyRead the guide