Claude Usage Stats
See exactly what Claude cost you, down to the cent
- client
- stats
Claude Usage Stats is the honesty node of the ERPK/Claude family: you hand it a client, and it tells you, in formatted text, how many tokens and how many dollars that client has burned through. Input, output, cache reads, cache creations, per-type cost, cache savings, and a total. It's an output node, so it's meant to sit at the end of the graph and be read.
You'd think a cost display is a nice-to-have. It's not - it's the difference between "I used Claude a bunch" and "I spent $14.23 on prompt enhancement this afternoon." These are paid API nodes, and the caching toggle (on the API Client node) is the main lever for keeping that number small. This node is how you actually see whether the lever is working. If you're building workflows that batch hundreds of Claude calls, put one of these in the graph and glance at it occasionally.
What it shows
The stats STRING output is a formatted report. It covers:
- Token usage - input, output, cache read, and cache creation tokens.
- Cost (USD) - input cost, output cost, and cache savings, then a total.
Everything is cumulative on the client, so the number grows as you run more nodes downstream of the same client. There's also a reset_stats toggle: flip it on, run the node, and the client's counters reset after display - handy for measuring a single workflow run in isolation.
How it works
The node reads usage counters that the Claude client maintains internally as it makes calls. Because usage tracking lives on the client object, the wiring matters: only Claude nodes downstream of the same Claude API Client share the numbers. If you run Claude nodes standalone (no client node), each one has its own hidden client, so stats are per-node unless you route them through a shared client.
Installing it
Part of the ERPK Collection (eRepublik-Labs/comfyui-nodes-erpk). ComfyUI Manager: search erpk → ERPK Custom Nodes → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk
pip install -r requirements.txt
Needs anthropic>=0.96.0 and an Anthropic API key (Settings → ERPK → API Keys). No model files.
Common issues
- Stats are empty or zero - the
clientisn't connected to the node you're trying to measure, or that node ran with its own standalone client. Route everything through one Claude API Client node. - "Failed to get usage stats" - the node swallows the error into the output string and prints it to the console. Usually a disconnected or stale client; re-wire and re-run.
- Numbers look too small - remember this only counts what went through this client. Separate client nodes = separate (missing) totals.
- It's not a bill - it's a usage estimate from the client's counters, not your Anthropic invoice. For exact billing, check the Anthropic console.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| client | CLAUDE_API_CLIENT | Claude API client | |
| reset_statsopt | BOOLEAN | false | Reset usage statistics after displaying |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| stats | STRING | — |