Skip to main content

Distilla — cut your LLM token bill 20–40%

Distilla compresses your prompts into dense language: fewer tokens, same or better output. The cost of tokens is the new cloud bill. Distilla measures it and cuts it — honestly, with verifiable before/after numbers. Works with any model: OpenAI, Anthropic (Claude), Kimi, Gemini, Llama, local models — anything you send text to.

If you pay for AI, you're overpaying for filler tokens. Distilla removes them.

Install

pip install distilla          # core
pip install distilla[accurate] # optional: exact token counts via tiktoken

Use (2 lines)

from distilla import compress, savings

prompt = "Please, I would like you to act as a very helpful assistant and kindly help me write a well-structured professional email."
dense = compress(prompt)

print(dense)             # "role: assistant help me write professional email."
print(savings(prompt, dense))
# {'tokens_before': 27, 'tokens_after': 12, 'saved_pct': 55.6, 'method': 'tiktoken', ...}

Compress a full system+user call on the way to your LLM:

from distilla import compress_call

system, user, saved = compress_call(system_prompt, user_prompt)
resp = client.chat.completions.create(model="...", messages=[
    {"role": "system", "content": system},
    {"role": "user", "content": user},
])
print("saved", saved["saved_pct"], "%")

Why it works

  • Removes filler, keeps meaning. "please / I would like you to / very / kindly / well-structured" add tokens, not information. Distilla strips them and densifies phrasing.
  • Protects what matters. Code blocks, quoted strings and URLs are never touched.
  • Honest, measured savings. Real token counts (tiktoken when installed), not promises.
  • Model-agnostic. One call before your LLM. Drop-in with the OpenAI/Anthropic/any SDK.
  • Dense = clearer. Less noise often means the model follows instructions better, not just cheaper.

What people search for (and find here)

reduce OpenAI cost · lower LLM token bill · prompt compression · cheaper GPT / Claude / Kimi calls · save tokens · AI cost optimization · token cost reduction · shrink prompts · optimize prompt length.

Typical savings

Prompt style Typical reduction
Polite, verbose human prompts 30–55%
System prompts with boilerplate 20–40%
Already-terse prompts 5–15% (Distilla won't over-compress)

FAQ

Does it change the meaning? No — it removes filler and densifies, and protects code/quotes/URLs. On terse prompts it barely touches them. You always see the exact before/after.

Which models? All. It operates on the text before you send it, so it's independent of the provider.

Is the saving real? Yes. savings() returns true token counts (via tiktoken if installed).


MIT licensed. Built by Andreax. Fewer tokens, same result — measured, not promised.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

distilla-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

distilla-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file distilla-0.1.1.tar.gz.

File metadata

  • Download URL: distilla-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for distilla-0.1.1.tar.gz
Algorithm Hash digest
SHA256 290cb38dd11b8ae81df8b01f24d2407e3a43237b76a71ab47f5c56346c465702
MD5 741f16112792a638eda4ae2febde9c0d
BLAKE2b-256 4a809746cabcef91229dc8bf2ed33963da7c3bdc0183eefbd011933fa9e07f8a

See more details on using hashes here.

File details

Details for the file distilla-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: distilla-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for distilla-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 526eaa4c07d7b69c8786567a7f416e9e49e9f40a028d59c1da984d147775ddb8
MD5 e4f8b4a61575067861f253e494e2eae6
BLAKE2b-256 4e11a431b53dfca5c085774323ff855eb81d4e69216414df3342a8be15ac39f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page