Maksym Prokopov
Personal blog powered by a passion for technology.

How to Save 60-90% of LLM Tokens with rtk Proxy

16.07.2025
Reading time: 3 min.

If you use Claude Code (or any LLM coding agent), you’re burning tokens on noise. Every git status, every ls, every test run sends the full unfiltered output into your context window. Most of it is useless.

rtk (Rust Token Killer) is a CLI proxy that sits between your LLM agent and shell commands. It filters and compresses output before it hits the context. The result: 60-90% fewer tokens on common dev operations.

The problem

A typical 30-minute Claude Code session consumes ~150,000 tokens. Most of that comes from verbose command output:

  • git diff dumps entire file contexts when the LLM only needs the changed lines
  • cargo test / npm test output thousands of lines when only failures matter
  • ls and tree produce bloated listings
  • git log includes way more detail than necessary

How rtk works

Instead of running git status, the agent runs rtk git status and gets a compact version. Same information, fraction of the tokens.

Some examples:

rtk git status    # compact status
rtk git log       # one-line commits
rtk git diff      # condensed diff
rtk test cargo test  # failures only (-90% tokens)
rtk read file.rs  # smart file reading
rtk ls .          # token-optimized directory tree

For operations like git add, git commit, and git push, rtk returns just ok ✓ instead of verbose confirmation messages. That alone saves 92% on those commands.

Real savings

Operation Standard tokens With rtk Savings
ls / tree (10×) 2,000 400 -80%
cat / read (20×) 40,000 12,000 -70%
git status (10×) 3,000 600 -80%
git diff (5×) 10,000 2,500 -75%
npm test / cargo test (5×) 25,000 2,500 -90%
Total ~118,000 ~23,900 -80%

That’s a 30-minute session going from 150K to 45K tokens. On a Claude Pro plan, that’s roughly 3x more coding per dollar.

Setup

Install via Homebrew:

brew install rtk

Or the quick install script:

curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

Then initialize for Claude Code:

rtk init --global

This installs a hook that transparently rewrites commands through rtk. Claude Code doesn’t need to know anything — it runs git status as usual, and rtk intercepts it.

Tracking your savings

rtk tracks every command and shows you the numbers:

rtk gain          # summary stats
rtk gain --graph  # ASCII graph of last 30 days
rtk gain --daily  # day-by-day breakdown

You can also export to JSON or CSV for dashboards.

Why this matters

LLM token costs add up fast, especially with agentic coding where the model runs dozens of commands per session. The context window is finite — filling it with verbose test output or git diffs means the model loses track of what it was actually doing.

rtk is a single Rust binary with zero dependencies. It doesn’t change how you work. It just makes every command output leaner. If you’re spending real money on Claude Code or similar tools, this is low-hanging fruit.

Check it out: github.com/rtk-ai/rtk