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.

Release files for distilla 0.1.1

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

Source distribution (sdist)

Source distribution for distilla 0.1.1
File Size Uploaded
distilla-0.1.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for distilla 0.1.1
File Interpreter ABI Platform
distilla-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / distilla-0.1.1.tar.gz

Download URL distilla-0.1.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
290cb38dd11b8ae81df8b01f24d2407e3a43237b76a71ab47f5c56346c465702
BLAKE2b-256 checksum
How to use checksums
4a809746cabcef91229dc8bf2ed33963da7c3bdc0183eefbd011933fa9e07f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / distilla-0.1.1-py3-none-any.whl

Download URL distilla-0.1.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
526eaa4c07d7b69c8786567a7f416e9e49e9f40a028d59c1da984d147775ddb8
BLAKE2b-256 checksum
How to use checksums
4e11a431b53dfca5c085774323ff855eb81d4e69216414df3342a8be15ac39f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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