One agent, several models
The plan was simple: an agent that takes the morning and evening work off my hands, and one big model that can do everything. So everything ran through deepseek-v4-pro:cloud. Briefing, YouTrack digest, security check — all the same model. Convenient, but for a long time I never actually read the bill.
The token eater I didn't see
When I finally started tracking usage — a few Python scripts querying the Ollama API — there was a number I hadn't expected: the heartbeat, the small status job that checks whether everything is still running, caused 47 percent of the total token consumption.
The reason was mundane. The heartbeat ran every 15 minutes, day and night. Each run sent the entire context to a big model, and the big model computes expensively. 24 hours times four runs times a large context window — it adds up without any visible work coming out of it.
Measure first, then optimize
So the first step wasn't moving to another model, it was visibility. Three small scripts do the job since then:
- One counts consumption per model and day.
- One breaks the tokens down per cron job.
- One looks at the history so I see trends, not just snapshots.
Without those numbers I would never have noticed that the most unremarkable job was the most expensive one.
The fix: tasks in tiers
After that the fix was obvious. I now split tasks into two classes:
- Heavy jobs — the morning briefing, the YouTrack digest — keep running on the big model (
deepseek-v4-pro:cloud). I want quality there, not the economy setting. - Light jobs — everything else — run on
glm-5.3-flash:cloud. Smaller, faster, cheaper, and more than enough for a status check.
The heartbeat was also moved from every 15 minutes to hourly. A status job doesn't need to run more often than my environment actually changes. That alone cut the consumption of the most expensive job by a factor of four — before a different model even came into play.
What I take away from it
The lesson is not a new one: measure first, then optimize. But it still caught me, because I was looking for the error in the wrong place. I thought the big model was the problem. The problem was that a small job was running on the big model at all — four times an hour.
The best way to cut token costs is not to pick a worse model. It's to put the right task on the right model. And to do that, you first have to see who is actually consuming the tokens.