Skip to content

Commit a045c5c

Browse files
committed
fix: rename PyPI distribution to llm-tokenoptim (tokenoptim taken)
- PyPI package name: llm-tokenoptim (pip install llm-tokenoptim) - Python import stays: tokenoptim (from tokenoptim import ...) - CLI commands: both tokenoptim and llm-tokenoptim work - Bump to v0.2.1 - Author name updated to venkatamanas raghupatruni 52 tests passing, ruff clean.
1 parent 6b3aee3 commit a045c5c

8 files changed

Lines changed: 138 additions & 137 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Support tokenoptim development
1+
# Support llm-tokenoptim development
22
github: manasmourya

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: ruff check src/ tests/
3131

3232
- name: Type check (mypy)
33-
run: mypy src/tokenoptim --ignore-missing-imports
33+
run: mypy src/llm-tokenoptim --ignore-missing-imports
3434
continue-on-error: true # non-blocking until full annotation pass
3535

3636
- name: Run tests

CHANGELOG.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ Format: [Semantic Versioning](https://semver.org/).
66
## [0.2.0] — 2026-05-19
77

88
### Added (CLI-first release)
9-
- `tokenoptim install-claude --level LEVEL` — append caveman skill to CLAUDE.md (auto-loaded by Claude Code)
10-
- `tokenoptim install-global` — install skill to ~/CLAUDE.md for all projects
11-
- `tokenoptim wrap --level LEVEL -- CMD` — inject skill into gemini, codex, aider, sgpt, llm, ollama, or any LLM CLI
12-
- `tokenoptim skill LEVEL` — print skill to stdout (pipeable anywhere)
9+
- `llm-tokenoptim install-claude --level LEVEL` — append caveman skill to CLAUDE.md (auto-loaded by Claude Code)
10+
- `llm-tokenoptim install-global` — install skill to ~/CLAUDE.md for all projects
11+
- `llm-tokenoptim wrap --level LEVEL -- CMD` — inject skill into gemini, codex, aider, sgpt, llm, ollama, or any LLM CLI
12+
- `llm-tokenoptim skill LEVEL` — print skill to stdout (pipeable anywhere)
1313
- `skills/` directory with 5 SKILL.md files: lite / standard / full / ultra / ancient
14-
- `bin/tokenoptim` — pure-bash wrapper (works without Python)
14+
- `bin/llm-tokenoptim` — pure-bash wrapper (works without Python)
1515
- `AsyncOptimizedClient` — full async/await client with streaming and batch support
1616
- `AsyncAnthropicProvider` and `AsyncOpenAIProvider` with `async_chat()` and `stream()`
1717
- `batch_chat()` — concurrent API calls with configurable semaphore
1818
- `RetryConfig` — exponential backoff for 429/5xx/timeout errors
1919
- `ResponseCache` — disk-backed LRU cache with TTL; survives restarts
2020
- `MLPromptCompressor` — LLMLingua integration for 40–60% ML-based compression
2121
- `benchmarks/run_benchmark.py` — reproducible benchmark against ShareGPT dataset
22-
- `[ml]` optional extra: `pip install "tokenoptim[ml]"`
22+
- `[ml]` optional extra: `pip install "llm-tokenoptim[ml]"`
2323

2424
### Fixed
2525
- Deduplicate min_len threshold reduced 80→40 (catches more realistic duplicates)
@@ -39,6 +39,6 @@ Format: [Semantic Versioning](https://semver.org/).
3939
- `OptimizedClient` — sync unified client
4040
- Providers: `AnthropicProvider`, `OpenAIProvider`, `OllamaProvider`
4141
- `SparkTokenOptimizer` + `compress_prompts_udf` — PySpark batch support
42-
- CLI: `tokenoptim compress / bench / levels`
42+
- CLI: `llm-tokenoptim compress / bench / levels`
4343
- GitHub Actions CI (Python 3.9–3.12)
4444
- 23 unit tests

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# tokenoptim — token optimization skill
1+
# llm-tokenoptim — token optimization skill
22

3-
You are running with **tokenoptim standard compression** active.
3+
You are running with **llm-tokenoptim standard compression** active.
44

55
## Output rules
66

@@ -27,4 +27,4 @@ If the user prefixes their message with `[budget:N]`, target ≤N tokens in your
2727

2828
---
2929

30-
*tokenoptim v0.2.0 — use `tokenoptim skill [lite|standard|full|ultra|ancient]` to switch levels*
30+
*llm-tokenoptim v0.2.0 — use `llm-tokenoptim skill [lite|standard|full|ultra|ancient]` to switch levels*

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Contributing to tokenoptim
1+
# Contributing to llm-tokenoptim
22

33
Thank you for taking the time to contribute.
44

55
## Setup
66

77
```bash
8-
git clone https://github.com/manasmourya/tokenoptim
9-
cd tokenoptim
8+
git clone https://github.com/manasmourya/llm-tokenoptim
9+
cd llm-tokenoptim
1010
pip install -e ".[dev]"
1111
```
1212

@@ -26,27 +26,27 @@ pytest tests/ -v
2626

2727
1. **Tests pass**: `pytest tests/ -p no:cacheprovider`
2828
2. **Lint clean**: `ruff check src/ tests/`
29-
3. **Types check**: `mypy src/tokenoptim/`
29+
3. **Types check**: `mypy src/llm-tokenoptim/`
3030
4. **Benchmark still runs**: `python benchmarks/run_benchmark.py --no-download --samples 20`
3131

3232
## Adding a new provider
3333

34-
1. Create `src/tokenoptim/providers/myprovider.py` — inherit from `BaseProvider`
34+
1. Create `src/llm-tokenoptim/providers/myprovider.py` — inherit from `BaseProvider`
3535
2. Implement `chat()`, `count_tokens()`, and `provider_name`
36-
3. Export from `src/tokenoptim/providers/__init__.py`
36+
3. Export from `src/llm-tokenoptim/providers/__init__.py`
3737
4. Add an async variant `myprovider_async.py` if the SDK supports it
3838
5. Add at least one test in `tests/`
3939

4040
## Adding a compression level
4141

42-
- Output levels live in `src/tokenoptim/core/output_style.py` — add to `CompressionLevel` enum and `_PROMPTS` dict
43-
- Prompt levels live in `src/tokenoptim/core/compressor.py` — add to `LEVELS` tuple and `_apply_compression()`
42+
- Output levels live in `src/llm-tokenoptim/core/output_style.py` — add to `CompressionLevel` enum and `_PROMPTS` dict
43+
- Prompt levels live in `src/llm-tokenoptim/core/compressor.py` — add to `LEVELS` tuple and `_apply_compression()`
4444

4545
## Reporting bugs
4646

4747
Please open an issue with:
4848
- Python version and OS
49-
- tokenoptim version (`python -c "import tokenoptim; print(tokenoptim.__version__)"`)
49+
- llm-tokenoptim version (`python -c "import llm-tokenoptim; print(llm-tokenoptim.__version__)"`)
5050
- Minimal reproducer
5151
- Expected vs actual behaviour
5252

README.md

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# 🪨 tokenoptim
1+
# 🪨 llm-tokenoptim
22

33
> **Cut LLM token costs by 40–75% — no API key required.**
44
> Works as a CLI tool for Claude Code, Gemini CLI, Codex, aider, and any LLM tool.
55
> Optional Python SDK for Anthropic · OpenAI · Ollama · PySpark batch.
66
7-
[![PyPI](https://img.shields.io/pypi/v/tokenoptim)](https://pypi.org/project/tokenoptim/)
8-
[![Python](https://img.shields.io/pypi/pyversions/tokenoptim)](https://pypi.org/project/tokenoptim/)
9-
[![CI](https://github.com/manasmourya/tokenoptim/actions/workflows/ci.yml/badge.svg)](https://github.com/manasmourya/tokenoptim/actions)
7+
[![PyPI](https://img.shields.io/pypi/v/llm-tokenoptim)](https://pypi.org/project/llm-tokenoptim/)
8+
[![Python](https://img.shields.io/pypi/pyversions/llm-tokenoptim)](https://pypi.org/project/llm-tokenoptim/)
9+
[![CI](https://github.com/manasmourya/llm-tokenoptim/actions/workflows/ci.yml/badge.svg)](https://github.com/manasmourya/llm-tokenoptim/actions)
1010
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
11-
[![Downloads](https://img.shields.io/pypi/dm/tokenoptim)](https://pypi.org/project/tokenoptim/)
11+
[![Downloads](https://img.shields.io/pypi/dm/llm-tokenoptim)](https://pypi.org/project/llm-tokenoptim/)
1212

1313
---
1414

1515
## 30-second start (no API key needed)
1616

1717
```bash
18-
pip install tokenoptim
18+
pip install llm-tokenoptim
1919

2020
# Inject caveman compression into Claude Code (auto-loaded via CLAUDE.md)
21-
tokenoptim install-claude --level full
21+
llm-tokenoptim install-claude --level full
2222

2323
# Pipe skill into any LLM tool manually
24-
tokenoptim skill full | pbcopy # macOS clipboard → paste into any chat
24+
llm-tokenoptim skill full | pbcopy # macOS clipboard → paste into any chat
2525

2626
# Wrap ANY LLM CLI tool — works with gemini, codex, aider, sgpt, llm, ollama
27-
tokenoptim wrap --level full -- gemini "explain kubernetes networking"
28-
tokenoptim wrap --level ultra -- claude "write a redis cache class"
29-
tokenoptim wrap --level standard -- aider --model gpt-4o
27+
llm-tokenoptim wrap --level full -- gemini "explain kubernetes networking"
28+
llm-tokenoptim wrap --level ultra -- claude "write a redis cache class"
29+
llm-tokenoptim wrap --level standard -- aider --model gpt-4o
3030

3131
# Compress a verbose prompt before sending
32-
tokenoptim compress "Could you please help me understand what tokenization means in the context of large language models?"
32+
llm-tokenoptim compress "Could you please help me understand what tokenization means in the context of large language models?"
3333
```
3434

3535
**Five compression levels — no API, no GPU, <0.1ms overhead:**
@@ -50,7 +50,7 @@ tokenoptim compress "Could you please help me understand what tokenization means
5050

5151
Every LLM API call burns money proportional to token count. Most teams waste tokens in predictable, fixable ways:
5252

53-
| Waste source | Typical overhead | tokenoptim fix |
53+
| Waste source | Typical overhead | llm-tokenoptim fix |
5454
|---|---|---|
5555
| Verbose prompts ("Could you please help me...") | +15–30% input tokens | Regex prompt compressor |
5656
| Pleasantries in output ("Great question! Certainly!") | +40–75% output tokens | 6-level output compressor |
@@ -73,7 +73,7 @@ Every LLM API call burns money proportional to token count. Most teams waste tok
7373
| `medium` | 12% | 11% | 24% | <0.1ms |
7474
| `full` | 14% | 12% | 26% | <0.1ms |
7575

76-
> **With LLMLingua ML backend** (`pip install "tokenoptim[ml]"`): 40–60% reduction on verbose prompts. Install the extra to unlock it — the library falls back to regex automatically if not present.
76+
> **With LLMLingua ML backend** (`pip install "llm-tokenoptim[ml]"`): 40–60% reduction on verbose prompts. Install the extra to unlock it — the library falls back to regex automatically if not present.
7777
7878
### Output Compression (via system prompt injection)
7979

@@ -93,14 +93,14 @@ Every LLM API call burns money proportional to token count. Most teams waste tok
9393

9494
```bash
9595
# Core library — zero dependencies
96-
pip install tokenoptim
96+
pip install llm-tokenoptim
9797

9898
# With providers
99-
pip install "tokenoptim[anthropic]" # Claude (async + streaming)
100-
pip install "tokenoptim[openai]" # OpenAI / Groq / Together
101-
pip install "tokenoptim[spark]" # PySpark batch compression
102-
pip install "tokenoptim[ml]" # LLMLingua ML compression (40-60%)
103-
pip install "tokenoptim[all]" # Everything
99+
pip install "llm-tokenoptim[anthropic]" # Claude (async + streaming)
100+
pip install "llm-tokenoptim[openai]" # OpenAI / Groq / Together
101+
pip install "llm-tokenoptim[spark]" # PySpark batch compression
102+
pip install "llm-tokenoptim[ml]" # LLMLingua ML compression (40-60%)
103+
pip install "llm-tokenoptim[all]" # Everything
104104
```
105105

106106
---
@@ -110,7 +110,7 @@ pip install "tokenoptim[all]" # Everything
110110
### Compress a prompt — no LLM, no API key
111111

112112
```python
113-
from tokenoptim import PromptCompressor
113+
from llm-tokenoptim import PromptCompressor
114114

115115
c = PromptCompressor(level="medium")
116116
compressed, stats = c.compress(
@@ -125,8 +125,8 @@ print(stats)
125125

126126
```python
127127
import asyncio
128-
from tokenoptim import AsyncOptimizedClient
129-
from tokenoptim.providers import AsyncAnthropicProvider
128+
from llm-tokenoptim import AsyncOptimizedClient
129+
from llm-tokenoptim.providers import AsyncAnthropicProvider
130130

131131
async def main():
132132
client = AsyncOptimizedClient(
@@ -160,8 +160,8 @@ asyncio.run(main())
160160
### Sync client (simpler, same optimizations)
161161

162162
```python
163-
from tokenoptim import OptimizedClient
164-
from tokenoptim.providers import AnthropicProvider
163+
from llm-tokenoptim import OptimizedClient
164+
from llm-tokenoptim.providers import AnthropicProvider
165165

166166
client = OptimizedClient(
167167
provider=AnthropicProvider(),
@@ -176,8 +176,8 @@ print(resp["content"])
176176
### ML-powered compression (40–60% input reduction)
177177

178178
```python
179-
# pip install "tokenoptim[ml]"
180-
from tokenoptim.core.ml_compressor import MLPromptCompressor
179+
# pip install "llm-tokenoptim[ml]"
180+
from llm-tokenoptim.core.ml_compressor import MLPromptCompressor
181181

182182
c = MLPromptCompressor(target_token_rate=0.5) # keep 50% → 50% reduction
183183
compressed, stats = c.compress(very_long_prompt)
@@ -190,10 +190,10 @@ Falls back to regex automatically if `llmlingua` is not installed.
190190
### Response caching — avoid duplicate API calls
191191

192192
```python
193-
from tokenoptim import ResponseCache, OptimizedClient
194-
from tokenoptim.providers import AnthropicProvider
193+
from llm-tokenoptim import ResponseCache, OptimizedClient
194+
from llm-tokenoptim.providers import AnthropicProvider
195195

196-
cache = ResponseCache(directory="~/.cache/tokenoptim", ttl_seconds=3600)
196+
cache = ResponseCache(directory="~/.cache/llm-tokenoptim", ttl_seconds=3600)
197197
provider = AnthropicProvider()
198198

199199
messages = [{"role": "user", "content": "What is tokenization?"}]
@@ -237,7 +237,7 @@ client.clear_memory() # Wipe history
237237
Automatic exponential backoff on 429 / 5xx — configured at construction:
238238

239239
```python
240-
from tokenoptim import RetryConfig, AsyncOptimizedClient
240+
from llm-tokenoptim import RetryConfig, AsyncOptimizedClient
241241

242242
client = AsyncOptimizedClient(
243243
provider=...,
@@ -259,17 +259,17 @@ Compress millions of prompts before sending to any LLM:
259259

260260
```python
261261
from pyspark.sql import SparkSession
262-
from tokenoptim.spark import SparkTokenOptimizer
262+
from llm-tokenoptim.spark import SparkTokenOptimizer
263263

264-
spark = SparkSession.builder.appName("tokenoptim").getOrCreate()
264+
spark = SparkSession.builder.appName("llm-tokenoptim").getOrCreate()
265265
df = spark.read.parquet("s3://bucket/raw-prompts/")
266266

267267
optimizer = SparkTokenOptimizer(level="full", spark=spark)
268268
df_out = optimizer.compress_dataframe(df, prompt_col="prompt")
269269
df_out.write.parquet("s3://bucket/compressed-prompts/")
270270
optimizer.savings_report(df, df_out)
271271

272-
# ━━━━ tokenoptim PySpark Savings Report ━━━━
272+
# ━━━━ llm-tokenoptim PySpark Savings Report ━━━━
273273
# Prompts processed : 4,500,000
274274
# Total original tokens: 892,400,000
275275
# Total compressed : 768,000,000
@@ -286,25 +286,25 @@ With the `[ml]` extra, LLMLingua runs as a Spark UDF on each executor — 40–6
286286

287287
```bash
288288
# ── Skill injection (primary use — no API key needed) ─────────────────────────
289-
tokenoptim skill [lite|standard|full|ultra|ancient] # print skill to stdout
290-
tokenoptim install-claude --level full # append to ./CLAUDE.md
291-
tokenoptim install-global --level standard # append to ~/CLAUDE.md
289+
llm-tokenoptim skill [lite|standard|full|ultra|ancient] # print skill to stdout
290+
llm-tokenoptim install-claude --level full # append to ./CLAUDE.md
291+
llm-tokenoptim install-global --level standard # append to ~/CLAUDE.md
292292

293293
# ── Wrap any LLM CLI tool ─────────────────────────────────────────────────────
294-
tokenoptim wrap --level full -- gemini "explain kubernetes"
295-
tokenoptim wrap --level ultra -- claude "write a redis cache class"
296-
tokenoptim wrap --level full -- codex "refactor this function"
297-
tokenoptim wrap --level standard -- aider --model gpt-4o
298-
tokenoptim wrap --level full -- llm "summarize this doc"
299-
tokenoptim wrap --level ultra -- ollama run llama3
294+
llm-tokenoptim wrap --level full -- gemini "explain kubernetes"
295+
llm-tokenoptim wrap --level ultra -- claude "write a redis cache class"
296+
llm-tokenoptim wrap --level full -- codex "refactor this function"
297+
llm-tokenoptim wrap --level standard -- aider --model gpt-4o
298+
llm-tokenoptim wrap --level full -- llm "summarize this doc"
299+
llm-tokenoptim wrap --level ultra -- ollama run llama3
300300

301301
# ── Prompt compression (Python regex, <0.1ms, no API) ────────────────────────
302-
tokenoptim compress "Could you please help me understand what a token is?"
303-
tokenoptim compress --level full --file my_prompt.txt --output compressed.txt
302+
llm-tokenoptim compress "Could you please help me understand what a token is?"
303+
llm-tokenoptim compress --level full --file my_prompt.txt --output compressed.txt
304304

305305
# ── Benchmarks ────────────────────────────────────────────────────────────────
306-
tokenoptim bench --input prompts.txt # benchmark one prompt per line
307-
tokenoptim levels # show all levels and savings
306+
llm-tokenoptim bench --input prompts.txt # benchmark one prompt per line
307+
llm-tokenoptim levels # show all levels and savings
308308
python benchmarks/run_benchmark.py --samples 500
309309
```
310310

@@ -313,7 +313,7 @@ python benchmarks/run_benchmark.py --samples 500
313313
## Architecture
314314

315315
```
316-
src/tokenoptim/
316+
src/llm-tokenoptim/
317317
├── core/
318318
│ ├── compressor.py # Regex prompt compression (3 levels, <0.1ms)
319319
│ ├── ml_compressor.py # LLMLingua ML compression (optional, 40–60%)
@@ -331,7 +331,7 @@ src/tokenoptim/
331331
├── spark/udf.py # PySpark UDF + SparkTokenOptimizer
332332
├── client.py # OptimizedClient (sync)
333333
├── async_client.py # AsyncOptimizedClient (async + batch + stream)
334-
└── cli.py # tokenoptim CLI
334+
└── cli.py # llm-tokenoptim CLI
335335
```
336336

337337
---
@@ -349,8 +349,8 @@ Output compression savings (40–75%) apply to the **output side** and are syste
349349
## Contributing
350350

351351
```bash
352-
git clone https://github.com/manasmourya/tokenoptim
353-
cd tokenoptim
352+
git clone https://github.com/manasmourya/llm-tokenoptim
353+
cd llm-tokenoptim
354354
pip install -e ".[dev]"
355355
pytest tests/ -v
356356
python benchmarks/run_benchmark.py --no-download

0 commit comments

Comments
 (0)