LLMSlim + Claude Code
Run Claude Code through a local proxy that shrinks long tool output once and resends the same bytes every turn, so prompt caching and thinking keep working.
Claude Code resends the whole conversation on every turn, so a long test log or search result is paid for again and again and fills the context window until Claude Code compacts. llmslim wrap claude starts a local proxy and runs Claude Code through it. The first time the model is about to see a long shell, search or web result, LLMSlim shortens it, keeping errors, failures and the lines related to the command. It stores that version and sends exactly the same bytes on every later request, so nothing the model has already seen ever changes. File reads and edits are never touched.
1. Installation and setup
No model is called and nothing new leaves your machine: Claude Code sends the same requests it always did, only shorter. Your API key or Claude login is forwarded to Anthropic as usual and never stored.
pip install "llmslim[proxy]" # llmslim 0.11.0 or newerRun Claude Code through the proxy, then see what it saved:
llmslim wrap claude
llmslim proxy stats2. Architecture & execution flow
3. Runnable example and its output
llmslim wrap claude -- -p "Run the tests and tell me what fails"What Claude receives for a 10,545-token pytest log (156 tokens):
[LLMSlim shortened this tool output from 10,545 to about 117 tokens, keeping errors and the lines most related to the call. Run a narrower command to see more.]
tests/test_api.py::test_endpoint_0 PASSED [0%]
... [410 similar lines]
tests/test_api.py::test_endpoint_411 PASSED [68%]
tests/billing/test_refund.py::test_rounding_half_even FAILED - AssertionError: Decimal('10.05') != Decimal('10.04')
tests/test_api.py::test_endpoint_412 PASSED [68%]
... [286 similar lines]
tests/test_api.py::test_endpoint_699 PASSED [116%]
=== 1 failed, 700 passed in 41.27s ===The failing test, its assertion and the summary line stay; 698 passing lines collapse into two counts. If the model needs more, it can run a narrower command.
4. Options
Keyword arguments, shown as name = default.