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-agent-budget

v0.1.6

Published

Pi extension: AI coding cost tracker with widget, budget limits, and CNY pricing for Chinese models.

Readme

pi-agent-budget

Pi extension: real-time AI coding cost tracking with budget limits and native CNY pricing for Chinese models.

Track token usage and costs as you chat with AI. A live widget sits below the input box showing your spending, with soft/hard budget limits to prevent surprise bills.


Features

  • 👁️ Real-time cost tracking — every assistant message is recorded: tokens × pricing = cost
  • 📊 Status bar widget — live display below the editor: ¥0.16 / ¥10.00 ██░░░░ (model + cost + budget + progress bar)
  • 🇨🇳 CNY pricing for Chinese models — deepseek / qwen / glm / kimi / doubao priced in RMB with auto FX conversion (1 USD ≈ 7.2 CNY)
  • 🛡️ Soft/hard budget limits — 80% triggers a warning card, 100% blocks further input
  • 📈 /budget dashboard — overview + budget settings + pricing table + config, all in a TUI panel
  • 📋 /budget report — cost breakdowns by model / tool / session

Install

pi install npm:pi-agent-budget

Depends on better-sqlite3 (native C++ addon). Requires build toolchain on first install: Xcode CLT on macOS (xcode-select --install), build-essential on Linux.


Commands

/budget                     # Dashboard (overview / budget / pricing / settings)
/budget set <amount>        # Set session budget      e.g. /budget set 2
/budget set project <amount> # Set project daily budget
/budget report [range]      # Cost report             e.g. /budget report week
/budget by <dim> [range]    # Slice by model / tool / session
/budget widget              # Widget appearance settings
/budget export              # Export cost data

Configuration

Edit via /budget config or ~/.pi/budget.json:

{
  "session": { "usd": 2.00 },
  "pricingAnchor": "followModel",
  "widget": {
    "placement": "belowEditor",
    "compact": false,
    "showModel": true,
    "showProgressBar": true,
    "showContextWindow": true
  }
}

| Setting | Description | Default | |---|---|---| | session.usd | Session budget in USD | Unlimited | | pricingAnchor | Currency anchor: followModel / cny / usd | followModel | | widget.placement | Widget position: belowEditor / aboveEditor | belowEditor | | widget.compact | Minimal mode (cost only) | false | | softLimitRatio | Soft limit threshold | 0.8 | | hardLimitRatio | Hard limit threshold | 1.0 |

Currency handling

  • followModel (default): Chinese models (deepseek/qwen/glm etc.) display in ¥, Western models display in $
  • cny: Everything in RMB, budget presets use RMB amounts
  • usd: Everything in USD

Chinese models use RMB price tables internally; all costs are stored in USD for consistent cross-model aggregation, with display-time conversion.


Data storage

| File | Purpose | |---|---| | ~/.pi/budget.db | SQLite (costs / budgets / alerts) | | ~/.pi/budget.json | User configuration |


Development

npm run check          # TypeScript type check
pi -e ./src/index.ts   # Local dev testing

License

MIT