How I Cut LLM Token Usage by Up to 60% in Production
If you work with LLM APIs (OpenAI, Anthropic, Gemini), you know the pain: every call costs money, and a big chunk of that cost is pure waste — verbose prompts, code pasted with no filtering, repeated context the model doesn't even need to understand the task. That's why I built PromptShrink: a prompt pre-processor that trims the excess before it ever hits the API, without losing what actually matters for the model to understand.
The real problem
Every time you feed a code snippet or a long prompt to an LLM, you're paying per token, not per character. Comments, whitespace, formatting meant for humans — all of that is dead weight the model doesn't need to do its job. At scale (thousands of calls per month), that adds up to a real bill.
What PromptShrink does
Packages entire repositories, minifying code and stripping comments, ready to paste as context into any LLM
Simulates real dollar savings, comparing your current spend against the optimized version
Visualizes everything on a dashboard — tokens saved, % reduction, active rules
Plugs straight into your code via a Python SDK
Becomes a browser extension, adding a "Shrink" button directly on ChatGPT, Claude.ai, Google AI Studio, and Poe
In practice
bash
promptshrink repo --path ./src --save-to-file context.txt
promptshrink calc --calls 100000 --tokens 800 --model gpt-4o
Running calc on a scenario of [insert your real number here, e.g. "100k calls/month with gpt-4o"], the estimated savings came out to [$X per month] — just by trimming what's unnecessary before it reaches the model.
Try it out The project is open source, with a CLI, a FastAPI backend, and a Python SDK. If you're running LLMs in production and want to stop paying for tokens that add zero value, check it out:
🔗 github.com/HeloisaPeGarcia/PromptShrink
Feedback and PRs are very welcome — this is my first published project like this, so every contribution helps make it better.