Skip to main content

Komprez

Fewer LLM input tokens, same answers. Komprez compresses tool outputs, logs, JSON and chat history before each LLM call. It runs inside your process, so your prompts and data never leave your machine.

Typical savings: 21-57% on agent workloads, 90%+ on repeated JSON arrays and log lines, little on plain prose.

Install

pip install komprez            # core library
pip install "komprez[all]"     # plus proxy, code-aware compression, MCP server, reports

Get an API key

Komprez needs an API key (kz_live_...). Give it to Komprez in any of these ways:

from komprez import Komprez
kz = Komprez(api_key="kz_live_...")
export KOMPREZ_API_KEY=kz_live_...     # Windows PowerShell: $env:KOMPREZ_API_KEY="kz_live_..."
komprez login                          # saves the key for your user account

The key is checked once and then re-checked every few hours. If the license server cannot be reached, a recently checked key keeps working for up to 72 hours.

Use it

from komprez import Komprez

kz = Komprez(api_key="kz_live_...")

result = kz.optimize(messages, model="gpt-4o")   # OpenAI or Anthropic message dicts

response = openai_client.chat.completions.create(model="gpt-4o", messages=result.messages)

print(result.tokens_before, "->", result.tokens_after, f"({result.tokens_saved} saved)")

Short form, using KOMPREZ_API_KEY or komprez login:

import komprez

result = komprez.optimize(messages, model="gpt-4o")

Errors

from komprez import Komprez, InvalidAPIKeyError, LicenseServerUnavailableError

try:
    kz = Komprez(api_key=key)
except InvalidAPIKeyError:
    ...  # missing, unknown, revoked or expired key
except LicenseServerUnavailableError:
    ...  # first check could not reach the license server

Command line

komprez login        # validate and save your API key
komprez whoami       # show the active key and plan
komprez logout       # remove the saved key
komprez proxy        # run the optimization proxy (needs komprez[proxy])
komprez wrap claude  # run a coding agent through Komprez

Privacy

Compression happens locally. Komprez sends only your API key (to check it) and aggregate counts (number of calls, tokens before and after) to the license server. It never sends message content, prompts or tool results.

KOMPREZ_OFFLINE=1 makes Komprez make no network calls at all. It then needs a key that was already checked online within the last 72 hours.

License

Komprez is commercial software. Using it requires an active paid subscription and a valid API key; see LICENSE for the full terms. Third-party notices for the open source components it includes are in NOTICE.

Metadata

Release files for komprez 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for komprez 0.1.0
File Actions
komprez-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for komprez-0.1.0-cp310-abi3-win_amd64.whl
komprez-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for komprez-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
komprez-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for komprez-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
komprez-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for komprez-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 63.1 MB

Release files / komprez-0.1.0-cp310-abi3-win_amd64.whl

Download URL komprez-0.1.0-cp310-abi3-win_amd64.whl
Size 15.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
050c2b9932fce41a4e4f262e984e3ca7dbe69e6165f66dcf624ddfe9444b2570
BLAKE2b-256 checksum
How to use checksums
62a4b435d2ca55ce25c7f86351247c1fc336c216a5a307c8d2f5b4b9340b2a98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / komprez-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL komprez-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 15.9 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
905effa730a04585b6e0d3cdd9e97192cd347630f5c092d0d51572b0ee6404fd
BLAKE2b-256 checksum
How to use checksums
2a2c29d25b76b2ecafb33742d7ac12fb5b014575b53708b38b0941a396f55039
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / komprez-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL komprez-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 15.7 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
98db424d9b66e854a9d802bd2c6e56744ead11d1d590b67d2b37da0a4bcd7855
BLAKE2b-256 checksum
How to use checksums
691f70dddf86fd02da6919979608882c19299481dfcc37e0988290be3a7aea66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / komprez-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL komprez-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 15.7 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5ce2df1b651fd0ec3c2c2d94ba33dabc18f5feff6ed8981fdc141269de0e4eac
BLAKE2b-256 checksum
How to use checksums
7185cc0d3d5f329a66e4e886fe75dbc8d95ca6f2fccc3ea5821abf03a0f5c6ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for komprez 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for komprez-0.1.0-cp310-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

4 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page