Back to all guides

How I Cut My AI Coding Costs by 80% With One Simple Tool

A beginner-friendly guide to RTK, the Rust CLI proxy that compresses shell output before it reaches your AI agent, saving 60-90% on token costs with zero workflow changes.

Published
May 29, 2026
Reading time
6 min read

How I Cut My AI Coding Costs by 80% With One Simple Tool

Your AI coding agent is burning money on noise. Every git status, every test run, every directory listing sends thousands of tokens back to the model. Most of that text is junk. Progress bars. Repeated log lines. Timestamps you will never read.

One developer measured this. A thirty-minute session with Claude Code consumed 118,000 tokens from routine shell commands alone. That is not the model thinking. That is the model wading through boilerplate.

There is a fix. It takes sixty seconds to install. You do not change how you work. You do not learn new commands. You just pay less.

What Is RTK?

RTK stands for Rust Token Killer. It is a tiny program that sits between your terminal and your AI agent. When your agent asks for git status, RTK intercepts the output, strips the noise, and sends back a compact version. The agent gets the same information. You get a smaller bill.

Think of it like a spam filter for your terminal. You still receive every email that matters. The junk goes straight to trash.

The tool is written in Rust. It ships as a single binary with no dependencies. You do not need Python. You do not need Node.js. You do not need Docker. One file runs everywhere.

Why This Matters

AI coding tools charge by the token. Every word the model reads costs money. When the model parses a two-hundred-line test output just to find three failures, you are paying for one hundred ninety-seven lines of waste.

Here is what that looks like in practice.

A standard git status command returns around fifteen lines. It lists every modified file with permission bits, timestamps, and formatting. RTK compresses that to a single line: ok main. The agent knows the branch is clean. You save two hundred tokens.

A test runner output with two hundred passing tests and three failures sends all two hundred test names to the model. RTK shows only the failures with their stack traces. The passing tests become a count. Ninety percent of the tokens vanish.

These savings add up. Fast.

The Four Things RTK Does

RTK applies four simple ideas to every command.

Smart filtering. It removes comments, whitespace, and boilerplate that carry no meaning. Your ls output no longer includes permission bits from 2019.

Grouping. It clusters similar items. Instead of listing forty-seven component files one by one, it says components/ (47 .tsx files). The model knows the size of the directory without reading every filename.

Truncation. It keeps the important parts and drops the middle. A long build log preserves the error at the bottom and the command at the top. The three hundred lines of successful compilation become a summary.

Deduplication. It collapses repeated lines. If your Docker logs show the same warning five hundred times, RTK sends one line with a count. The model sees the warning once. It understands the scale instantly.

Real Numbers From Real Sessions

The RTK team published benchmarks from a typical thirty-minute Claude Code session on a medium-sized project.

Command

Without RTK

With RTK

Savings

ls / tree

2,000 tokens

400 tokens

80%

cat / file reads

40,000 tokens

12,000 tokens

70%

grep / search

16,000 tokens

3,200 tokens

80%

git status

3,000 tokens

600 tokens

80%

git diff

10,000 tokens

2,500 tokens

75%

test runners

25,000 tokens

2,500 tokens

90%

Session total

~118,000 tokens

~23,900 tokens

~80%

These are not hypothetical numbers. They come from actual command logs. One developer reported saving 130 million tokens across fifteen thousand commands. Another cut a two-hour session from 1.42 million tokens to 287 thousand. That is a five-fold difference for the same work.

How to Install RTK

Installation takes one command.

For macOS and Linux, use Homebrew:

bashShiki server render
brew install rtk

Or run the install script:

bashShiki server render
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | sh

For Windows, download the pre-built binary from the releases page and add it to your PATH.

After installation, initialize RTK for your AI tool:

bashShiki server render
rtk init --global    # For Claude Code, Copilot, Cursor

Restart your AI agent. That is it. From now on, every Bash command your agent runs passes through RTK automatically. You do not prefix commands with rtk. You do not change your prompts. The hook handles everything behind the scenes.

What If Something Breaks?

A common worry: what if RTK hides an important error message?

It does not. When a command fails, RTK saves the full raw output to a local file. The compressed output includes a path to that file. If the model needs more detail, it reads the complete log without re-running the command.

You can also disable RTK for a single command:

bashShiki server render
RTK_DISABLED=1 git status    # Runs the raw command

Or exclude specific commands permanently in the config file.

The Efficiency Bonus

Here is something the benchmarks do not capture. When your agent receives clean output, it performs better.

A context window full of noise is like trying to think in a crowded room. The model spends tokens parsing irrelevant text instead of reasoning about your code. With RTK, the context stays lean. The agent focuses on what matters.

One user noticed their agent stopped suggesting commands for tools that were not installed. The agent became familiar with the available commands because it saw clean, consistent output. Fewer failed attempts. Fewer wasted tokens.

Your Next Step

Install RTK. Run your next coding session. Then type:

bashShiki server render
rtk gain

This command shows your exact savings. It counts every command, every token saved, and every dollar kept in your pocket.

If the number surprises you, you have found the leak. If the number is small, you have ruled out a major hypothesis and can look elsewhere.

Either way, you know. And knowing is the first step to fixing it.

One Last Thing

RTK is free and open source under the Apache 2.0 license. It has fifty-six thousand stars on GitHub and a community of developers who use it every day. The project is actively maintained with regular releases.

Your AI agent is already fast. RTK makes it cheap. And that combination is hard to beat.