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

@mdrv/opencode-quota

v262.1.0

Published

OpenCode plugin for querying Z.AI GLM Coding Plan and GitHub Copilot usage statistics

Readme

opencode-quota

npm version License: MIT Build Status SonarQube Cloud

Reliability Rating Security Rating Maintainability Rating Quality Gate Status

OpenCode plugin for querying Z.ai GLM, GitHub Copilot, and Kimi usage statistics. Check quota limits, model usage, and MCP tool usage with manual commands.

Features

  • 📊 Multi-Platform Support: Query GLM, GitHub Copilot, and Kimi Coding Plans.
  • 🖱️ Manual-Only: Plugin only runs when you ask (no periodic background checks).
  • ⏱️ Human Durations: Clear reset timers (e.g., 24d 13h 6m 12s), hiding zero values.
  • 🔐 Secure Credential Discovery: Automatically fetches tokens from OpenCode auth context.
  • 📈 Visual Progress: Plain text progress bars and usage percentages.
  • Fail-Fast: Direct reporting without hidden retry loops.

Installation

Option 1: npm (Recommended)

# Install package
npm install opencode-glm-quota

# Run installer to configure OpenCode
npx opencode-glm-quota install

What the installer does:

  • Copies /glm_quota, /copilot_quota, and /kimi_quota commands to your OpenCode config.
  • Configures skill documentation in ~/.config/opencode/skills/.
  • Automatically adds the plugin to your OpenCode configuration.

Uninstall

npx opencode-glm-quota uninstall

Quick Start

Run any of the following commands in OpenCode:

/glm_quota      # Z.AI GLM Coding Plan statistics
/copilot_quota  # GitHub Copilot usage statistics
/kimi_quota    # Kimi Coding Plan usage statistics

CLI Usage

Check your quota directly from the terminal using the provided binaries:

# Check GLM quota
bun run bin/glm-quota.ts

# Check GitHub Copilot quota
bun run bin/copilot-quota.ts

# Check Kimi quota
bun run bin/kimi-quota.ts

CLI Flags

| Flag | Shorthand | Description | | --------- | --------- | ---------------------------------------- | | --debug | -d | Enable debug logging (hidden by default) | | --raw | | Output raw JSON (useful for scripting) | | --help | -h | Show help message |

Platform Features

Z.AI GLM

  • Shows TIME_LIMIT (1-month) and TOKENS_LIMIT (5-hour rolling window).
  • Detailed model usage counts and MCP tool usage statistics.

GitHub Copilot

  • Displays user login, subscription plan, and reset dates.
  • Shows usage for Chat, Completions, and Premium features.
  • Indicates if usage is "Unlimited".

Kimi

  • Shows total usage and 5-hour rolling window usage.
  • Displays specific "Time to Reset" for each quota window.

Output Example

--------------------------------------------------------
           Z.ai GLM Coding Plan Usage Statistics
--------------------------------------------------------
  Platform: Z.AI
  Period:   2026-02-22 09:00:00 -> 2026-02-23 08:59:59
--------------------------------------------------------
  QUOTA LIMITS
  - Token usage(5 Hour)      [###################--------]  40.5%
  - MCP usage(1 Month)       [####-----------------------]  12.3%
       Used: 123/1,000
       Reset in: 12d 4h 15m
--------------------------------------------------------
  MODEL USAGE (24h)
  - Total Tokens (24h): 12,500,000 (31% of 5h limit)
  - 5h Window Usage: 40.5% of 40,000,000
  - Total Calls: 1,234
--------------------------------------------------------
  TOOL/MCP USAGE (24h)
  - Network Searches: 5,678
  - Web Reads: 2,345
  - ZRead Calls: 890
--------------------------------------------------------

Error Handling

The plugin uses fail-fast error handling. If an API request fails or credentials are missing, it displays a plain text error message immediately.

--------------------------------------------------------
  ERROR: Z.ai Credentials Not Found
--------------------------------------------------------
  Please authenticate first:
  1. Run /connect in OpenCode TUI
  2. Select "Z.AI Coding Plan" or "Z.AI"
--------------------------------------------------------

API Reference

| Platform | Endpoint | | ------------------ | ---------------------------------------------- | | Z.AI GLM | https://api.z.ai/api/monitor/usage/* | | GitHub Copilot | https://api.github.com/copilot_internal/user | | Kimi | https://api.kimi.com/coding/v1/usages |

Development

Build & Test

# Build TypeScript
bun run build

# Run all tests
bun run test

# Format code
bun run fmt

Project Structure

src/
  index.ts              # Main plugin entry point
  api/
    client.ts           # Shared HTTPS client
    endpoints.ts        # Endpoint definitions
  utils/
    duration.ts         # d h m s formatting logic
    progress-bar.ts     # Plain text bar rendering
bin/
  glm-quota.ts          # CLI binary for GLM
  copilot-quota.ts      # CLI binary for Copilot
  kimi-quota.ts         # CLI binary for Kimi
  install.js            # Installation script
integration/
  command/              # /command slash commands
  skills/               # OpenCode skill docs

License

MIT © 2026

Changelog

See CHANGELOG.md for version history.

  • v2.62.0: Removed auto quota features; Added Copilot & Kimi support; Plain text output; CLI binaries.