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

@fyeeme/pi-statusline

v1.2.8

Published

Rich custom status bar for pi with token usage, cost, DeepSeek balance, context window, and timing.

Readme

pi-statusline

npm version License

A rich custom status bar for pi that replaces the default footer. Provider-aware: shows live account balance for DeepSeek and rolling quota for GLM/ZAI, plus session tokens, cost, context window, and timing.

Features

  • Provider-aware usage — special support for DeepSeek and GLM/ZAI (see Provider Support)
  • DeepSeek peak/off-peak pricing — session cost follows DeepSeek's 2026-08-17 peak/off-peak billing (peak 9:00-12:00 / 14:00-18:00 Beijing time on weekdays; weekends are off-peak all day since 2026-08-23), priced per-message by timestamp, with a live peak/off-peak indicator in the footer (see DeepSeek)
  • Token usage: compact tokens 78.9%(↑in ↓out Rcache) segment with cache hit rate
  • Cost: cumulative session cost with currency auto-detection (¥ for DeepSeek/CNY, $ otherwise)
  • Context window: usage percentage and size
  • Timing: elapsed time + tokens/sec for last response
  • Git branch: current branch shown in cwd display

Provider Support

This extension uses a provider-aware strategy: when the active model belongs to a supported provider, the status bar shows live account-level usage data fetched directly from that provider's API. Other providers fall back to session-scoped cost only.

DeepSeek

Shows live account balance, weekly token usage, and peak/off-peak aware session cost. Since DeepSeek introduced peak/off-peak pricing on 2026-08-17, pi-statusline tracks it automatically.

Peak / Off-peak pricing (since 2026-08-17)

DeepSeek now bills in two periods — peak hours are 9:00-12:00 and 14:00-18:00 Beijing time (UTC+8) on weekdays, all other hours are off-peak, and off-peak is half the peak price. Since 2026-08-23 00:00 Beijing time, weekends (Saturday/Sunday) no longer distinguish periods and bill at the off-peak price all day. Official CNY prices per million tokens:

| Model | Period | Cache-hit input | Cache-miss input | Output | |---|---|---|---|---| | deepseek-flash | off-peak / peak | ¥0.02 / ¥0.04 | ¥1 / ¥2 | ¥4 / ¥8 | | deepseek-v4-pro | off-peak / peak | ¥0.15 / ¥0.30 | ¥4.5 / ¥9.0 | ¥13.5 / ¥27.0 |

  • Legacy model ids — deepseek-v4-flash and deepseek-v4-flash-vision-exp are retired but still callable; requests are served by DeepSeek-V4.1-Flash and billed at the Flash rates, so they share the deepseek-flash prices.

  • Per-message pricing by timestamp — each message is priced at the rate of its own time (AssistantMessage.timestamp), so a long session spanning a period boundary (9:00/12:00/14:00/18:00) accounts every message correctly instead of using a single fixed rate.

  • Peak/off-peak indicator — the footer appends the current period so you always know which rate is in effect: peak during weekday 9:00-12:00 / 14:00-18:00 Beijing time, off-peak otherwise (including all day on weekends since 2026-08-23):

    ¥0.12/50.00 · wk:1.2M · off-peak
    ¥0.12/50.00 · wk:1.2M · peak
  • Registry pricing patch — for CNY-billed accounts the model registry cost is aligned to the current period at runtime (and re-aligned automatically when the period flips), so pi's recorded usage.cost tracks the period too.

  • USD-billed accounts keep pi's built-in USD prices (no CNY override, no peak/off-peak indicator).

Balance & weekly tokens

| Segment | Example | Source | |---------|---------|--------| | Balance | ¥0.12/50.00 | GET /user/balance (cached 5 min) | | Weekly tokens | wk:1.2M | Local session file scan (current natural week, Monday 00:00 local) |

  • Currency auto-detected as ¥ (CNY) from the balance API response
  • Balance is fetched on startup and refreshed in the background; cached for 5 minutes
  • Triggered when model.provider === "deepseek"

GLM / ZAI

Shows 5-hour rolling quota and weekly quota (or natural-week usage as fallback).

| Segment | Example | Source | |---------|---------|--------| | 5h quota | 5h 42%(1.2M,1h23m) | quota/limit (unit:3) + model-usage API | | Weekly quota | wk 35%(12M,3d4h) | quota/limit (unit:6) + model-usage API | | Natural week | wk 1.2M | model-usage API (Mon 00:00 local → now) |

  • 5-hour rolling window: percentage used, in-window token usage, countdown to reset
  • Weekly quota: if the plan exposes a unit:6 weekly limit, shows percentage, in-week token usage, and reset countdown; otherwise falls back to real usage for the current natural week (host local timezone)
  • Account level: also fetched (visible in /status-debug)
  • Supports both zai (api.z.ai) and zai-coding-cn (open.bigmodel.cn) endpoints

Other providers

Session-scoped cost only ($0.12 or ¥0.12), with no live account data.

Install

Requires the pi CLI.

From npm (recommended)

# Global (user) install — available in every project
pi install @fyeeme/pi-statusline

# Project-local — written to .pi/settings.json, shareable with your team
pi install -l @fyeeme/pi-statusline

# Pinned version — skipped by `pi update`
pi install @fyeeme/[email protected]

# Try it once without saving (current run only)
pi -e @fyeeme/pi-statusline

From GitHub

Source: fyeeme/pi-packages.

# HTTPS shorthand
pi install git:github.com/fyeeme/pi-packages
# Pin to a tag or commit (skipped by `pi update`)
pi install git:github.com/fyeeme/[email protected]
# Raw URL form
pi install https://github.com/fyeeme/pi-packages

See the Pi Packages guide on pi.dev for the full list of source types, scopes, and pi update behavior.

Commands

| Command | Description | |---|---| | /currency [auto\|¥\|$] | Toggle cost currency display (auto follows DeepSeek → ¥) | | /status-debug | Dump session stats + provider usage to /tmp/pi-status-debug.log |

Status Bar Layout

~/projects/my-repo (main)                    deepseek-v4-pro · xhigh
tokens 78.9%(↑12k ↓8k R45k) · ¥0.12/50.00 · wk:1.2M · off-peak · Ctx 45.2%/64k · 2m30s 38.2tok/s

Line 1: cwd + git branch (left) | model + thinking level (right)

Line 2: token stats · provider usage (incl. DeepSeek peak/off-peak indicator) · context window · timing

GLM/ZAI example

~/projects/my-repo (main)                       glm-4.6 · high
tokens 78.9%(↑12k ↓8k R45k) · 5h 42%(1.2M,1h23m) · wk 35%(12M,3d4h) · Ctx 45.2%/64k · 2m30s 38.2tok/s

Environment Variables

None required. API keys are resolved automatically by pi's model registry for the active provider.

How It Works

The extension registers a UsageProvider per supported provider and refreshes usage data in the background (on startup, on model switch, and after each agent run). Results are cached with a 5-minute TTL (DeepSeek) or per-refresh (ZAI) to avoid hammering the provider APIs.

All network calls are best-effort with a 5-second timeout — failures stay silent and never block the status bar.

Platform API note: the custom footer relies on ctx.ui.setFooter's third parameter — footerData: ReadonlyFooterDataProvider (for getGitBranch/getExtensionStatuses/onBranchChange) — and on returning dispose from the footer factory. These are part of the 0.84.x ExtensionAPI surface (see dist/core/extensions/types.d.ts), but pi's docs/extensions.md currently documents only the (tui, theme) form. If a future pi release changes the setFooter signature, check this extension's footer wiring first.

Changelog

See CHANGELOG.md.

License

MIT