Token Explorer · Copilot Ready
What's New in v0.3.1
What's New in v0.3.0Selection is now the single source of truthEverything in the extension — the Dashboard, the status-bar pill, and the Compare Models command — now reads from one place: the set of files you have checked in the Workspace Files view.
Checkbox flicker fixedChecking or un-checking a file or folder in the Workspace Files view no longer produces a brief visual flash where the checkbox appears to toggle twice. The root cause was a redundant second render pass; this has been eliminated. What's New in v0.2.0
FeaturesLive Token Count in the Status BarA persistent status-bar item shows the token count for whatever is currently in scope:
Hover the pill for a tooltip that explains exactly what is being counted. Activity-Bar SidebarA dedicated Token Explorer panel in the activity bar gives you three views:
Dashboard — Unified Token BudgetThe Dashboard (v0.3) has four collapsible sections:
Workspace Files — Multi-file Budget Calculator
Inline Editor HighlightingEnable Token Explorer: Toggle Inline Highlighting to colour each token directly inside the editor using a six-colour cycling palette — ideal for understanding exactly where token boundaries fall. Token Preview WebviewOpen a side panel that renders the document as coloured token chips, one chip per token. Newlines and tabs are shown as visible glyphs (⏎ / →). Per-model caveats are listed below the chips. Sync with Copilot Chat ModelClick sync copilot in the Dashboard (or run Token Explorer: Sync Model with Copilot Chat) to have the extension pick the best-matching model from your available Copilot Chat models automatically. 26-Model CoverageSwitch models at any time from the command palette or settings. Every model in the list below is selectable: OpenAI / GPT family — GPT-5.5, GPT-5.4, GPT-5.4 mini, GPT-5.3 Codex, GPT-5.2, GPT-5.2 Codex, GPT-5 mini, GPT-4.1, GPT-4o, GPT-3.5 Turbo Real tokenizer libraries are used wherever possible:
Accuracy caveats are shown inline whenever a proxy tokenizer or estimated pricing is used. Copilot Chat Participant —
|
| Slash command | What it does |
|---|---|
@tokens /count |
Token count, context %, and estimated cost for the active file |
@tokens /cost |
Estimated API input cost only |
@tokens /compare |
Side-by-side table of token counts across all 26 models |
@tokens /selection |
Aggregate stats for all files ticked in the Workspace Files view |
Copilot Agent Tools
Token Explorer registers six Language Model Tools that Copilot's default agent can call automatically — no @tokens prefix required. When you ask Copilot something like "how big is this file for Claude?" or "will my selected files fit in GPT-4o's context window?", the agent picks the right tool and answers directly.
| Tool reference | What it does |
|---|---|
#tokenCountActiveFile |
Token count, context %, and cost for the file in the active editor |
#tokenCountFile |
Same, for any file by workspace-relative path, absolute path, or bare filename |
#tokenSelectedFiles |
Aggregate for all files ticked in the Workspace Files view |
#tokenCompareModels |
Side-by-side comparison across all 26 models |
#tokenListModels |
Every supported model with id, algorithm, vocab size, context limit, and price |
#tokenCountText |
Token count for an arbitrary text snippet the agent already has in context |
All tools run fully offline — no API keys, no network calls.
Getting Started
- Install the extension.
- Open any workspace folder — the Workspace Files view immediately starts scanning and tokenizing every Markdown and text file.
- Open any Markdown or plain-text file for live status-bar updates and the Dashboard.
- The status bar shows the token count for the default model (
gpt-4.1).
Plan a multi-file prompt budget
- Click the Token Explorer icon in the activity bar.
- Open the Workspace Files section.
- Tick the files you intend to include in a prompt. Tick a category or folder to select all files inside it.
- The Dashboard → Token budget section shows the combined total, the ASCII gauge, and the number of tokens still free for your prompt and the model's response.
Change the Active Model
- Command palette →
Token Explorer: Select Model - Settings →
tokenExplorer.defaultModel - Dashboard → change model button
- Dashboard → sync copilot button (matches your Copilot Chat selection)
All views update automatically.
Open the Token Preview
Command palette → Token Explorer: Open Token Preview
A panel opens beside your editor showing every token as a coloured chip.
Commands
| Command | Description |
|---|---|
Token Explorer: Select Model |
Pick the active model / tokenizer |
Token Explorer: Sync Model with Copilot Chat |
Match the model to your active Copilot Chat model |
Token Explorer: Open Token Preview |
Open the side webview with coloured token chips |
Token Explorer: Toggle Inline Highlighting |
Toggle per-token background colours in the editor |
Token Explorer: Refresh |
Force a re-tokenization of the active file and workspace files |
Token Explorer: Copy Token Count |
Copy the current count to the clipboard |
Token Explorer: Compare All Models for This File |
Print a comparison table to the Output channel |
Token Explorer: Refresh Workspace Files |
Rescan and re-tokenize all workspace files |
Token Explorer: Clear Selection |
Deselect all checked files in the Workspace Files view |
Token Explorer: Add Active File to Selection |
Tick the currently open editor into the selection |
Settings
| Setting | Default | Description |
|---|---|---|
tokenExplorer.defaultModel |
gpt-4.1 |
Model used when opening a file |
tokenExplorer.inlineHighlighting |
false |
Highlight every token directly in the editor |
tokenExplorer.debounceMs |
250 |
Delay (ms) before re-tokenizing after an edit |
tokenExplorer.showStatusBar |
true |
Show the live status-bar item |
Requirements
- VS Code 1.95.0 or later
- No external API keys required — all tokenizers run fully offline inside the extension
Known Limitations
- Only Markdown and plain-text files are supported in the Workspace Files view. Support for additional languages (Python, TypeScript, etc.) is planned.
- Tokenization of very large files (>1 MB) may be slow when inline highlighting is on.
- Gemini, Grok, Raptor, and several newer GPT-5 variants use proxy or heuristic tokenizers. Token counts are approximate. Accuracy caveats are always displayed in the UI.
- Cost estimates for Copilot-bundled models (Raptor, GPT-5.x) are shown as $0 or indicative only; these models are not billed per token through the standard API.
- The Workspace Files view excludes
node_modules,.git,dist,out,build,.next, and.vscode-testfolders. - There is no public VS Code API to read the model currently active in Copilot Chat; sync copilot uses a best-effort heuristic match.
Changelog
v0.3.1
- TypeScript fix — added
"types": ["node"]totsconfig.jsonso VS Code's language service correctly resolves Node.js globals (NodeJS.Timeout,setTimeout,clearTimeout,TextDecoder). The extension compiled fine from the command line, but the VS Code Problems panel reported false errors. - Code cleanup — removed a dead legacy
DashboardTreeProviderimport and void reference that was left over after the dashboard was migrated to a webview.
v0.3.0
- Selection as single source of truth — Dashboard, status bar, and compare command all read from the same checked-file set; no more ambiguity between "single-file" and "multi-file" numbers.
- Unified token budget section — replaces two separate capacity / files panels with one block: scope pill, ASCII bar, used/free/cost rows, and a files table with a totals footer.
- Files table footer — shows total tokens used and tokens remaining (with
%ctx) so you can see at a glance how much room is left for the prompt and model response. - Status-bar scope label — pill now appends
· N file(s)or· activeso the scope is always visible without opening the Dashboard. - + add active file — one-click button in Dashboard to tick the open editor into the selection.
- Checkbox flicker fixed — eliminated the double-render that caused a brief visual flash when checking / unchecking items in the Workspace Files view.
- Compare across models now operates on the selection (with fallback notice if nothing is selected).
- Registered new command
Token Explorer: Add Active File to Selection.
v0.2.0
- New: Workspace Files view — auto-discover and tokenize every Markdown / text file in the workspace; token count and context % shown inline next to each file name.
- New: Multi-file selection budget calculator — check multiple files to see combined token count, context-window %, and estimated input cost in real time.
- New: Separate Markdown / Text sections — files are grouped by type in the Workspace Files view.
- New: Workspace Files toolbar buttons — Refresh and Clear Selection in the view title bar.
- Activation now triggers on
onStartupFinishedso the Workspace Files view populates immediately on any workspace open.
v0.1.0
- Initial release: live status-bar token count, Dashboard view, Tokens view, inline highlighting, Token Preview webview, 26-model coverage, and
@tokensCopilot chat participant.
License
MIT