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.0.tar.gz (4.7 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.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: distilla-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 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.0.tar.gz
Algorithm Hash digest
SHA256 6e22ff94232bc9190834e0092a6e1e3e267e00cf9be0802eedb5d54720e3c3de
MD5 0390eaf5d11de425d550f2fe2125c03d
BLAKE2b-256 07a945f43c7e5f6053d0581cb95a90752da91286eda9b7e4564f598f37526155

See more details on using hashes here.

File details

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

File metadata

  • Download URL: distilla-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1323c67bcd4d1b9f3dabe7c808bb2b230f66658749e5bc806ca13be73de0fb74
MD5 6d2edfcc2a343132ce4c0363897e9a2a
BLAKE2b-256 9621e6424b6ca3fa121866cbf7542f61671681d2d434f8eff1deb7f021e7a7b0

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