Metadata-Version: 2.4
Name: distilla
Version: 0.1.0
Summary: Cut your LLM/AI token bill 20-40% with dense-language prompt compression. Fewer tokens, same or better output.
Author: Andreax
License: MIT
Project-URL: Homepage, https://github.com/andreax/distilla
Project-URL: Documentation, https://github.com/andreax/distilla#readme
Keywords: llm,ai,tokens,cost,openai,anthropic,gpt,claude,kimi,gemini,prompt,prompt-compression,prompt-optimization,reduce-cost,token-cost,ai-cost-reduction,cheaper-llm,save-tokens,compression
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Classifier: Intended Audience :: Developers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: accurate
Requires-Dist: tiktoken; extra == "accurate"

# 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

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

## Use (2 lines)

```python
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:

```python
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.
