Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>Token Cost CalculatorNew to Visual Studio Code? Get it now.
Token Cost Calculator

Token Cost Calculator

Dhanunjaya dev

|
5 installs
| (1) | Free
Real-time token counting & cost calculator for AI models (GPT, Claude, Gemini) with INR pricing. Track costs, set warnings, and manage your AI budget directly in VS Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

💰 Token Cost Calculator

Real-time token counting & cost calculator for AI models with INR pricing. Track costs, set warnings, and manage your AI budget directly in VS Code.

VS Code Version License


🎯 What Makes This Different?

While other extensions count tokens, Token Cost Calculator focuses on cost estimation and budgeting:

  • ✅ Cost Calculation - See costs in INR (₹) and USD ($) for all your models
  • ✅ Budget Tracking - Set warning limits for tokens and costs
  • ✅ Multi-Model Comparison - Compare costs across GPT, Claude, and Gemini simultaneously
  • ✅ Full Control - Configure your own models and pricing (no hardcoded defaults)
  • ✅ Sidebar Tracking - Real-time cost tracking in sidebar panel
  • ✅ Cache Pricing - Support for all cache types (input, write, read)

✨ Key Features

💵 Cost Calculation

  • Real-time cost calculation in Indian Rupees (INR) and USD
  • Shows costs for all configured models at once
  • Supports cache pricing (cached input, cache write, cache read)
  • Configurable USD to INR exchange rate

📊 Token Counting

  • GPT (OpenAI): ✅ EXACT - Uses same tokenizer as OpenAI
  • Claude (Anthropic): ⚠️ APPROXIMATE - May overestimate by 10-15%
  • Gemini (Google): ⚠️ APPROXIMATE - May vary by 5-10%

🎨 Visual Features

  • Status Bar Display - Shows tokens and cost with model name
  • Detailed Breakdown Panel - Beautiful card-based layout with hover effects
  • Sidebar Tracking - Real-time token and cost tracking
  • Warning System - Visual warnings when limits are exceeded

⚙️ Configuration

  • Full User Control - Add your own models with custom pricing
  • Default Model Selector - Quick dropdown to change default model
  • Reference File - Pre-configured models ready to copy-paste
  • Welcome Guide - Comprehensive setup instructions

🚀 Quick Start

1. Install the Extension

Search for "Token Cost Calculator" in VS Code Extensions marketplace

2. Add Your Models

  1. Press Ctrl+, to open Settings
  2. Search: tokenCalculator.customModels
  3. Click "Edit in settings.json"
  4. Add your models (see examples below)

3. Start Using

  • Select text → See tokens and cost in status bar
  • Click status bar → See detailed breakdown for all models
  • Right-click status bar → Change default model or open reference

📋 Example Configuration

{
  "tokenCalculator.customModels": {
    "gpt-4-turbo": {
      "displayName": "GPT-4 Turbo",
      "tokenizerType": "gpt",
      "inputPrice": 0.01,
      "outputPrice": 0.03,
      "cachedInputPrice": 0.005
    },
    "claude-3-opus": {
      "displayName": "Claude 3 Opus",
      "tokenizerType": "claude",
      "inputPrice": 0.015,
      "outputPrice": 0.075,
      "cachedWritePrice": 0.02,
      "cachedReadPrice": 0.003
    }
  }
}

🎯 Use Cases

  • Budget Planning - Estimate costs before sending prompts
  • Cost Comparison - Compare costs across different models
  • Budget Alerts - Set warnings to avoid overspending
  • Project Tracking - Track token usage and costs in real-time

📖 Documentation

  • Quick Start Guide - Get started in 5 minutes
  • Setup Guide - Complete setup instructions
  • Configuration Guide - Detailed configuration reference
  • Reference Models - Pre-configured models ready to use

⚙️ Settings

Setting Description Default
tokenCalculator.usdToInrRate USD to INR exchange rate 83.5
tokenCalculator.defaultModel Default model for status bar (first configured)
tokenCalculator.warningLimit Token warning threshold 10000
tokenCalculator.warningCostLimit Cost warning threshold (INR) 10
tokenCalculator.customModels Your model configurations {}

🆚 Comparison with Other Extensions

Feature Token Cost Calculator Other Extensions
Token Counting ✅ ✅
Cost Calculation ✅ INR + USD ❌
Budget Warnings ✅ ❌
Multi-Model Comparison ✅ ⚠️ Limited
Cache Pricing ✅ All types ⚠️ Limited
User Model Control ✅ Full control ⚠️ Pre-defined
Visual Highlighting ❌ ✅

Our Focus: Cost estimation and budgeting
Their Focus: Token counting and visualization


⚠️ Important Notes

Tokenizer Accuracy

  • GPT: ✅ EXACT (uses same tokenizer as OpenAI)
  • Claude: ⚠️ APPROXIMATE (10-15% overestimate - Anthropic's tokenizer is proprietary)
  • Gemini: ⚠️ APPROXIMATE (5-10% variance - SentencePiece not publicly available)

No Default Models

This extension gives you full control - you must configure your own models. This ensures:

  • You use only the models you need
  • You set your own pricing
  • No hardcoded defaults that may be outdated

🛠️ Commands

  • Token Cost Calculator: Show Welcome Guide - Open setup guide
  • Token Cost Calculator: Change Default Model - Select default model
  • Token Cost Calculator: Open Reference Models File - Open reference file
  • Token Cost Calculator: Calculate Token Cost for Selection - Analyze selected text
  • Token Cost Calculator: Reset Token Session - Reset tracking

📸 Screenshots

Status Bar

Shows real-time token count and cost with model name:

💰 1,500 tokens | ₹45 (GPT-4 Turbo)

Detailed Breakdown Panel

Beautiful card-based layout showing costs for all models with cache pricing options.

Sidebar Tracking

Real-time tracking with warnings when limits are exceeded.


🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


📝 License

MIT License - see LICENSE file for details


🙏 Acknowledgments

  • Uses tiktoken for GPT token counting
  • Built with VS Code Extension API

Made with 💰 for developers who care about AI costs

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