AI Income LabJoin AI Income Lab ↗

RTK token savings in Claude Code, Codex and OpenCode

Jump to video chapters

Watch on YouTube ↗ Subscribe on YouTube ↗

By · · 7:31 · 518 views

Written guide: RTK Token Savings: Install, Hooks and Checks

Install RTK, a free open-source tool that compresses command output before it reaches a coding agent's context, and connect it to Claude Code, Codex and OpenCode. Mike's own readings show about 57 to 65 percent token savings, with 120,000 tokens saved in one session and 169,000 in OpenCode. The 60 to 95 percent in the intro is RTK's claim. Headroom, a proxy dashboard, was removed after connection problems.

Video summary

RTK tutorial — reduce Claude Code tokens without changing your whole workflow.

The video covers 11 parts: Introduction & RTK Token Savings, Proof: Checking Token Efficiency, Quick Installation via Curl & Brew, Adding RTK to Coding Harness Configs, Comparing RTK with Headroom Proxy, Initializing RTK Hooks (rtk init), RTK vs Caveman Skill, Analyzing Savings Breakdown (rtk gain), Setting Up RTK in OpenCode, GLM 5.2 Token Reduction Test Results, and Conclusion.

What this video covers

What you build

An RTK install with hooks in Claude Code and Codex and an RTK plugin in OpenCode, checked with the rtk gain command.

Tools used

Compare pricing: OpenCode. Some ↗ links are affiliate links, so I may earn a commission or credit. See every tool I recommend →

Key steps

Not covered

Summary written from the video's transcript and chapters.

In this video

  1. 0:00 Introduction & RTK Token Savings
  2. 0:31 Proof: Checking Token Efficiency
  3. 1:28 Quick Installation via Curl & Brew
  4. 1:55 Adding RTK to Coding Harness Configs
  5. 2:40 Comparing RTK with Headroom Proxy
  6. 3:52 Initializing RTK Hooks (rtk init)
  7. 4:22 RTK vs Caveman Skill
  8. 5:04 Analyzing Savings Breakdown (rtk gain)
  9. 5:46 Setting Up RTK in OpenCode
  10. 6:20 GLM 5.2 Token Reduction Test Results
  11. 7:15 Conclusion

Questions and answers

How much does RTK save?

The tool claims 60 to 95 percent. Mike's own readings in the video are around 57 to 65 percent.

Do I need Headroom too?

No. Mike removed it because Claude Code had trouble connecting and calls RTK alone enough.

How do I check it is working?

Run rtk gain for the efficiency number, and rtk init to make sure the hook is present in your agent's config.

Transcript

Hey there, welcome to the channel. In this video, I'm going to be showing you how to save 60 to 95% in token consumption inside Claude Code and Codex using a free plugin that is available on GitHub called RTK. I've got the website pulled up here. It allows you to compress command outputs before they reach the context window for better reasoning, longer sessions, and lower cost. If you don't believe me, I'll show you the proof right now. I've got it running over here inside the terminal.

And as you can see, my token efficiency is 61%. I've currently saved 120,000 tokens and I've run this multiple times. And you can see the result is roughly the same. It was 65%, 64% now 58%. If I go ahead and run it again, we're at 57% token efficiency and it's all running directly from within the terminal connected up to Claude Code as well as Codex over here. So, we're saving a boatload of credits just by using this free extension which you can install on GitHub.

Read the rest of the transcript

This currently has 71,000 stars and I'll show you exactly how to get started with RTK. But before I do, please go ahead, subscribe to the channel and also check out my free Skool community. We've currently got almost 3,000 members over here. Feel free to introduce yourself inside the community tab. And with that being said, let's continue the tutorial. So, in order to get started, all you have to do is run this git command over here.

It's just a oneline curl command that you're going to copy and paste into your terminal. I already have it installed, so it doesn't need to run it again. Also install this with brew. All you have to do is run this one command brew install RTK inside your terminal or if you're on Windows inside the PowerShell, whatever you're using, and that's just going to download it. And now you're good to go.

From here, it's just a simple matter of coming into whatever coding harness you use and just saying add RTK to the Claude Code config file or Codex or OpenCode. And that way I can save even more credits inside OpenCode as well. And ultimately, this is going to make a big difference because it will allow me to get a lot more coding tasks done on a daily basis. I can already tell that it's making quite a big difference.

I'm currently using Sonnet 5 and I've used way fewer credits than usual for this amount of time. And we should be able to see a lot of those savings over here as well. But for now, I'm just using the RTK command line. In order to do that, you just run RTK gain and it will show you exactly what your current token efficiency is.

Another thing that you could do is you can combine this with something like headroom which provides a graphical user interface to see exactly what sort of credit usage you're currently hitting. And this just runs on port 8787 and it allows you to visualize, you know, how many credits you're saving on a day-to-day basis. I re recently used this for the first time and I noticed that for some reason Claude Code wasn't able to connect to it properly and I was having a lot of issues with

it. So I decided to just completely remove it because it's honestly more trouble than it's worth in my personal opinion and it's not really necessary to run this through a proxy. You could just install RTK and then you don't have any of the overhead provided by headroom. But this one currently has 60,000 stars. And it is nice to have something like this where you could just easily preview how many credits you're saving inside your coding harnesses or you could just use RTK.

And I think they also have a desktop app over here as well. Uh or you could just run it in the terminal. It's also available for cursor and other command line interfaces. You can install it with Homebrew. And then pretty much all you have to do is just run the RTK init over here and that will just connect it up to your coding artices. So for example, if I just run RTKit G, that's just going to make sure that it's connected up inside the config files.

So the hook is already present inside Claude Code and it's just telling me to restart, which I've already done, and now it's connected up to uh Claude Code. They also have some more information over here on skills.com where you can read more details. And there is a competitor as well which is called caveman. This is just a custom skill that you install inside your coding harness. And this one also saves on credits as well. But honestly, I haven't used caveman all that much.

I really just like RTK for now. And like I say, this is going to save me a lot of credits so that I could get even more coding work done on a day-to-day basis. And already I can tell there's a big difference because normally I would have blown through all my credits by now on set 5. If I were to switch over to like Opus 4.8 on this as well, I would expect also big credit savings.

I look forward to putting this through the paces and seeing what it could do. Uh I've also gone ahead and asked how does my credit usage compare with and without RTK inside Claude Code and it showed me exactly how many tokens I saved. It says 61.6 six reduction, which is exactly what I was seeing over here inside the terminal. So, that's definitely encouraging. And it even shows me the biggest single win over here. 97.8% saved on these different commands.

And again, if I come over here, I can see that exact same details over here. So, I think Claude Code is basically just calling RTK gain and it's pulling back all of these results. So you can see there's very very significant gains to save credits using RTK and Claude code brings that back over here as well. I'm also continuing to build this into OpenCode over here as well so that I can save credits in OpenCode and it looks like OpenCode now has the RTA RTX plugin

installed as well. So this basically just built in the RTK OpenCode plugin. It's just telling me to restart OpenCode to load it. New sessions will auto prefix bash commands with RTK. It's got the plug-in file which already created. Uh RTK rewrite returns valid rewrites. So that's good. How many credits did I save with RTK? Something like that. And it should just get back right away. In this case, I'm using GLM 5.2, which is one of the heavier models coming out of China.

And again, you can see right here, 169,000 tokens saved. That's a 57.8% 8% reduction across 447 commands and it also shows some of the top wins here as well. You can see I'm getting a lot of good coding work done and I'm continuing to build out my latest project and yeah, it's just using RTK to compress all the tokens over here which is definitely useful.

Do yourself a favor, go ahead and install uh RTK and see your coding harnesses, especially if you're on the pro plan for $20 a month or the plus plan on Codex. it will save you a lot of credits and you can get a lot more coding work done. Hopefully enjoyed the tutorial. Please go ahead subscribe to the channel if you haven't already and I look forward to sharing more practical useful tutorials on this channel. Also, like I say, go ahead check out my Skool community.

We've currently got 3,000 members over here. It's completely free to join with paid plans available as well starting at $29 per month. Would love to see you inside the Skool community. With that being said, take care, stay safe. Peace from Thailand. We'll see you in the next one.

Not ready to join? Get the weekly build notes: new guides and tested builds in one short email.

You may also like