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
- Install the extension
Cmd+Shift+P→TokenLens: Setup API Tracking- Select your providers — env vars are added to your
.envautomatically - 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 |
| 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 |
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.