Deployment guide

AWS Lambda deployment

AWS Lambda is the most popular serverless compute platform. SuperCompress's tiny footprint and CPU-only operation make it ideal for Lambda deployment.

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

Lambda deployment guide

# Create a Lambda deployment package
pip install supercompress -t package/
cp lambda_function.py package/
cd package && zip -r ../deploy.zip .

Lambda function code

from supercompress import Compressor
comp = Compressor()

def lambda_handler(event, context):
    body = json.loads(event["body"])
    result = comp.compress(body["context"], body["query"])
    return {
        "statusCode": 200,
        "body": json.dumps({
            "compressed_text": result.compressed_text,
            "original_tokens": result.original_tokens,
            "kept_tokens": result.kept_tokens
        })
    }

Frequently asked questions

What Lambda configuration works best?

512MB memory, Python 3.11 runtime. Expect ~300ms cold start + ~60ms compression.

Can I use Lambda with API Gateway?

Yes. Deploy behind API Gateway for a RESTful compression endpoint.

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