npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

glm-plan-usage

v0.0.1

Published

GLM usage status plugin for Claude Code

Readme

GLM Usage Status Plugin

A Claude Code plugin that displays GLM (ZHIPU/ZAI) coding plan usage statistics in the status bar.

Features

  • Real-time Usage Tracking: Displays token and MCP usage percentages
  • Color-coded Warnings:
    • Green (0-79%): Normal usage
    • Yellow (80-94%): High usage
    • Red (95-100%): Critical usage
  • Smart Caching: 5-minute cache to reduce API calls
  • Automatic Platform Detection: Supports both ZAI and ZHIPU platforms
  • Graceful Degradation: Silently fails on API errors

Installation

Method 1: Via npm (Recommended ⭐)

The easiest way to install and manage the plugin:

npm install -g glm-plan-usage

This installs the plugin globally and makes it available as glm-plan-usage in your terminal.

Initialize Configuration:

glm-plan-usage --init

Verify Installation:

glm-plan-usage --help

Supported Platforms:

  • ✅ Linux (x64, arm64)
  • ✅ macOS (Intel, Apple Silicon)
  • ✅ Windows (x64)

Method 2: Manual Installation from Source

Build from source if you prefer or need customization:

1. Build

cd glm-plan-usage
cargo build --release

2. Install

mkdir -p ~/.claude/glm-plan-usage
cp target/release/glm-plan-usage ~/.claude/glm-plan-usage/
chmod +x ~/.claude/glm-plan-usage/glm-plan-usage

3. Initialize Configuration

~/.claude/glm-plan-usage/glm-plan-usage --init

This creates a default config at ~/.claude/glm-plan-usage/config.toml:

[style]
mode = "plain"
separator = " | "

[[segments]]
id = "glm_usage"
enabled = true

[segments.colors]
text = { c256 = 109 }  # Default green

[segments.styles]
text_bold = true

[api]
timeout_ms = 5000
retry_attempts = 2

[cache]
enabled = true
ttl_seconds = 300

4. Configure Claude Code

If installed via npm:

Edit ~/.config/claude-code/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "glm-plan-usage",
    "padding": 0
  }
}

If installed manually:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/glm-plan-usage/glm-plan-usage",
    "padding": 0
  }
}

5. Set Environment Variables

Add to your ~/.bashrc or ~/.zshrc:

export ANTHROPIC_AUTH_TOKEN="your-token-here"
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"

Usage

The plugin automatically displays usage in the format:

T:42% M:15%

Where:

  • T:42% = Token usage (5-hour window)
  • M:15% = MCP usage (30-day window)

Using the npm-installed Version

Initialize config:

glm-plan-usage --init

Test the plugin:

# Set environment variables
export ANTHROPIC_AUTH_TOKEN="your-token"
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"

# Test with sample input
echo '{"model":{"id":"test"}}' | glm-plan-usage

Update config manually (if needed):

# Edit config directly
nano ~/.claude/glm-plan-usage/config.toml

# Or reinitialize
glm-plan-usage --init

CLI Options

glm-plan-usage [OPTIONS]

Options:
  --init        Initialize configuration file
  --verbose     Enable verbose output
  --no-cache    Disable cache
  -h, --help    Print help

Configuration

Style Settings

[style]
mode = "plain"  # plain, nerd_font, powerline
separator = " | "

Segment Colors

[[segments]]
id = "glm_usage"
enabled = true

[segments.colors]
text = { c256 = 109 }  # 256-color palette
# OR RGB:
# text = { r = 34, g = 197, b = 94 }

API Settings

[api]
timeout_ms = 5000      # HTTP timeout
retry_attempts = 2     # Number of retries

Cache Settings

[cache]
enabled = true
ttl_seconds = 300      # 5 minutes

API Endpoints

The plugin queries the GLM API:

  • Quota Limits: GET /api/monitor/usage/quota/limit
  • Token Usage: GET /api/monitor/usage/model-usage
  • MCP Usage: GET /api/monitor/usage/tool-usage

Error Handling

The plugin gracefully handles errors:

  • Missing environment variables → No output
  • API timeout → Uses cached data (if available)
  • API errors → Uses cached data (if available)
  • No cache → Silent failure

Use --verbose to debug issues:

# If installed via npm
glm-plan-usage --verbose < input.json

# If installed manually
~/.claude/glm-plan-usage/glm-plan-usage --verbose < input.json

Updating

Via npm

# Update to the latest version
npm update -g glm-plan-usage

# Or reinstall
npm install -g glm-plan-usage@latest

Manual Installation

# Rebuild from source
cd glm-plan-usage
cargo build --release

# Reinstall
cp target/release/glm-plan-usage ~/.claude/glm-plan-usage/

Development

Project Structure

glm-plan-usage/
├── Cargo.toml
├── README.md
└── src/
    ├── main.rs              # Entry point
    ├── cli.rs               # CLI parsing
    ├── lib.rs               # Library root
    ├── config/
    │   ├── mod.rs
    │   ├── types.rs         # Config types
    │   └── loader.rs        # Config loading
    ├── core/
    │   ├── mod.rs
    │   ├── statusline.rs    # ANSI rendering
    │   └── segments/
    │       ├── mod.rs
    │       └── glm_usage.rs # GLM usage segment
    └── api/
        ├── mod.rs
        ├── client.rs        # HTTP client
        └── types.rs         # API types

Build Release

cargo build --release

The binary is stripped and optimized for size.

License

MIT