whatisgithub

What is tokenmeter?

nawinsharma/tokenmeter — explained in plain English

Analysis updated 2026-05-18

0TypeScriptAudience · developerComplexity · 3/5Setup · moderate

In one sentence

A proxy that sits between your app and the Claude API, tracking and pricing every token you actually use on a dashboard.

Mindmap

mindmap
  root((tokenmeter))
    What it does
      Proxies Anthropic API calls
      Tracks token usage and cost
      Shows spend on a dashboard
    Tech stack
      Next.js
      Postgres
      Drizzle
      Better Auth
      Recharts
    Use cases
      See exact spend on a shared API key
      Track cost per model over time
      Monitor cache hit ratio for requests
    Audience
      Developers using Claude API
      Vibe coders
    Concepts
      Encrypted key vault
      Proxy keys
      Fire and forget usage recording

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Track exactly how much of a shared Anthropic API key you personally are spending.

USE CASE 2

See spend broken down by model and by time range on a dashboard.

USE CASE 3

Swap your real API key for a proxy key so real keys stay encrypted and hidden.

What is it built with?

Next.jsTypeScriptPostgresDrizzleBetter AuthRechartsBun

How does it compare?

nawinsharma/tokenmeter0xradioac7iv/tempfs7vignesh/pgpulse
Stars000
LanguageTypeScriptTypeScriptTypeScript
Setup difficultymoderatemoderatemoderate
Complexity3/53/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Bun and a local Postgres database, plus generating an encryption key and session secret.

So what is it?

Token Meter is a small proxy application that tracks how much you are actually spending on Anthropic Claude API calls. Instead of calling the Claude API directly, your app or your Claude Code SDK points at Token Meter's proxy address. The proxy quietly resolves your real, encrypted API key, forwards the request on to Anthropic, and streams the same response straight back to you, untouched. In the background, it records exactly how many tokens were used and prices that usage, so nothing about your actual request or response changes. The project is built with Next.js for the web app, Postgres as the database, Drizzle as the tool that manages the database tables, Better Auth for signing in, and Recharts for drawing usage charts. To run it yourself, you need the Bun JavaScript runtime and a local Postgres database. After installing dependencies and filling in a few environment variables, including an encryption key used to protect stored API keys, you seed the database with Anthropic's current model pricing and start the app. Once signed up, you add your real Anthropic API key, which gets encrypted and stored so only its last four characters are ever shown again. You then generate a separate proxy key, shown to you once, and use that instead of your real key when configuring the Anthropic SDK in your own code. From there, every request you make through the proxy shows up on a dashboard with spend over time, cost broken down by model, how often cached tokens were reused, and a list of recent requests, filterable by time range from the last day up to the last ninety days. Because usage recording happens separately from the actual API call, a database problem never causes an API request to fail.

Copy-paste prompts

Prompt 1
Walk me through setting up tokenmeter locally with Bun and Postgres.
Prompt 2
Explain how the proxy key and key vault protect my real Anthropic API key.
Prompt 3
Help me point my Anthropic SDK at the tokenmeter proxy instead of the real API.
Prompt 4
How does the cost engine calculate pricing for cached tokens?

Frequently asked questions

What is tokenmeter?

A proxy that sits between your app and the Claude API, tracking and pricing every token you actually use on a dashboard.

What language is tokenmeter written in?

Mainly TypeScript. The stack also includes Next.js, TypeScript, Postgres.

How hard is tokenmeter to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is tokenmeter for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.