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

pi-supergrok-usage

v0.1.2

Published

Pi coding-agent extension that surfaces xAI / SuperGrok usage limits

Readme

pi-supergrok-usage

Pi coding-agent extension that surfaces SuperGrok weekly usage and the latest xAI request rate window in the TUI footer and via /xai-usage.

Why

Pi already shows session tokens, cost, and context fill. It does not show SuperGrok subscription quota. This extension fetches the same Grok billing payload that ai-usagebar reads through Grok Build, then also shows the request window from after_provider_response headers when those fields exist.

Status

Shipped (0.1.2): SuperGrok weekly %, footer status, and /xai-usage.

On session start (and after an xAI call) the extension GETs https://cli-chat-proxy.grok.com/v1/billing?format=credits with the SuperGrok OAuth token from /login xai or ~/.grok/auth.json. The footer shows SG {percent}% · {reset} and appends {remaining}/{limit} RPM when a request window is cached. It clears when the active model is not xAI. /xai-usage refreshes billing and shows plan, percent, period, reset, prepaid balance, and the last RPM window.

Redacted samples: samples/grok-billing.json, samples/xai-after-provider-response.json.

Install

Requires Pi and SuperGrok auth via /login xai (Use a subscription) or grok login. An inference XAI_API_KEY is not enough for weekly quota.

# from git (current)
pi install git:github.com/MatheusBBarni/pi-supergrok-usage

# from npm (when published)
pi install npm:pi-supergrok-usage

# local checkout
pi install .
pi -e .

Usage

  • After load, or after an xAI / Grok response, the footer shows SG {percent}% · {reset} when billing succeeds.
  • A cached request window is appended as {remaining}/{limit} RPM.
  • The footer clears when the active model is not xAI. Switching back to xAI restores the last cached billing + RPM for this process.
  • /xai-usage refreshes SuperGrok billing and notifies plan, weekly/monthly percent, reset countdown, prepaid balance, and the last RPM window.

Limitations

  • Weekly percent comes from Grok's billing endpoint, not from rate-limit headers.
  • Token-window headers (x-ratelimit-*-tokens) are not shown.
  • Billing cache is in-memory with a 5-minute TTL — lost on restart or /new. /xai-usage always refetches.
  • OAuth refresh is left to Pi (/login xai) or Grok Build (grok login). A 401 means sign in again.
  • Pi session tokens and cost stay in the built-in footer / /session.

Safety

  • The access token is read only to send Authorization: Bearer and is never written to footer text or notify text.
  • No credentials are stored in this repo.

Approach

  1. Probe — inspect xAI after_provider_response headers after one Grok call
  2. Decide — SuperGrok weekly % from Grok billing; RPM from headers
  3. Ship — footer status, /xai-usage, cache last known values

Grok Build 1.0.4's ACP agent does not expose x.ai/billing (method not found). ai-usagebar calls that ACP method so it never touches tokens. This extension uses the same upstream Grok uses internally (/v1/billing?format=credits) with the OAuth token Pi or grok login already stored.

Non-goals

  • Scraping Cursor private backends
  • Inventing quota numbers from local token counts
  • Replacing Pi’s built-in session cost / context footer
  • Implementing Grok OAuth refresh

License

MIT