AI Usage & Cost¶
This site is written, reviewed, fixed, and triaged by AI agents. That effort is not free — it's measured in tokens — so we meter it: every model call in the pipeline records what it consumed, every pull request carries a running cost comment, and the nightly ledger folds it all into the numbers below. Nothing here is hand-typed.
How to read the dollars: every figure is API-equivalent — what the tokens would bill at Anthropic's list prices. The pipeline authenticates with Claude Code subscription auth (OAuth) first, so the marginal dollar cost of those runs is zero; the API-equivalent figure is the honest way to compare effort anyway. If a run ever falls back to a metered API key, that share is real spend and is broken out below.
{% assign s = site.data.ai_usage.summary %}
Last rollup: {{ s.generated_at }} · {{ s.records }} AI calls on record {% if s.error_calls and s.error_calls > 0 %} · {{ s.error_calls }} of them failed mid-run (tokens still counted — failure isn't free){% endif %}
Totals¶
| window | calls | output tokens | cache read/write | cost (API-equiv) |
|---|---|---|---|---|
| all time | {{ s.all_time.calls }} | {{ s.all_time.output_tokens }} | {{ s.all_time.cache_read }} / {{ s.all_time.cache_creation }} | ${{ s.all_time.cost_usd }} |
| last 30 days | {{ s.last_30d.calls }} | {{ s.last_30d.output_tokens }} | {{ s.last_30d.cache_read }} / {{ s.last_30d.cache_creation }} | ${{ s.last_30d.cost_usd }} |
| last 7 days | {{ s.last_7d.calls }} | {{ s.last_7d.output_tokens }} | {{ s.last_7d.cache_read }} / {{ s.last_7d.cache_creation }} | ${{ s.last_7d.cost_usd }} |
Who spends it (last 30 days)¶
| workflow | calls | output tokens | cost |
|---|---|---|---|
| {{ row.workflow }} | {{ row.calls }} | {{ row.output_tokens }} | ${{ row.cost_usd }} |
By role and by model
| role | calls | cost |
|---|---|---|
| {{ row.role }} | {{ row.calls }} | ${{ row.cost_usd }} |
| model | calls | output tokens | cost |
|---|---|---|---|
| {{ row.model }} | {{ row.calls }} | {{ row.output_tokens }} | ${{ row.cost_usd }} |
What a pull request costs¶
A PR's bill has two halves: the run that wrote it (creation), and everything the machine did to it afterward — the harness, reviews, auto-fixes, brand adjudication (downstream). Each PR carries its own live version of this table in a sticky comment; these are the all-time heavyweights.
{% if s.top_prs and s.top_prs.size > 0 %}
| PR | calls | creation | reviews & fixes | total |
|---|---|---|---|---|
| #{{ row.pr }} | {{ row.calls }} | ${{ row.creation_usd }} | ${{ row.downstream_usd }} | ${{ row.cost_usd }} |
{% else %}
No PR-attributed calls yet — the meter is new. Give the robots a day.
{% endif %}
Spend by month¶
| month | calls | output tokens | cost |
|---|---|---|---|
| {{ row.month }} | {{ row.calls }} | {{ row.output_tokens }} | ${{ row.cost_usd }} |
Auth mix¶
{% for pair in s.by_auth %} - {{ pair[0] }}: {{ pair[1].calls }} calls, ${{ pair[1].cost_usd }} API-equivalent{% if pair[0] == 'oauth' %} — subscription-covered, $0 marginal{% elsif pair[0] == 'api_key' %} — metered key, real dollars{% endif %}
{% if s.estimated_share and s.estimated_share > 0 %}
{{ s.estimated_share | times: 100 | round: 1 }}% of the total is estimated from
_data/ai_pricing.yml rather than reported by the CLI — that's the API-fallback path, which reports tokens but not dollars.
{% else %}
No usage rollup recorded yet. The meter is
installed but the ledger hasn't swept its first artifacts — enable the
ai-usage workflow (set the AI_USAGE_ENABLED repo
variable) or run it manually with apply, and this page fills itself in.
{% endif %}
How the meter works¶
Every model call in this repo flows through one runner (scripts/ai/run.sh), which asks Claude Code for a JSON result and records the usage payload — tokens in, tokens out, cache traffic, reported cost — as one JSONL record. The end of each AI job publishes those records three ways: a step summary on the run, an ai-usage-* artifact, and a sticky cost comment on the PR it worked on. A nightly sweep folds the artifacts into _data/ai_usage/ledger.jsonl and regenerates this page's data. The full design doc lives in docs/AI-USAGE.md.
The meter can't see two things, and says so: a run that crashes before writing its result payload leaves no record (the record notes failures that finish), and work done on a laptop outside CI stays off the books. Both are documented gaps, not surprises.