AI tips · No. 5
2026-10-13
Every vendor already has a usage counter you can read for free. Read it, then give the capacity you'd otherwise lose to a queue.
This replaces No. 3, which estimated usage from tokens and my own readings. Using an AI agent? Point it at this page; there is a section for it at the bottom.
The problem
I pay for four AI plans: Claude, ChatGPT (for Codex), SuperGrok and Google AI Pro. Each has a weekly limit
and most have a five-hour one, and every one resets on its own clock. For a month my meter estimated two of
them from token counts and the numbers I copied off /usage now and then.
Then I checked it. The meter said 53% of my Claude week was gone. Claude said 32%. It had the five-hour block ending at 18:30 when the real one reset at 22:19, because it could only see the sessions on one of my three machines. And Grok's week had quietly moved from Tuesday night to Tuesday morning, so the meter showed 30% used of a week that had already reset.
An estimate that far off is worse than none. I wanted to queue work for the spare capacity, and that only works if the number is real.
Ask the vendor
Each vendor's own command-line tool already knows the real numbers, because its usage screen has to show them. All four can be asked from a script, with the login you already have, for no tokens and no API key:
GET /api/oauth/usage on api.anthropic.com, with Claude Code's own login
token, which is the call /usage makes. It returns the five-hour session, the week, and the
per-model weekly limit, each with its percentage and exact reset time. /api/oauth/profile
names the plan: Max 20x, Max 5x, Pro.codex app-server and send it one JSON-RPC request,
account/rateLimits/read. Back come the five-hour and weekly percentages, the resets, and
planType. These are the server's numbers, so they include use from your other machines and
from ChatGPT's own apps.grok agent stdio and send _x.ai/billing. It returns the
weekly limit's percentage and the exact week, and _x.ai/auth/check_subscription names the
plan.agy -p /usage --output-format json reports the
weekly and five-hour windows of each model group. It doesn't name the plan.One script reads all four in about five seconds, every 20 minutes, and between reads the meter adds the tokens spent since. The plan names come through too. I change plans often, so the price of each one is looked up from the plan the vendor reports, and a plan the meter has never seen gets flagged instead of priced with a guess. The live numbers are on moraineworks.com.
The queue
A weekly limit that resets with room left is money spent on nothing. So I keep a queue of jobs, and each evening it spends what I haven't used, by one rule:
line = 10% × the day of that plan's week (counted from its own reset), at most 70%
room = line − what's already used
What bit
x.ai/billing answers "method
not found"; _x.ai/billing works.The result
The meter matches every vendor's own page, on every plan, and I no longer copy numbers off
/usage. The capacity that used to expire now goes to a queue that knows exactly how much it may
spend.
For your AI agent
This part is written for your agent. Paste something like this into Claude Code:
Read https://jacobkunselman.com/tips/real-usage-and-a-spare-capacity-queue/agent.md
and set up the real-usage readers for the AI plans I have. Then build the
queue, with its sandbox, but leave its timer off until I say.
agent.md is the plain-text spec: each vendor's call and the fields it returns, the safety rules, the budget rule, the sandbox, and acceptance tests. The reference files: