Medium · Who does what, and one door for every model call
Counting what each call spends
Requests come in very different sizes, so counting them is not enough. A model reads and writes in small pieces of words, and each piece is a token. The AI gateway counts tokens for each helper, against its budget. A helper that runs past its budget is stopped, and Milo is told which one.
Example
One Maple Mart day, counted by the AI gateway shift helper 200 short questions 20,000 tokens news helper 2 long summaries 90,000 tokens The news helper’s budget is 100,000 tokens a day. At the limit, it is stopped and Milo gets a note naming it. Fix: summarize only the new messages.
Try it Yourself
Which helper spent more tokens: the shift helper or the news helper? Type the name.
Exercise
An order fails at Maple Mart. Where do you look?