Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Z.ai GLM Usage TrackerNew to Visual Studio Code? Get it now.
Z.ai GLM Usage Tracker

Z.ai GLM Usage Tracker

melon

|
16 installs
| (0) | Free
Track your Z.ai GLM Coding Plan usage in the status bar
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Z.ai GLM Usage Tracker

VS Code Marketplace Open VSX License: MIT

A VS Code extension that tracks your Z.ai GLM Coding Plan usage and displays it in the status bar. Also works with Windsurf, VSCodium, and other VS Code forks.

Features

  • Real-time Usage Display: See your 5-hour token quota directly in the status bar

    • Shows percentage used and current tokens
    • Example: ✓ ⚡ 1% • 14.6K tokens
  • Detailed Tooltip: Hover to see comprehensive usage stats:

    • 5-hour token quota with progress bar
    • 7-day usage (prompts + tokens)
    • 30-day usage (prompts + tokens)
    • Connection status and last update time
  • Quick Pick Menu: Click status bar for detailed stats and actions

    • View all usage metrics
    • Refresh usage data
    • Configure settings
  • Automatic Refresh: Configurable refresh interval (default: 5 minutes)

  • Secure API Key Storage: Uses VS Code's encrypted SecretStorage

Installation

VS Code

Search for "Z.ai GLM Usage Tracker" in the Extensions marketplace, or:

ext install melon-hub.zai-usage-tracker

Windsurf / VSCodium / Other Forks

Available on Open VSX. Search for "Z.ai GLM Usage Tracker" in Extensions.

Cursor

Cursor uses a curated marketplace. Install manually:

  1. Download the latest .vsix from GitHub Releases
  2. In Cursor: Extensions → ... menu → Install from VSIX
  3. Select the downloaded file

Building from Source

npm install
npm run compile
npx @vscode/vsce package

Configuration

API Key

You need a Z.ai API key to use this extension:

  1. Go to Z.ai API Key Management
  2. Create or copy your API key
  3. Click the status bar item or run command Z.ai Usage Tracker: Configure Settings
  4. Select "Update API Key" and paste your key
  5. Your key is stored securely in VS Code's encrypted storage

Plan Tier

Set your GLM Coding Plan tier:

{
  "zaiUsage.planTier": "lite"  // Options: "lite", "pro", "max"
}
  • Lite: ~120 prompts every 5 hours
  • Pro: ~600 prompts every 5 hours
  • Max: ~2400 prompts every 5 hours

Refresh Interval

Set how often to fetch usage data (in minutes):

{
  "zaiUsage.refreshInterval": 5
}

Minimum: 1 minute, Default: 5 minutes

Usage

Once configured, the extension will:

  1. Automatically activate when VS Code/Cursor starts
  2. Display usage in the status bar: ✓ ⚡ 1% • 14.6K tokens
  3. Update periodically based on your refresh interval
  4. Show detailed tooltip on hover
  5. Provide quick actions on click

Commands

  • zaiUsage.refresh: Manually refresh usage data
  • zaiUsage.configure: Open configuration menu
  • zaiUsage.showMenu: Show quick actions menu

Status Bar Display

The status bar shows:

  • Connection Status: ✓ (connected) or ⚠ (offline/error)
  • Icon: Lightning bolt ⚡
  • Percentage: 5-hour token quota percentage (e.g., 1%)
  • Tokens: Current tokens used (e.g., 14.6K tokens)

Example: ✓ ⚡ 1% • 14.6K tokens

Background color indicates usage level:

  • Normal background: < 80% quota used
  • Warning background: ≥ 80% quota used

Development

npm run compile      # Compile TypeScript
npm run watch        # Watch mode
npx vsce package     # Package VSIX

See CLAUDE.md for full development and publishing workflow.

How It Works

  1. API Service: Attempts to fetch usage data from Z.ai's API endpoints
  2. Fallback: If no API endpoint is available, uses local tracking
  3. Configuration: Stores API key and settings in VS Code configuration
  4. Display: Updates status bar with current usage and progress
  5. Refresh: Periodically fetches updated data (configurable interval)

API Endpoints

The extension uses the official Z.ai monitor API endpoints:

  • https://api.z.ai/api/monitor/usage/quota/limit - 5-hour token quota
  • https://api.z.ai/api/monitor/usage/model-usage - Model usage stats (with time range)

Debugging

Run the debug command to see raw API responses:

  • Command: Z.ai Usage Tracker: Debug: Show Raw API Responses

Privacy

  • Your API key is stored securely in VS Code's encrypted SecretStorage
  • Usage data is only fetched from Z.ai's official API
  • No personal data or code is sent to external services
  • All data processing happens locally

Troubleshooting

"API key not configured"

  • Click the status bar item and select "Update API Key"
  • Or use Ctrl+Shift+P → "Z.ai Usage Tracker: Configure Settings"

"Failed to fetch usage"

  • Check your internet connection
  • Verify your API key is valid at z.ai/manage-apikey
  • Try clicking "Retry" in the error message
  • Run the debug command to see raw API responses

License

MIT

Support

For issues or questions:

  • Open an issue on GitHub
  • Check the Z.ai Documentation
  • Contact Z.ai support for API-related questions

Contributing

Contributions welcome! See CLAUDE.md for development and publishing workflow.

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