Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>TokenLens — AI API Cost MonitorNew to Visual Studio Code? Get it now.
TokenLens — AI API Cost Monitor

TokenLens — AI API Cost Monitor

TokenLens

|
11 installs
| (0) | Free
Track OpenAI, Anthropic & Gemini API costs in real-time. See exactly what your AI is costing you — right inside VS Code. No code changes required.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TokenLens — AI API Cost Monitor

I got a £340 Anthropic bill last month and had no idea it was coming. The usage dashboard is fine but you only check it after the damage is done.

So I built TokenLens. It shows the cost of every API call in your VS Code status bar as it happens.


How it works

TokenLens runs a local proxy on your machine. Point your SDK at it with one env var and every API call shows its cost in real time. No code changes needed.

OPENAI_BASE_URL=http://localhost:4247/openai
ANTHROPIC_BASE_URL=http://localhost:4247/anthropic

Every call passes through the proxy. TokenLens reads the token counts, calculates the cost, and updates your status bar instantly — including streamed responses.

Your API keys and request data never leave your machine.


Setup

  1. Install the extension
  2. Cmd+Shift+P → TokenLens: Setup API Tracking
  3. Select your providers — env vars are added to your .env automatically
  4. Restart your dev server and start coding

Features

  • Live status bar — see today's spend at a glance: ⚡ $0.23
  • Full dashboard — cost by model, by provider, per call
  • Budget alerts — notified when you hit 75% or 90% of your monthly limit
  • All major providers — OpenAI, Anthropic, Google Gemini, Mistral
  • Streaming support — works with streamed responses
  • Zero code changes — one env var, that's it

Supported models

Provider Models
OpenAI GPT-4o, GPT-4o mini, o1, o3-mini
Anthropic Claude Opus, Claude Sonnet, Claude Haiku
Google Gemini 2.5 Pro, Gemini 1.5 Flash
Mistral Mistral Large

Commands

Command Description
TokenLens: Setup API Tracking Add proxy env vars to your project
TokenLens: Open Cost Dashboard View full cost breakdown
TokenLens: Set Monthly Budget Alert Set a spending limit
TokenLens: Reset Usage Data Clear all recorded data

Free vs Pro

Free Pro
Real-time cost tracking ✅ ✅
Status bar display ✅ ✅
History 7 days Unlimited
All providers ✅ ✅
CSV export — ✅
Cloud backup — ✅
Price Free £19/mo

Upgrade to Pro


Privacy

All data stays on your machine. The proxy runs on 127.0.0.1 and is never accessible outside your computer. Nothing is sent to any server on the free plan.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft