Skip to content
Muhammet Şafak
tr
Cover — on a dark background, Tan the indigo beaver points at violet line and bar charts on a translucent panel

TokenMetrics: making AI agent token spend visible per project

A desktop app that reads Claude Code, Codex CLI and Gemini CLI logs locally and shows token usage by project, model and session.

What it does today

Collects AI agent token usage from local logs and shows it by project, model, session and time, with estimated cost and subscription limit tracking. A developer who uses Claude Code, Codex CLI or Gemini CLI heavily and wants to see the spend can install it.

Started
November 2026 — Ongoing

Form

Open-Source Desktop

Technologies

Go Wails Svelte TypeScript SQLite

Trying to fit inside my subscription limits, I realized I didn’t know how many tokens I’d spent on which project; I was only guessing. TokenMetrics is the Go app I wrote to turn that guess into a measurement. The personal side of the story is in the blog post.

Reading from logs that already exist

My first decision in this experiment was not to build a wrapper or a proxy. I read the local records agents already leave behind: Claude Code, Codex CLI and Gemini CLI. For API accounts you can add the Anthropic and OpenAI Admin APIs; for services that leave no logs I added manual entry and CSV import.

I made scanning incremental. The app stores how far it read in each file, writes records under their own identifiers and never counts the same message twice. I keep records in the database even after the log file is deleted. The cost is that totals recomputed from the raw logs can come out lower than the stored ones; the verification tools I wrote report that case as inconclusive rather than as a mismatch.

Making the measurement readable

What mattered to me was not knowing the total but being able to see the usage. The overview screen shows today, the last 7 and 30 days; the chart shows token flow split by service or model. The comparison screen gives input, output and cache tokens, request count and estimated cost per model and service. The projects screen breaks usage down by the directory the agent worked in. The limits screen tracks the 5-hour and weekly windows; when a threshold is crossed, an OS notification and the tray icon raise the alert.

Cost and limits

I take cost from a built-in price table and limit percentages from values you enter, because providers don’t publish subscription limits. That’s why I labeled all of it “estimated” in the interface.

I kept the privacy scope narrow: my parsers read token counts and metadata (model, time, project directory, session ID) and not prompts or answers. I keep the data in a single local SQLite file, and Admin API keys go to the operating system’s keychain.

Today’s limits and what’s next

Version 0.1.0, beta. It has gaps too: usage that leaves no logs is visible only through manual entry; I haven’t yet separated which subscription records were charged to; and I haven’t code signed the binaries or notarized the macOS app. The interface is Turkish only for now.

Next is collecting a few weeks of real usage data. As it builds up, I’ll share here how far each project’s share drifted from my guess.

Tags: #ai#tokens#cost#visualization
Share:

More Records

All records

How a provider-agnostic Go CLI reviews a diff without it leaving the machine, and how the experiment reached signed binaries as CommitBrief.

What it does today

Reviews code locally, with the diff never leaving the machine; the `Provider` interface lets Anthropic, OpenAI, Gemini and Ollama plug into one contract. Signed binaries are published — anyone who does not want to hand their diff to a cloud provider can install it.

Open-Source Go Cobra go-git +4 more
January 2026 — April 2026

An open-source desktop app in Rust and Tauri 2 records a meeting's audio and the screen frames that change, then writes a summary and action items.

What it does today

Records a meeting's microphone and system audio on separate tracks plus only the screen frames that change, then writes a note with a summary, decisions, action items and open questions. Anyone who wants meeting recordings turned into notes without keeping video can build it from source and try it.

Desktop Open-Source Rust Tauri 2 React +4 more
November 2026 — Ongoing

Build notes on serving the documentation of many projects from one multi-tenant server, each with its own MCP endpoint and documents kept on your machine.

What it does today

Makes a project's folder, git repository, Obsidian vault or Notion workspace searchable behind a single MCP endpoint, so an agent reaches the documentation without the data going to a third party. Anyone who can run Docker can host it and manage it from the dashboard.

Open-Source Web TypeScript Node.js Fastify +6 more
August 2026 — September 2026

Search the site

Start typing to search posts, projects and pages.

Esc to close Powered by Pagefind