Tamp
Token compression proxy for coding agents.
33.9% fewer input tokens. Zero code changes.
$ npx @sliday/tamp
Works with Claude Code, Codex, Aider, Cursor, Cline, and any OpenAI-compatible agent.
Other installation methods
# Shell installer $ curl -fsSL tamp.dev/setup.sh | bash # Manual $ git clone https://github.com/sliday/tamp ~/.tamp $ cd ~/.tamp && npm install $ node index.js
Tokens pile up. Fast.
200+
API calls per session
each sends full history
60%
is tool_result bloat
pretty JSON, raw files, CLI output
$6–15
per coding session
at $3/Mtok input pricing
Every turn re-sends everything. Tamp compresses before it leaves your machine.
3-Stage Compression Pipeline
JSON Minify
— strip whitespace, losslessBefore
After
TOON Encoding
— objects → columnar formatJSON (334 chars)
TOON (165 chars)
LLMLingua-2
— ML token pruning for text contentcompress.js source code
4,630 chars → 2,214 chars
Each stage runs only when effective. Error results are never compressed.
Live Output
Every request shows compression stats, token savings, and cumulative $ saved.
┌─ Tamp v0.2.8 ───────────────────────────────┐ │ Proxy: http://localhost:7778 │ │ Status: ● READY │ └──────────────────────────────────────────────┘ anthropic /v1/messages 45.2k — 3 compressed, -34.2% block[0] 12.5k→8.2k -34.4% 3340→2201 tok [toon] block[1] 2.1k→1.4k -33.3% 560→374 tok [minify] block[2] 890→534 -40.0% 237→142 tok [minify] session 5.3k chars, 1420 tokens saved across 3 blocks (34.2% avg) $0.0043 saved @ $3/Mtok anthropic /v1/messages 128.7k — 5 compressed, -41.8% block[0] 48.2k→27.1k -43.8% 12840→7213 tok [toon] block[1] 8.4k→5.1k -39.3% 2240→1360 tok [minify] block[2] 3.2k→1.9k -40.6% 853→507 tok [minify] block[3] skipped (error) block[4] 1.1k→712 -35.3% 293→190 tok [minify] session 31.4k chars, 8686 tokens saved across 8 blocks (39.1% avg) $0.0261 saved @ $3/Mtok anthropic /v1/messages 2.1k — no tool blocks
Measured: 33.9% fewer tokens
A/B tested via OpenRouter with Claude Sonnet 4. Seven scenarios, five runs each, 70 API calls total.
| Scenario | Control | Compressed | Reduction |
|---|---|---|---|
| Small JSON (package.json) | 315 | 246 | -21.9% |
| Large JSON (dependency tree) | 6,773 | 4,855 | -28.3% |
| Tabular Data (file listing) | 3,574 | 1,835 | -48.7% |
| Source Code (TypeScript) | 1,069 | 644 | -39.8% |
| Multi-turn (5-turn conversation) | 1,026 | 790 | -23.0% |
| Line-Numbered (Read tool output) | 473 | 323 | -31.7% |
| Error Result (is_error: true) — skipped by design | 167 | 167 | 0.0% |
How we tested
Identical requests via OpenRouter. Raw vs. compressed. Exact input_tokens from the API. No estimation.
What compresses
Pretty JSON (minify), arrays (TOON columnar), line-numbered output (strip), text (LLMLingua-2 neural).
What doesn't
Error results, already-minified JSON, and TOON content pass through untouched. Safety first.
~$35/month saved per developer
At Sonnet 4 pricing ($3/Mtok input), Tamp saves ~$0.23 per 200-request session. Heavy users running 5 sessions/day see ~$35/month. For a 10-person team: ~$4,200/year.
Based on 60% compressible traffic. Actual savings depend on usage. Opus/Haiku have different rates.
Transparent HTTP Proxy
Intercept
POST /v1/messages only. All other routes pass through untouched.
Compress
Last user message → tool_result blocks get compressed per content type.
Forward
Rewrite Content-Length, forward to upstream API. Response streams back untouched.
Safety
Bodies over 256KB bypass compression. Parse errors fall through gracefully.
What's Next
Try it now
$ npx @sliday/tamp