Skip to content
SlashClone

Llm usage normalizer

@agentcosts/llm-usage-normalizer

Convert Anthropic and OpenAI usage exports, or your own app's token logs, into one usage schema with customers, tasks, cached and uncached tokens, and cost from a price table you edit. Fixes the classic mistake of counting cached tokens twice, and lists unmapped keys and unpriced models.

SkillDatav1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1# LLM usage normalizer
  2. 2
  3. 3Converts Anthropic and OpenAI usage exports, or your own app's token logs, into one usage CSV with customer, task, cached and uncached tokens, and cost. It handles the cached-token difference between providers, maps API keys or projects to customers, and tells you what it could not map or price.
  4. 4
  5. 5**Who it is for:** engineers and finance folks at AI products who need one clean usage file before they can talk about cost per customer or margins.
  6. 6
  7. 7## Example
  8. 8
  9. 9Input: `examples/anthropic-usage.csv` (daily rows per model and key), `examples/openai-usage.csv` (daily rows per model and project), `examples/customer-map.csv`, `examples/prices.csv`.
  10. 11Output (`out/usage-normalized-report.md`):
  11. 13```
  12. 14| examples/anthropic-usage.csv | anthropic | 8 | $7.65 | api_key_id | uncached_input_tokens |
  13. 15| examples/openai-usage.csv | openai | 4 | $3.93 | api_key_id | input_tokens |
  14. 16Total $11.59 across 12 rows.
  15. 17Keys with no customer: key-staging (1 row)
  16. 18```
  17. 20And `out/usage-normalized.csv` in the shared schema used by every Agent Costs kit.
  18. 22## What it can access
  19. 24- Runs `node scripts/normalize.mjs` (Node built-ins only).
  20. 25- Reads exports in `data/`. Writes `data/llm-prices.csv`, `data/customer-map.csv`, and `out/usage-normalized*`.
  21. 26- No network, no API keys. It never calls a provider.
  22. 28## Setup
  23. 30Copy `examples/prices.csv` to `data/llm-prices.csv` and **check every price against the provider's current pricing page** (the example prices are a starting point, not a quote). Then export usage from each provider's console into `data/`.