Enterprise guide

Multi-tenant compression

SaaS platforms serving multiple customers need to compress prompts without mixing tenant data. Here is a multi-tenant compression architecture.

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

Tenant isolation

from supercompress import Compressor

# One compressor instance per tenant
tenant_compressors: dict[str, Compressor] = {}

def get_compressor(tenant_id: str) -> Compressor:
    if tenant_id not in tenant_compressors:
        tenant_compressors[tenant_id] = Compressor()
    return tenant_compressors[tenant_id]

def compress_tenant(tenant_id: str, context: str, query: str):
    comp = get_compressor(tenant_id)
    return comp.compress(context, query)

Frequently asked questions

Does each tenant need a separate Compressor instance?

No. The compressor is stateless and thread-safe. Separate instances are for logical isolation.

How do I bill tenants for compression?

Log compression metrics per tenant and include them in usage-based billing.

Try it yourself

Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.

Open the Playground Embed the badge