llmtrim
Lets your AI tools send smaller LLM requests through a local proxy that compresses prompts and tool output to cut token cost.
267 stars on GitHubby fkieneLicense MPL-2.0Updated 21 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add llmtrim -- npx -y @llmtrim/cli mcp
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Show my token savings this week.
Check that llmtrim is working and fix anything broken.
What it is
llmtrim runs as a local proxy that trims wasted tokens from prompts, history, tool output and code before they reach the provider, then forwards a smaller request. The answers stay the same. It is also an MCP server, a command-line tool and an embeddable library.
What it can do
llmtrim setup: start the local proxy and wire your shellllmtrim status: savings and healthllmtrim compress: compress a request bodyllmtrim doctor: diagnose and repairllmtrim recall: restore omitted tool results/subfor Claude Code through CLIProxyAPI
When to use
- βΊWhen you use Claude Code, Codex or Cursor and want a smaller token bill
- βΊWhen tool output such as long build logs fills your context
- βΊWhen you want to measure how many tokens you save per day
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
caveman-compressHelps your agent shrink a memory file, such as CLAUDE.md or a todo list, into a shorter caveman style to save input tokens.llm-cost-optimizerHelps your agent cut the cost of AI model use by choosing models, caching prompts, limiting tokens and logging spend before launch.aws-cost-operationsHelps your agent understand and reduce AWS cloud costs. It analyzes your bills, suggests savings, and monitors usage to prevent surprises.Frequently asked questions
Is it free?
The readme shows an open license badge and does not list any fee. It runs on your machine and nothing is sent to the project.
Can it break my requests?
The readme says each stage is re-measured with the provider's tokenizer and undone if it does not save tokens, and the original is resent if the provider rejects the compressed body.
Which tools work with it?
Anything that honors HTTPS_PROXY, such as Claude Code, Codex, Cursor and Aider. GitHub Copilot does not work.
What does setup change?
A private name-constrained CA in ~/.llmtrim/, shell variables for the proxy, and a login service. llmtrim uninstall reverses all three.
Does it store my prompts?
Prompts never touch disk, only anonymous token counts. Recoverable tool results stay in daemon memory for five hours by default.
What savings does it claim?
About 31 percent less input and 74 percent less output in 112 live A/B cases, according to its own measurements.
If it does not work
- βΊOpen a new terminal after setup so the proxy variables apply.
- βΊRun llmtrim doctor --fix or llmtrim ensure if something stops working after an upgrade.
- βΊUse llmtrim wrap claude to force a single session through llmtrim.
5 new skills a week. 1 minute to read.