Tamp
Token compression proxy for coding agents.
32.0% fewer input tokens. Zero code changes.
$ npx @sliday/tamp
Works with Claude Code, 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.
5-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.
Compression: ✓ minify — Strip JSON whitespace (lossless) ✓ toon — Columnar array encoding (lossless) ✓ strip-lines — Remove line-number prefixes ✓ whitespace — Collapse blank lines, trim trailing ✓ llmlingua — Neural text compression (LLMLingua-2) anthropic /v1/messages 45.2k — 5 blocks compressed, -32.0% 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] block[3] skipped (error) block[4] 1.1k→712 -35.3% 293→190 tok [normalize] session 31.4k chars, 8686 tokens saved across 8 blocks (32.0% avg) $0.0261 saved @ $3/Mtok anthropic /v1/messages 2.1k — no tool blocks
Measured: 32.0% fewer tokens
A/B tested via OpenRouter with Claude Sonnet 4.6. Ten scenarios, five runs each, 100 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 + LLMLingua-2) | 1,069 | 644 | -39.8% |
| Multi-turn (5-turn, all messages) | 1,026 | 699 | -31.9% |
| Line-Numbered JSON (Read tool output) | 473 | 323 | -31.7% |
| Line-Numbered Source (strip-lines on text) | 505 | 394 | -22.0% |
| Whitespace-Heavy (CLI output) | 321 | 301 | -6.2% |
| All-Message 10-turn (historical compression) | 2,217 | 1,717 | -22.6% |
| 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
5 stages: JSON minify, TOON columnar, line-number stripping, whitespace normalization, LLMLingua-2 neural compression.
What doesn't
Error results, already-minified JSON, and TOON content pass through untouched. Safety first.
~$28/month saved per developer
At Sonnet 4 pricing ($3/Mtok input), Tamp saves ~$0.19 per 200-request session (63K tokens). Heavy users running 5 sessions/day see ~$28/month. For a 10-person team: ~$3,400/year.
Based on Sonnet 4.6 ($3/Mtok) with 60% compressible traffic. Opus 4.6 ($5/Mtok) saves ~$48/dev/month.
Claude Max? Last 47% longer.
Max subscribers have a fixed token budget per session. Tamp compresses input tokens before they count against your limit — same work, fewer tokens consumed.
Max 5× — $100/mo
5× → 7.4×
+47% more usage
Max 20× — $200/mo
20× → 29.4×
+47% more usage
| Model | Input $/MTok | Saved/session | Per dev/month | 10-person team/yr |
|---|---|---|---|---|
| Sonnet 4.6 | $3 | $0.19 | $28 | $3,400 |
| Opus 4.6 | $5 | $0.32 | $48 | $5,760 |
| Opus 4.6 (extended >200k) | $10 | $0.64 | $96 | $11,520 |
Math: 32% fewer input tokens → 1/(1−0.32) = 1.47× more requests per budget. 5 sessions/day assumed.
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