Weekly
Get a weekly token report by model
Every Monday you see how many tokens each model and each API key used, next to the week before.
- Runs
- Weekly
- Apps
- Anthropic API
- AI
- Not needed
- Access
- Admin API key
Send this to your assistant
Create a ClickRuntime automation: every Monday at 9am, email me last week's Anthropic API token usage per model and per API key, compared with the previous week.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A developer team ships a support bot on Claude Sonnet, then adds a summarizer, a classifier and a nightly batch job, all sharing a handful of API keys. The monthly Anthropic invoice rises, and nobody can say whether the cause is the new feature, a runaway loop or one engineer who left the most expensive model as the default. The Console shows totals, but nobody opens it until finance asks a question.
Each week, ClickRuntime queries the Anthropic usage report in daily buckets, grouped by model and API key. It compares the totals with the figures it stored the week before and emails you a table. The table shows tokens per model, tokens per key and the change since last week, so a jump is easy to spot.
It suits engineering leads and founders who pay the API bill but do not want another dashboard to check.
What you get out of it
Cheaper models get used where they fit
When the table shows a classifier burning most of its tokens on the largest model, you have a concrete reason to test a smaller one. The saving comes from a specific change, not a vague plan to optimize.
A runaway loop shows up within days
A retry bug can multiply token use tenfold on one key. The week-over-week column makes that spike obvious in the next email instead of on the following invoice. Catching it early limits the damage to a few thousand tokens.
Costs trace back to one key
Each API key usually maps to a service or a person. Seeing tokens per key tells you which project is driving spend before you have to argue about how to split the bill.
Budget talks start from numbers
When finance asks why the API line grew 40 percent, you can answer with a model-level breakdown from the last several Mondays rather than a guess pieced together after the fact.
Model migrations get measured
After you move a workload to a newer model, the next table shows whether token volume on the old model actually fell. Finished migrations stop quietly costing money on leftover traffic.
How it works
What happens, step by step
Every Monday, ClickRuntime fetches the last 7 days of Anthropic API usage.
It adds up the tokens used for each model and API key.
It compares each figure with the previous week, which it saved last time.
You get an email listing each model and key with this week's tokens next to last week's, biggest first.
Before it runs live
- Connect Anthropic API
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Anthropic API steps into one automation
Under the hood
The code that runs this automation
from collections import defaultdict
from datetime import datetime, timedelta, timezone
from clickruntime import on_trigger, credentials, notify, http, state
@on_trigger
def run(event):
end = datetime.now(timezone.utc).replace(hour=0, minute=0, second=0, microsecond=0)
resp = http.get("https://api.anthropic.com/v1/organizations/usage_report/messages",
headers={"x-api-key": credentials.secret("ANTHROPIC_ADMIN_KEY"), "anthropic-version": "2023-06-01"},
params={"starting_at": (end - timedelta(days=7)).isoformat(), "ending_at": end.isoformat(),
"bucket_width": "1d", "group_by[]": ["model", "api_key_id"], "limit": 7})
resp.raise_for_status()
usage = defaultdict(int)
for bucket in resp.json()["data"]:
for r in bucket["results"]:
usage[f"{r['model']} / {r['api_key_id']}"] += r["uncached_input_tokens"] + r["output_tokens"]
previous = state.get("last_week") or {}
lines = [f"{k}: {v:,} tokens (previous week {previous.get(k, 0):,})"
for k, v in sorted(usage.items(), key=lambda kv: -kv[1])]
notify.email_me("Anthropic token usage, last week", "\n".join(lines) or "No usage last week.")
state.set("last_week", dict(usage))
return {"rows": len(lines)}FAQ
Common questions
Does the report need an Admin API key?
Are the numbers per day or per week?
Can I send the table to a team channel instead of my inbox?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a cited research brief every morning
Each weekday you get a few bullet points on what changed in your topic, each with a source link, and nothing you've already seen.
See how it worksGet warned when API spend runs high
If yesterday's Anthropic API cost went over your limit, you get an email showing which workspace spent it.
See how it worksGet a daily digest of your feeds
Each morning, new posts from the sites you follow arrive as one short summary, written by the model you chose.
See how it worksKeep exploring
Set up “Get a weekly token report by model” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.