Section Insights
Transitioning from OpenAI to Open Router
What challenges did the team face with Hermes and how did they address them?
The team initially faced usage limits with OpenAI's GPT models due to multiple users on Hermes. They switched to Open Router to eliminate these limits but encountered high costs due to token usage, primarily from incorrect task setups. They sought to reduce costs without compromising output quality by adjusting settings.
- Usage limits on OpenAI prompted a switch to Open Router.
- Open Router's token-based pricing revealed unexpected costs.
- Most costs stemmed from incorrect task setups rather than active usage.
- The team aimed to optimize settings to reduce costs while maintaining quality.
Understanding Token Usage
How can users track and manage their token usage in Hermes?
Hermes allows users to track token usage through a database that logs all sessions and costs. Users can request detailed breakdowns from agents, which include insights on spending patterns and token consumption from various tasks.
- Hermes provides a database for tracking token usage.
- Users can analyze spending patterns and session details.
- Understanding token consumption helps in budget management.
Optimizing Model and Task Management
What strategies can be employed to reduce token consumption?
Users can assign cheaper models for simpler tasks and sub-agents to save on token costs. Adjusting the effort level of the model based on task complexity can also help manage expenses effectively.
- Assign cheaper models for less complex tasks to save tokens.
- Sub-agents can be set to use lower-cost models.
- Adjusting the effort level of the model can optimize token usage.
Managing Context and Memory
How can users control the context and memory usage in Hermes?
Users can adjust the target ratio for context retention and limit the amount of tool output included in the context. Using ephemeral system prompts for one-time instructions can also help manage token usage effectively.
- Lowering the target ratio reduces context size and token usage.
- Ephemeral prompts prevent unnecessary context bloat.
- Trimming memory files can optimize performance and reduce costs.
Implementing Hard Limits for Token Management
What hard limits can be set to control token usage in Hermes?
Users can set maximum token limits for model outputs and reduce the maximum number of turns an agent can take. This prevents excessive token consumption during complex tasks and encourages more concise responses.
- Setting max token limits helps control output costs.
- Reducing max turns prevents agents from wasting tokens on confusion.
- Implementing hard limits can streamline task management and reduce expenses.
Transcript
0:00 Ever since we got our hands on Hermes, we've built a ton of workflows on it. And for the longest time, we ran all of it on GPT models through our OpenAI subscription. That worked fine at first, but our whole team uses Hermes and everyone's got their own flows set up. And with that many people using it at once, we kept running into the usage limits. That would make our work just stop. So, we moved over to Open Router.
0:20 That did fix the limit problem we were facing, but it led to a new one. Open router charges for every single token. And for the first time, we could see exactly what Hermes was costing us. The number was way higher than we expected. And the strange part was that most of it wasn't coming from us actively using it. Most of it was coming from tasks people had set up incorrectly. So, we set out to cut that bill down, but we weren't ready to compromise on output quality.
0:45 So, we went through all the settings and found the ones that cut the cost without making Hermes any worse. And if this is your first time here, we're a software company and this is our channel AI Labs where we show you how to optimize your processes with AI just like we've optimized our own. So in this video, we're going to go over every single setting we changed, how that changed our workflow and how much it actually saved us. Before we get into saving costs on Hermes, we first need to figure out what's actually eating the tokens. What you pay for Hermes comes down to how many tokens it uses. And tokens are basically the building blocks of words the model reads and writes. Every model builds on the tokens you put in and the tokens you get back. But the input isn't just your prompt. It also covers the system prompt and the whole conversation you've had so far, along with a few other things that get sent with every message. That includes the header of each skill you've added, which is basically its name and description that's always loaded, plus the MCP tools you've set up and the memory and user files. All of this adds to your input tokens, and the skills are a big part of that. Hermes comes pre-installed with 90 skills, and that number only grows the longer you use it. That's because it turns any workflow worth reusing into a new skill. So, every one of them adds to your per message cost. And it isn't only the skill headers. Hermes scans your conversations for chances to build a new skill. And that burns tokens, too.
2:00 Hermes also has a self- evvolving memory. It's constantly going through your conversations to pull out specific details about you, and it writes those to memory. It updates that memory on its own so it can hold context about you and tailor its future answers. And none of this is free because the evolving skills and the autoupdating memory are both burning tokens that you end up paying for. Another big one is that Hermes runs 24/7. It isn't an agent you start once and let run a single time the way we do with Claude Code. You can run it on a local server like the one we've already set up for our team or on a VPS, which is basically a server you rent and run yourself so the rest of your team can reach it. Because Hermes is always on, there are a lot of tasks running in the background. Those are what pushes your usage up. if you don't keep them in check. A single run of one of those tasks is cheap. But once it keeps repeating or you've got a lot of similar jobs set up, the cost piles up. On top of that, the MCP tools and hooks you've set up are also loaded into the context window, so they run up tokens, too. And if you're running goals on Hermes, that cost you money, too. The good thing is Hermes gives you a way to track all of this. It stores every bit of token usage data in a database in the root folder and you can ask any agent you're working with to go through that database and hand you a detailed breakdown. The agent can go all the way back through the database to when you first installed Hermes. From there, it can tell you how many sessions you've run, how many tokens you've used, and what it's all cost. It'll lay out your spending in detail so you can sit with Claude and figure out how to manage your budget better. Hermes also has an insights command that does pretty much the same thing. It gives you a cost breakdown of the last 30 days and it tells you what each part is using and which tools and skills you've used the most. It even shows your activity patterns and your longest sessions. So now you know what's eating the tokens. Let's start with the single biggest one which is the model itself. The model you've connected Hermes to drives most of your bill.
3:53 Hermes gives you a lot of models you can connect to. So if you already pay for a subscription like the codec subscription we have, you can run Hermes straight through it. Once that's set up, you're paying through the subscription you already have with no extra cost stacked on top. Now, you might want to do the same with Anthropic or Gemini's subscription, but even though Hermes lists them as available, they actually aren't, and you can't use Claude code directly. You need a separate API for that because both of them count using their subscription this way as breaking their policy. So, for now, the codec subscription is your best option. We started out on the OpenAI subscription ourselves, but we ended up switching to Open Router because it let us reach a lot more models under a single API key and it was best for companywide use. So, if you're on Open Router like us, you can save costs by using the Parto router. It looks at what your task actually needs and routes it to the right model for the job. It's got 13 models split across different tiers from cheap and basic up to expensive and powerful. Beyond the provider, there are settings in your config.yaml YAML file that help you save tokens. Hermes runs a lot of background tasks and by default the model for these is set to auto. That means it falls back to your main model even for the small stuff. These are called auxiliary tasks. Basically the small background jobs Hermes runs and they don't need the heavy reasoning your main model is built for. Things like reading images, searching across your skills, loading MCP tools, and writing a profile description all run fine on something lighter. So you can point those tasks at a cheaper model and that way your main model isn't burning expensive tokens on simple stuff. The same idea applies to sub aents which we covered before. Hermes can spawn multiple sub aents and hand them tasks.
5:30 Each one runs in its own context window and works on its own. But that's tokenheavy because every sub aent is basically its own session that only reports its findings back. So the cost adds up fast. So you can set a cheaper model for sub aents and you'll save every time one gets spun up. Whatever model you use, there's one more thing worth tweaking, and that's the effort level. It's basically how much the model thinks before it answers. If you turn it all the way up to max, you do get better output, but you also burn through more tokens. So, it ends up costing you more.
6:00 So, you want to match the effort level to the task you're doing. And when that task is a simple one that doesn't need much reasoning, you can switch thinking off completely. But before we move forwards, let's have a word from our sponsor, Luma. If you do creative work, the real bottleneck isn't ideas. It's juggling eight different AI tools for one project and losing half your day just managing them. Luma fixes that with aentic AI. Regular AI just assists you, but Luma's agents actually create with you and they understand the physical world, how things move, behave, and exist in space, not just pixels. You bring the taste and the direction, and the agents orchestrate everything under the hood, holding context across the whole project and pulling in the right models for each step. From the first idea to the final cut, the agents keep the whole project moving. And it's never one prompt, one output. You shape the work with them turn by turn, refining as you go, so you can explore 10 times more ideas without 10 times the work with the best models all in one place instead of 10 scattered tabs. Create with Luma. Get early access at the link below or scan the QR on screen. But the model isn't the only thing running up your tokens.
7:03 The context window does, too. Your Hermes agent comes with a whole set of tools and skills. And every message you send carries all of that along with it, plus the entire conversation history you've built up so far. The longer a conversation runs, the more history there is to send each turn, and the context window keeps growing fast. So, it's a good habit to hit compress often. What that does is start a fresh session built on a summary of everything that's happened so far. You save a lot of tokens, and the model still keeps the context of the conversation, just in a much leaner form. By default, the compression threshold is set to 50%, which means Hermes will compress the conversation once half of the context window has been filled. You can adjust this value, and in most cases, it's better to keep it on the lower side.
7:44 Doing that reduces the number of messages that need to be sent with each turn, helping keep context usage efficient and lowering the cost of every message. After compressing, Hermes also leaves a bit of the tokens uncompressed and adds them on to keep more context. And that's what it calls the target ratio. You can set it to a lower percentage so less of the old conversation carries over into the context window and fewer messages get sent with each turn. You can also control how much of each tool result actually enters the context. Back when we were on the OpenAI subscription, we set those values high so Hermes wouldn't miss details when tool output got cut off like we covered in the previous video. But once we moved to Open Router, we had to watch cost more closely. So we brought those values back down. If you've got a one-time instruction that you only need for a single session, don't write it into the Hermes context files. Instead, you can use an ephemeral system prompt, which basically just adds it to that one session and nothing more.
8:39 That way, you can use the instruction without it wasting space in the context files. And if you're running local systems like a second brain, as we showed you before, you want that information organized properly. That way, the agent can load it bit by bit as it needs it instead of pulling in extra tokens it doesn't need. Beyond the files you create yourself, you can also trim down the files Hermes leans on, like the memory files and the agent files. These sit in your context window the entire time, so the smaller they are, the less they're putting in front of the model on every message. Hermes also lets you switch off its automemory feature, which stops it from collecting memory and stops the memory files from landing in your context window. That saves you money since fewer tokens go out with every message. But turning automemory off means giving up one of the features that makes Hermes so good in the first place. So in our own workflows, we keep it on even though it costs us. We want it pulling in details about our company and sharing that context across the whole team since everyone's using it through Slack. When Hermes does get something wrong, don't just prompt it again. Use the undo command to step back one message. It isn't a full rewind that walks back through several messages, but it does let you undo the most recent one. That's the better move because from there you can give it a fresh prompt that spells out what went wrong and what to avoid. And if you're enjoying the video so far, subscribe to the channel and hit the hype button. This small gesture of support goes a long way for us. Trimming all of that brings your usage down and your tools are the next thing to look at. Every tool your agent has access to is also sent with each message as part of the context window.
10:09 So it pays to cut the tools you don't actually use. Hermes comes with more than 17 tools and you can see all of them with the Hermes list command. To disable one, you can either go through the desktop app or run the tools disable command with the name of the tool you want to turn off. For example, the AI labs profile we set up for the whole team wasn't doing any work on code bases. So, we didn't need code execution there at all. We keep a separate profile dedicated to that. We disabled it along with any other tools we weren't using.
10:37 So, none were left in the context for no reason. Hermes also ships with a lot of skills, and most of them are ones you'll probably never use, so you can turn off every skill you don't need. Your skill list ends up holding only the ones you actually use instead of a long list that just sits there and bloat the context. The same goes for your MCP servers. Each one you connect brings its own set of tools into the context window. So, disconnect any servers you're not actually using. And for the ones you keep, make sure tool search is set to auto. It works like the tool search feature in Claude. It loads a tool only when it's actually needed instead of keeping all of them in the context window the whole time. If yours isn't on auto, switch it over so you're not wasting tokens and you get the most out of the ones you do spend. Hard limits are another way to keep your token usage down. They cap how much the agent can do before it has to stop. The first one is setting the model's max tokens to a specific number, which controls how many tokens it can produce as output. That saves you on output costs and pushes the model toward tighter answers instead of rambling. By default, the agents max turns are set to 150. That means while it's working on a task, it can take up to 150 turns to think, call tools, read the outputs, and weigh the results before it's done. The trouble is that when the agent gets confused, it can burn through all of those turns, rescending the whole context while it tries to solve something. So, you can drop this to something lower. We set ours to 60 so the agent doesn't waste turns spinning on a problem it's stuck on. There's another setting worth turning on that guards against looping.
12:06 You can switch the hard stop setting from false to true, which keeps the agent from looping for no reason. So, when it gets stuck and isn't making progress, the hard stop kicks in and stops it before it keeps grinding away. Then there are your cron jobs. Basically, tasks that run on their own on a schedule, which have no limit set on their max turns by default. You can set that to a specific number, so there's a cap on how many turns a chron job can take. that keeps background jobs from running up tokens and it stops them from eating up cost forever. Now, in order to get started with Hermes Agent, we have curated a whole starter pack that's available in AIABS Pro, which is our community. That's where you'll get the resources, the starter packs, and more along with a place to interact with a bunch of like-minded people, including our team. So, if you found value in what we do and want to support the channel, this is the best way to do it. The links in the description. That brings us to the end of this video. If you'd like to support the channel and help us keep making videos like this, you can do so by using the super thanks button below.
13:03 As always, thank you for watching and I'll see you in the next one.
Summary
- Transitioned from OpenAI to Open Router to eliminate usage limits but faced high token costs.
- Most costs stemmed from incorrectly set up tasks rather than active usage.
- Found that background tasks, evolving memory, and numerous skills contribute significantly to token usage.
- Adjusted settings in the config.yaml file to use cheaper models for auxiliary tasks and sub-agents.
- Implemented a compression strategy to manage context window size and reduce token usage.
- Disabled unused tools and skills to streamline the context window and minimize unnecessary token consumption.
- Set hard limits on token usage for models and cron jobs to prevent excessive costs.
- Utilized insights commands to track and analyze token usage for better budget management.
Questions Answered
What challenges did the team face with Hermes and how did they address them?
The team initially faced usage limits with OpenAI's GPT models due to multiple users on Hermes. They switched to Open Router to eliminate these limits but encountered high costs due to token usage, primarily from incorrect task setups. They sought to reduce costs without compromising output quality by adjusting settings.
How can users track and manage their token usage in Hermes?
Hermes allows users to track token usage through a database that logs all sessions and costs. Users can request detailed breakdowns from agents, which include insights on spending patterns and token consumption from various tasks.
What strategies can be employed to reduce token consumption?
Users can assign cheaper models for simpler tasks and sub-agents to save on token costs. Adjusting the effort level of the model based on task complexity can also help manage expenses effectively.
How can users control the context and memory usage in Hermes?
Users can adjust the target ratio for context retention and limit the amount of tool output included in the context. Using ephemeral system prompts for one-time instructions can also help manage token usage effectively.
What hard limits can be set to control token usage in Hermes?
Users can set maximum token limits for model outputs and reduce the maximum number of turns an agent can take. This prevents excessive token consumption during complex tasks and encourages more concise responses.