tokencharts
A React and TypeScript library for tracking LLM token usage, cost, latency and prompt-cache savings, published on npm.
5AI providers normalised
0dependencies in the core
SVGcharts, no canvas
SSRcore runs on the server
THE PROBLEM
Why it was hard
Every AI provider reports token usage in a different shape, so teams end up writing the same conversion and charting code again and again.
WHAT I BUILT
How it works
- 01
Normalise
One usage format for OpenAI, Anthropic, Gemini, Bedrock and the Vercel AI SDK.
- 02
Calculate
A dependency-free core that works out cost, latency and prompt-cache savings, and also runs on the server.
- 03
Chart
Ready-made React SVG charts for usage and cost over time.
TAKEAWAY
What I learned
A small, dependency-free core makes a package easy to trust and easy to use anywhere, from a dashboard to a server job.
MORE
Related
Need something like tokencharts?
Tell me what you want to build. I reply with questions, then a written scope before any work starts.