Skip to main content
kRouter

Token Savers: RTK, Caveman, Headroom, PXPIPE

kRouter ships four independent token savers that compress input, output, and context. Here is what each one does, how much it saves, and how they stack.


kRouter ships four independent token savers. Each targets a different part of the request, each fails open (a broken saver never breaks a request), and they all stack. Together they routinely cut a heavy agentic session's token cost by more than half.

The four savers at a glance

SaverCompressesTypical savingsHow
RTKInput (tool results)20–40%Lossless compression of tool_result content
Caveman ModeOutputup to 65%Terse-response prompt injection
HeadroomContext / historyup to ~92%De-dup + compress repeated context
PXPIPEContextvariesRenders bulky context as dense PNGs

RTK Token Saver

RTK losslessly compresses tool_result content — git diff, grep, find, ls, tree, dedup-log — before the request reaches the LLM. Agentic tools dump huge command outputs into context; RTK shrinks them without losing information the model needs.

  • Compresses: input tokens
  • Savings: 20–40% on tool-heavy requests
  • Default: on
  • Fails open: yes

RTK is the always-on baseline. If you do nothing else, leave RTK enabled.

Caveman Mode

Caveman Mode injects a terse-response instruction so the model stops padding answers with filler. It ships in three variants:

  • Lite — trims obvious filler

  • Full — aggressively terse

  • Wenyan — maximal compression, classical-Chinese-style density

  • Compresses: output tokens

  • Savings: up to 65% on verbose responses

  • Default: off (it changes response style, so it is opt-in)

Use Caveman when you want answers, not essays — code review, quick lookups, agentic steps where prose is wasted tokens.

Headroom

Headroom de-duplicates and compresses conversation context — repeated file contents, large tool outputs, long histories — before the request leaves your machine. On code-heavy requests it has been measured at 92.4% reduction (27,187 → 2,056 tokens).

It runs as an external Python proxy:

# Base proxy plus the compression extras that do the real work
pip install "headroom-ai[proxy,ml]"

Then enable it in the dashboard's Token Saver page. kRouter manages the proxy lifecycle (start / stop / restart / install extras) and POSTs your conversation to the proxy's /v1/compress endpoint, swapping in the compressed messages.

  • Compresses: context / accumulated history
  • Savings: up to ~92% on repetitive, code-heavy sessions (near 0% on plain prose — it finds redundancy)
  • Default: off
  • Fails open: yes — proxy down, timeout, or not installed returns the request untouched

See the Headroom deep-dive for the full walkthrough.

PXPIPE

PXPIPE renders bulky Claude-format context as dense PNG images, because images bill by pixels rather than encoded length. It runs last in the saver pipeline via the pxpipe-proxy library.

  • Compresses: context (as images)
  • Default: off
  • Fails open: yes — any error, timeout, or missing install returns the request untouched

PXPIPE and Headroom both target context; use whichever your provider handles best for your workload.

How they stack

The savers compress different things, so they compound:

  1. RTK shrinks each tool result as it enters context
  2. Headroom (or PXPIPE) collapses the accumulated, repetitive history across turns
  3. Caveman trims what the model writes back

On a long Cline or Cursor session, running RTK + Headroom + Caveman together is how a $200/month token habit drops to single digits.

The per-request bypass header

Sometimes you need one request to skip all compression — a debugging probe, or a call where byte-exact context matters. kRouter supports a per-request token-saver bypass header so you can opt a single call out of the entire saver pipeline without disabling anything globally.

  • Everyone: RTK on (it is the lossless baseline)
  • Heavy agentic users: add Headroom for context de-dup
  • Terse-answer workflows: add Caveman (Lite or Full)
  • Debugging a specific call: use the bypass header, not a global toggle

Get started

npm install -g @sifxprime/krouter
krouter -t

Token savers live in the dashboard at http://localhost:20128/dashboard. See /docs/combos for pairing savers with fallback routing, or /install to get running.