A Visual Studio Code extension that displays your Z.ai API usage directly in the status bar. Keep track of your token usage, weekly quota, and MCP usage at a glance without leaving your editor.
- Status Bar Display – Shows your Z.ai usage percentage with color-coded indicators
- Detailed Tooltip – Hover to see:
- 5h token usage with progress bar
- Weekly quota usage
- MCP usage count
- Time remaining until quota reset
- Current plan level
- Manual Refresh – Click the status bar item or use the command palette to refresh usage data
- API Key Management – Securely configure your Z.ai API key through VS Code settings or environment variables
- Color Indicators – Visual feedback based on usage level:
- < 50%: Green
- 50-75%: Yellow
- 75-90%: Orange
- 90%+: Red
- Clone or download this repository
- Open VS Code and press
F1orCtrl+Shift+P(orCmd+Shift+Pon macOS) to open the Command Palette - Type Install from VSIX and select it
- Navigate to the cloned folder and select the
.vsixfile
Note: If you don't have a
.vsixfile yet, you'll need to build the extension first (see Building from Source).
- Clone or download this repository to your local machine
- Open VS Code and press
F1orCtrl+Shift+P(orCmd+Shift+Pon macOS) - Type Extensions: Install Extensions from Location... and select it
- Navigate to and select the folder containing the extension (the folder with
package.json) - VS Code will install the extension directly from the folder
Tip: This method installs the extension in development mode. You can also press
F5in the extension folder to launch a new VS Code window with the extension loaded for testing.
If you want to build the extension yourself:
-
Install Node.js dependencies:
npm install
-
Compile the TypeScript code:
npm run compile
-
(Optional) Package the extension as a
.vsixfile:npm install -g @vscode/vsce vsce package
Then follow Method 1 or Method 2 above.
The extension can be configured through VS Code settings (settings.json) or the Settings UI.
| Setting | Type | Default | Description |
|---|---|---|---|
zaiUsage.refreshInterval |
number | 60 |
Refresh interval in seconds |
zaiUsage.notifications.enabled |
boolean | true |
Show notifications when approaching limits |
zaiUsage.notifications.thresholds |
array | [75, 90, 95] |
Percentage thresholds for notifications |
zaiUsage.apiKey |
string | "" |
Z.ai API key (or use ZAI_API_KEY env var) |
You can provide your Z.ai API key in two ways:
- Via Settings – Set
zaiUsage.apiKeyin your settings - Via Environment Variable – Set the
ZAI_API_KEYenvironment variable - Via Command – Run the Z.ai Usage: Configure command from the Command Palette
| Command | ID | Description |
|---|---|---|
| Z.ai Usage: Refresh | zaiUsage.refresh |
Manually refresh usage data |
| Z.ai Usage: Configure | zaiUsage.configure |
Set up your Z.ai API key |
| Z.ai Usage: Copy Usage (JSON) | zaiUsage.copyJson |
Copy current usage as JSON |
- Visual Studio Code 1.85.0 or higher
- Z.ai API key
MIT
- Run
npm run compileto compile the TypeScript code - Run
npm run watchto watch for changes and recompile automatically - Press
F5in VS Code to launch a new Extension Development Host window with the extension loaded