Token Watcher – AI API Cost & Token Analytics Platform

Inspiration

As AI-powered applications become more common, developers often struggle to understand how much they're spending on LLM APIs. While providers expose billing information, they rarely offer detailed, real-time insights into token consumption, model usage, endpoint performance, or workspace-level analytics.

I wanted to build a developer-first observability platform that makes AI usage transparent. Token Watcher helps developers and teams monitor token consumption, API costs, request activity, and model performance without changing their existing AI integrations.

What it does

Token Watcher is an AI telemetry and cost monitoring platform that enables developers to instrument their applications using a lightweight TypeScript SDK and visualize AI usage through a real-time analytics dashboard.

The platform provides:

  • Real-time AI telemetry collection
  • Token usage tracking
  • Cost monitoring per request and per model
  • Workspace-level analytics
  • Endpoint performance insights
  • Live activity updates using Server-Sent Events (SSE)
  • Multi-workspace isolation with secure API keys
  • A lightweight architecture that integrates directly into existing AI applications

Instead of routing AI traffic through a proxy, Token Watcher instruments applications directly, allowing developers to retain full control over their infrastructure while still collecting detailed telemetry.

How I built it

I designed Token Watcher as a modular full-stack application consisting of three main components: a backend service, a React dashboard, and a reusable TypeScript SDK.

Backend

  • TypeScript
  • Node.js
  • Express.js
  • PostgreSQL
  • Server-Sent Events (SSE)

The backend authenticates SDK requests, stores telemetry, generates analytics, and streams live updates to connected dashboards.

Frontend

  • React
  • Vite
  • TypeScript

The dashboard provides workspace analytics, recent activity, endpoint statistics, model usage, and live telemetry updates through an intuitive interface.

SDK

I built a lightweight TypeScript SDK that allows developers to integrate telemetry into existing AI applications with only a few lines of code. The SDK supports batching, retries, graceful shutdown using flush(), and secure API-key authentication.

Challenges I ran into

Building a real-time telemetry platform introduced several engineering challenges.

I designed an efficient ingestion pipeline capable of batching SDK events while keeping overhead low. Maintaining live dashboard updates through Server-Sent Events required handling reconnections, synchronization, and workspace isolation.

During development, I migrated the project from SQLite to PostgreSQL to improve scalability. This required updating the data layer, analytics pipeline, and deployment workflow. I also implemented workspace-based authentication, analytics caching, and secure API-key management to support multiple workspaces.

Balancing performance, scalability, and developer experience throughout the architecture was one of the most rewarding aspects of building the project.

Accomplishments that I'm proud of

  • Built a complete AI observability platform from scratch
  • Developed a reusable TypeScript SDK for AI telemetry
  • Implemented real-time analytics using Server-Sent Events
  • Designed secure workspace-based authentication
  • Built a production-ready PostgreSQL-backed architecture
  • Created interactive dashboards for monitoring AI usage and costs
  • Wrote comprehensive documentation covering architecture, deployment, operations, and SDK usage

What I learned

Building Token Watcher strengthened my understanding of production system design, telemetry pipelines, SDK development, real-time communication, authentication, analytics architecture, and scalable full-stack engineering.

Beyond implementing features, I learned how observability platforms collect, process, and visualize operational data while maintaining an efficient and developer-friendly experience.

What's next for Token Watcher

I plan to continue expanding Token Watcher with features including:

  • Support for additional AI providers
  • Budget alerts and spending notifications
  • AI-powered cost forecasting
  • Team collaboration and role-based access control
  • OpenTelemetry integration
  • Custom analytics dashboards
  • Docker and Kubernetes deployment support
  • CI/CD integrations for enterprise workflows

My long-term goal is to make Token Watcher a lightweight, developer-friendly observability platform that helps developers build AI applications with greater visibility, cost control, and confidence.

Share this project:

Updates

Submission history