SlimToken: open-source context compressor cuts 57-64% of tokens before they hit the LLM
Intelligent-Key7357 · reddit · 2026-08-18
A developer released SlimToken, an MIT-licensed open-source token compressor that minifies LLM context reversibly before it reaches the model, so you fit more into the window and pay for fewer tokens. Built on or/xxhash/tiktoken, its token counts use the real cl100k tokenizer.
Three modes: a proxy server (default) that sits in front of Anthropic/OpenAI/Ollama and auto-minifies every request; an MCP server exposing the pipeline as 8 tools; and an Agent Skill + CLI + Python library for Claude Code / Codex / OpenCode.
Pipeline: strips $comment/examples from schemas, collapses repeated banners and whitespace, dedupes repeated toolresults, truncates old assistant prose, enforces a hard token budget, optionally prunes HTML DOM, and type-specifically compresses big tool results. Guarantees: fenced code preserved byte-identical, pair-safety between tooluse/toolresult, zero-copy for unchanged content. There's also a streaming output filter (drops filler like "Sure!", caps runaway completions) and a 1ms pure-CPU prompt rewriter that shrinks a rambling 200-word request to 25 words without a model call.
Measured savings: 57-64% on bloated coding sessions, 83% on HTML dumps — but 0% on clean short sessions, since it only removes redundancy. Ships with VRAM presets (4/8/16GB) and a high-context table (e.g. 898k effective tokens on a 128k MoE row). The author is seeking feedback and contributors.
More from coding & agent
- MCP security warning: readOnlyHint is not a boundary; enforce least-privilege roles below the model — WirelessLife · 2026-08-18
- Nous Research releases Hermes Agent Desktop with cross-platform memory and automation — Teknium · 2026-08-18
- Building agentic social media workflows with MCP + unified publishing API — Steveo_altar2 · 2026-08-18
- AI Completes 11 Hours of Reverse Engineering in 11 Minutes — tetsuoai · 2026-08-18
- Qwen3.8 27B outperforms larger models on local MacBooks — appenz · 2026-08-18
- Hermes Desktop introduces Bot Mode with multi-agent communication — NousResearch · 2026-08-18