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.

Original post →

More from coding & agent

coding & agent channel →