Your coding assistant's usage meter says you've burned 80% of the week's allowance, and it's Tuesday. The vendor's usage page shows a bar going up. What it doesn't show is why: which model, which kind of token, starting on which day.
The answer is often unglamorous. You switched to a pricier model, your requests carry a huge context, and most of that context is cached input. Cached tokens are cheaper per token, but some models charge a lot more for them than others. You only see that once the numbers sit next to each other.
Usually someone works this out once, with a spreadsheet or by asking an AI to chart a usage export, and then never looks again. This post is about making it a page you can glance at.
Why the usual tools miss it
- The vendor's usage page is built to show your remaining allowance, not to compare models or token types.
- A one-off chart from an AI assistant answers today's question and goes stale tomorrow.
- An observability stack can do it properly if you already run one. Setting one up to watch your own coding habits is a lot of yak for one person.
- A spreadsheet works, and you'll stop updating it by the second week.
What you want is a small script that reads whatever usage data you have, works out three or four numbers, and pushes them somewhere that draws them.
Where the data comes from
That depends on your tools. Some let you export usage as CSV. If you call models through your own proxy or SDK wrapper, you can log one row per request. Either way, aim for a file shaped roughly like this:
date,model,input_tokens,cached_tokens,output_tokens,cost_usd
2026-10-12,model-a,1200000,1150000,40000,3.10
2026-10-12,model-b,300000,200000,20000,0.40
2026-10-13,model-a,1500000,1460000,52000,3.90
If your export has different column names, change the script. Output Charts never reads this file. It only sees the JSON you send.
The dashboard
Three visuals:
- A line of daily cost per model, so you can see the day things changed.
- A KPI for the share of input served from cache.
- A horizontal bar of cost by model.
The KPI is the one people find surprising:
{ "label": "Input served from cache", "value": 0.976, "format": "percent" }
percent multiplies by 100, so that shows as 97.6%.
The script
Here it is in Python with requests. API push is part of Solo ($10 a month). Get a key from Account → API keys, and copy each visual's push URL from Push from code in the editor.
import csv, os, sys
from collections import defaultdict
import requests
KEY = os.environ["OC_KEY"]
def push(url, document):
r = requests.put(url, json=document,
headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
if r.status_code == 422:
raise SystemExit(f"Rejected: {r.json().get('details')}")
r.raise_for_status()
rows = list(csv.DictReader(open(sys.argv[1])))
models = sorted({r["model"] for r in rows})[:6] # a line chart takes 1 to 6 series
# Daily cost per model. Every row needs every series key, so start each day at zero.
daily = defaultdict(lambda: {m: 0.0 for m in models})
for r in rows:
if r["model"] in models:
daily[r["date"]][r["model"]] += float(r["cost_usd"])
push(os.environ["OC_DAILY_URL"], {
"xKey": "date",
"curve": "monotone",
"series": [{"key": m, "label": m} for m in models],
"data": [{"date": d, **{m: round(v, 2) for m, v in costs.items()}}
for d, costs in sorted(daily.items())][-60:],
})
input_total = sum(int(r["input_tokens"]) for r in rows)
cached_total = sum(int(r["cached_tokens"]) for r in rows)
push(os.environ["OC_CACHE_URL"], {
"label": "Input served from cache",
"value": round(cached_total / input_total, 3) if input_total else 0,
"format": "percent",
})
by_model = defaultdict(float)
for r in rows:
by_model[r["model"]] += float(r["cost_usd"])
push(os.environ["OC_MODELS_URL"], {
"orientation": "horizontal",
"mode": "grouped",
"xKey": "model",
"series": [{"key": "cost", "label": "Cost (USD)"}],
"data": [{"model": m, "cost": round(c, 2)}
for m, c in sorted(by_model.items(), key=lambda kv: -kv[1])],
})
Run it as python3 push_usage.py usage.csv, by hand after an export or from cron if your log grows on its own. Pages you have open pick up the new numbers within 15 seconds.
A few details in there are deliberate:
- Every row has every model. Line rows must contain exactly the
xKeyand each series key, all as numbers. A day with no usage of a model sends0, not a gap. - Sixty days at most. A line chart takes up to 500 rows, but two months is plenty to spot a change.
- Six models at most. That's the series limit. If you use more, group the rest as "other".
Reading it
The line tells you when. The bar tells you who. The KPI tells you whether caching is doing what you think. If cached input is 97% of your tokens and most of your bill, the expensive part is the context you resend every request, not the answers. That points to different fixes: trim the context, change models for long sessions, or accept it.
Honest limits
- Output Charts doesn't connect to any AI vendor's billing. The numbers are only as accurate as your export or log, and published allowances aren't always documented.
- The dashboard does no math. Cost per token, cache share and anything else are computed in your script.
- Each push replaces a whole visual. Re-running is safe, and the last push wins.
- On Free you can paste the three documents by hand. It's a nice once-a-week ritual, if you're that kind of person.
Try it
Paste the KPI above into JSON to chart to see it, then create a free dashboard and point the script at your own usage file.