Token savers: RTK, Caveman, Ponytail, Headroom, PXPIPE
Five ways kRouter can shrink a request before it reaches the provider. Only RTK is on by default. What each saver does, what it needs, and its limits.
kRouter can shrink a request on its way to the provider. There are five savers. Only RTK is on by default; the other four are opt-in, and two of them need an extra install. RTK, Caveman, Ponytail and Headroom are on the dashboard's Token Saver page; PXPIPE has its own PXPIPE page.
At a glance
| Saver | What it shrinks | Default | Needs |
|---|---|---|---|
| RTK | Tool output inside the request (input tokens) | On | Nothing |
| Caveman | The model's answers (output tokens) | Off | Nothing |
| Ponytail | The model's answers, steered toward minimal code | Off | Nothing |
| Headroom | The conversation context | Off | A Python proxy |
| PXPIPE | Large Claude-format context, rendered as images | Off | The pxpipe-proxy package, installed on demand |
The percentages on this page are the project's own estimates or single runs, not measurements of your traffic. How much you save depends on what your tool sends.
RTK
Coding agents send tool output back to the model on every turn: diffs, search results, directory listings, file reads, build logs. RTK rewrites that output before it leaves your machine. It recognises the kind of output and applies a filter for it:
- git diff: file headers, added and removed counts, and hunks cut at 100 lines each
- git status, grep, find, ls and tree: compacted, with long lists capped (for example, the first 10 grep matches per file)
- Build output, verbose curl, numbered file reads and search lists: their own filters
- Logs: repeated consecutive lines collapsed into a count
- Anything else that is long: the first and last lines kept, the middle replaced by a line count
Blobs under 500 bytes are left alone. RTK works on OpenAI, Claude, Responses, Gemini, Antigravity and Kiro request shapes.
RTK drops content, so it is not lossless: a model that needs line 140 of a long grep result will not see it. If a filter throws an error, the original output is sent unchanged.
- Default: on
- Savings: the project's README estimates 20-40% fewer input tokens on tool-heavy requests; the dashboard quotes 60-90% for git, grep, ls, tree and log output itself
Caveman
Caveman adds a system prompt that tells the model to answer tersely. Levels are lite, full (the default level) and ultra. With the dashboard in a Chinese locale, three classical-Chinese levels also appear: wenyan-lite, wenyan and wenyan-ultra.
- Default: off
- Savings: the dashboard quotes about 65% fewer output tokens, up to 87%
- Trade-off: it changes how every answer reads, which is why it is opt-in
Ponytail
Ponytail adds a different system prompt: a "lazy senior developer" persona that writes the least code that works, skips unrequested abstractions and keeps explanations to a few lines. Levels are lite, full (the default level) and ultra.
Caveman and Ponytail are mutually exclusive. If both are switched on, kRouter runs Ponytail and skips Caveman.
- Default: off
Headroom
Headroom is a separate Python proxy that compresses conversation context: repeated file contents, large tool outputs, long histories. kRouter sends the conversation to the proxy's /v1/compress endpoint and swaps in the compressed messages.
# Needs Python 3.10 or newer
pip install "headroom-ai[proxy]"The base [proxy] package alone compresses almost nothing. The compression comes from the code and ml extras, which the Token Saver page can install and remove for you. kRouter can also start, stop and restart a local proxy. The default proxy URL is http://localhost:8787.
- Default: off
- Fails open: if the proxy is down, slow or not installed, the request goes out unchanged
- Savings: in one recorded run with the
mlextra, a code-heavy request went from 27,187 to 2,056 tokens (92.4%). That is one request, not an average: repetitive code compresses well, plain prose barely moves, and the base package alone reported 0%
More detail is in the Headroom write-up.
PXPIPE
PXPIPE renders large blocks of Claude-format context as PNG images that the model reads instead of the text. It only acts when:
- the context is at least 25,000 characters
- the model is in a vision-capable Claude family: claude-opus-4, claude-sonnet-4, claude-haiku-4 or claude-fable-5
The pxpipe-proxy package is installed into kRouter's data directory the first time it is needed. PXPIPE runs last, after the other savers, and gives up after 15 seconds.
- Default: off
- Fails open: an error, a timeout or a missing install leaves the request unchanged
Order and exceptions
On each request the savers run in this order: RTK, then Caveman or Ponytail, then Headroom, then PXPIPE.
They are all skipped in two cases:
- The client sends
X-9Router-Token-Saver: off. Use it for a debugging call or anywhere byte-exact context matters, without touching the global switches. - Claude Code is talking to the Claude Code provider directly. Any change to the request would break Anthropic's prompt cache for that conversation.
Response cache
Separate from the savers, and also off by default: the response cache answers an identical, non-streaming request from memory for 300 seconds. It is described in Core concepts.
Where to go next
- Architecture: where the savers sit in a request's path
- Combos & fallback: put cheaper models behind the same name
- RTK in detail: how the tool-output filters work