Live LLM Token Counter is a Visual Studio Code extension for prompt writers, AI app builders, and model evaluators who need local token feedback while editing. It shows live token counts for a selection or the whole document, lets you switch tokenizer families from the status bar, and can paint token boundaries directly over the editor text.
The extension identifier and settings namespace are gpt-token-counter-live so existing users keep their installs and settings.
Tokenizer support is provided by tiktoken for GPT/OpenAI models, Anthropic's tokenizer for Claude, a local Gemini approximation, and @huggingface/tokenizers for HuggingFace tokenizer.json files such as Qwen, Llama, and Mistral.
NEW in v1.5.2: Restored the original handmade logo and visible extension name while keeping the corrected project support link and clearer listing copy.
NEW in v1.5.0: Count and highlight tokens for any HuggingFace tokenizer (Qwen, Llama, Mistral, and more), loaded from the Hub or a local tokenizer.json. Plus file pattern filtering to scope the counter to specific file types.
Live token counting for the current selection or entire document, displayed directly in the status bar. Counts update automatically as you type or change your selection.
Click the status bar to switch between model families: GPT (OpenAI), Claude (Anthropic), Gemini (Google AI), or HuggingFace.
- GPT (OpenAI): Uses tiktoken
encoding_for_model('gpt-5')with fallbacks too200k_base→cl100k_basefor accurate token counting across all GPT models. - Claude (Anthropic): Uses Anthropic's official tokenizer for precise token boundaries with full highlighting support.
- Gemini (Google AI): Approximates tokens using GPT encodings or ~4 chars/token fallback (highlighting not available).
- HuggingFace: Loads a
tokenizer.jsonfrom the Hub (or a local file) and reuses it for live counts. Byte-level BPE tokenizers (Qwen, Llama, Mistral, etc.) support highlighting; SentencePiece tokenizers that alter whitespace fall back to counting only.
See your tokens in real-time with alternating color bands that show exactly where each token begins and ends. Available for GPT, Claude, and HuggingFace byte-level BPE tokenizers (Qwen, Llama, Mistral, etc.).
Key features:
- Toggle on/off: Click the palette icon in the status bar to enable or disable highlighting.
- Smart text contrast: Foreground text color automatically adapts to your highlight colors for readability.
- Customizable colors: Choose your own colors with alpha/transparency support.
- Editor-aware: Only highlights in text editors; Output and Debug panes remain clean.
Open the Command Palette and run Configure Token Highlight Colors to access a dedicated color configurator.
Features:
- Separate color pickers for even/odd token bands
- Hex color input with opacity sliders
- Live preview showing exactly how colors will look
- Smart contrast preview so you can ensure text remains readable
Personalize how token information appears in your status bar using template placeholders.
Supported placeholders:
{count}- Token count{family}or{model}- Model family name (GPT, Claude, Gemini){provider}- Provider name (openai, anthropic, gemini)
- Visual Studio Code: The extension is developed for VS Code and will not work with other editors.
- It is also hosted on the Open VSX Registry.
This extension provides the following commands (accessible via Command Palette):
-
Change Model Family: Switch between GPT (OpenAI), Claude (Anthropic), and Gemini (Google AI) tokenizers. Also accessible by clicking the token count in the status bar. -
Toggle Token Highlighting: Enable or disable visual token highlighting overlays. Also accessible by clicking the palette icon in the status bar. -
Configure Token Highlight Colors: Open an interactive color configurator to customize the highlight colors for even and odd token bands. Includes live preview and smart text contrast. -
Count Tokens: Manually trigger token counting for the current document or selection.
This extension contributes the following settings:
-
gpt-token-counter-live.defaultModelFamily: Choose which model family activates by default when you open VS Code.- Options:
openai,anthropic,gemini, orhuggingface - Default:
openai
- Options:
-
gpt-token-counter-live.statusBarDisplayTemplate: Customize how token information appears in the status bar.- Default:
Token Count: {count} ({family}) - Supported placeholders:
{count},{family},{model}(alias for family),{provider}
- Default:
-
gpt-token-counter-live.enabledFilePatterns: Glob patterns for files where the status bar should be shown.- Default:
[](empty array shows for all files) - Example:
["*.md", "*.mdc"]shows only for markdown files
- Default:
Select HuggingFace (huggingface) in the model family picker, then point the extension at a tokenizer with either of the settings below. The first load fetches tokenizer.json from the Hub and caches it under the extension's global storage directory, so subsequent launches are offline-friendly.
gpt-token-counter-live.huggingfaceModelId: HuggingFace repo ID (e.g.Qwen/Qwen2.5-7B-Instruct,meta-llama/Llama-3-8B,mistralai/Mistral-7B-Instruct-v0.3). The extension fetcheshttps://huggingface.co/{id}/resolve/main/tokenizer.jsonplustokenizer_config.jsonand caches them on disk.gpt-token-counter-live.huggingfaceTokenizerPath: Absolute path to a localtokenizer.jsonfile. When set, it overrideshuggingfaceModelId. A siblingtokenizer_config.jsonwill be picked up automatically if present.
What works and what doesn't:
- Byte-level BPE tokenizers (Qwen, Llama, Mistral, most GPT-style tokenizers on the Hub) give precise token counts and highlighting.
- SentencePiece / Unigram tokenizers that strip or transform whitespace (T5, some BERT variants) still give precise counts, but highlighting is automatically disabled. Decoding an id sequence back to text doesn't produce an identical string, so offsets can't be attributed reliably. You'll see token counts but no color overlays.
- Gated or private repositories cannot be fetched without auth. The first load will surface the raw HTTP status in a VS Code error notification (typically
401or403); downloadtokenizer.jsonmanually and pointhuggingfaceTokenizerPathat it. - Missing repositories / offline first-load show the same error notification and fall back to a rough
~4 chars/tokenapproximation until the tokenizer resolves.
Token highlight colors are stored in your VS Code global state (synced across devices if you have Settings Sync enabled). To customize them select Configure Token Highlight Colors option from the Command Palette.
Quick toggle: Click the palette icon in the status bar to enable/disable token highlighting instantly.
There are currently no known issues. If you encounter a problem, please report it on the issue tracker.
Changed:
- Restored the original handmade icon and visible extension name.
- Updated support metadata to the project's own issue tracker.
- Rewrote the listing introduction to better describe local token counting, token highlighting, HuggingFace tokenizer loading, and file filters.
Superseded by 1.5.2.
New features:
- HuggingFace tokenizer family: load any
tokenizer.jsonfrom the Hub (first launch fetches + caches) or a local file. Byte-level BPE tokenizers (Qwen, Llama, Mistral, etc.) support highlighting; SentencePiece tokenizers that transform whitespace count tokens but skip highlights. Configure viahuggingfaceModelIdorhuggingfaceTokenizerPath. - New setting
enabledFilePatterns: Show status bar only for files matching specific glob patterns (e.g.,["*.md", "*.mdc"]). Empty array shows for all files.
Fixes:
- Token highlighting stays aligned around multi-byte UTF-8 characters (emoji, CJK). The renderer now matches raw bytes against the source instead of decoded token strings, so a token that splits a multi-byte character still lands on the right boundary.
- Claude highlighting works on documents containing characters that NFKC-normalize to a different form (e.g., full-width
()becoming ASCII()). Token ranges are reprojected from the normalized tokenization back onto the original text.
Major new features:
-
Visual Token Highlighting: See exactly where each token begins and ends with alternating color bands overlaid on your text
- Available for GPT (OpenAI) and Claude (Anthropic) tokenizers
- Smart text contrast automatically adjusts foreground color for readability
- Editor-aware: only applies to text editors, keeps Output/Debug panes clean
-
Interactive Color Configurator: New command
Configure Token Highlight Colorswith:- Separate color pickers for even and odd token bands
- Hex color input with opacity sliders for full alpha support
- Real-time preview showing exactly how colors will appear
- Smart contrast preview ensures text remains readable
-
Status Bar Palette Toggle: Quick access toggle button in status bar
- Click to instantly enable/disable token highlighting
- Visual states: Active (on), Inactive (off), Unavailable (for unsupported models)
-
New Configuration Settings:
defaultModelFamily: Choose which model family (GPT, Claude, or Gemini) activates by defaultstatusBarDisplayTemplate: Customize status bar text with template placeholders like{count},{family},{provider}
Technical improvements:
- Better Unicode normalization handling for Claude tokenizer (NFKC)
- Performance optimizations for real-time highlighting
- Improved error handling and user feedback
- Switch to model families in the UI: GPT, Claude, Gemini.
- Add Gemini token counting (approximate:
o200k_base/cl100k_base, fallback ~4 chars/token). - GPT tokenizer now uses
encoding_for_model('gpt-5')with graceful fallbacks. - Updated
tiktokento 1.0.22.
- Added support for new OpenAI models: o3-mini, o1, o1-mini, gpt-4o-mini
- Updated to tiktoken 1.0.20
- Updated Claude models to only include Claude-3.5, Claude-3.7
- Removed older models: text-davinci-003, davinci, babbage
- Removed Claude-2 and Claude-3
- Moved from
gpt-tokenizertotiktokenpackage. - Fixed the special tokens issue.
- Modified the code to increase security.
- Added support for GPT-4o tokenizer.
- Removed unused models from the tokenizer list.
- Added Claude-3 as option using approximate token count.
- Added support for Claude tokenizer.
- Initial release of gpt-token-counter-live.
- Provides a token count in the status bar for the selected text or the entire document.
- Automatically updates the token count as text is edited or selected.
- Allows the user to select the model to use for token counting.




