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

@redlasha/ai-usage-monitor

v0.2.2

Published

Local collector + Worker backend for Claude/Codex usage history. Pushes snapshots to a central Worker so multiple machines aggregate into one timeline.

Readme

AI Usage Monitor

Claude Code, OpenAI 사용량을 수집/저장하고 Claude Code 안에서 MCP tool로 조회할 수 있는 마이크로 모니터링 서비스.

Architecture

Claude Code → MCP tool 호출 → MCP Server (로컬)
                                  ├─ Claude OAuth token (로컬 파일)
                                  ├─ OpenAI Admin Key (env)
                                  ├─ 각 API에서 사용량 fetch
                                  ├─ Workers에 snapshot push (영속 저장)
                                  └─ Workers에서 히스토리 query → 결과 반환

MCP Tools

| Tool | Description | |------|-------------| | get_usage | 현재 사용량 조회 (Claude/OpenAI/both) | | get_history | 히스토리 조회 (provider, since, limit 필터) | | compare_providers | Claude vs OpenAI 비교 분석 |

Setup

1. Cloudflare Workers

npx wrangler login
npx wrangler d1 create ai-usage-monitor-db
# wrangler.toml의 database_id를 업데이트
npx wrangler d1 execute ai-usage-monitor-db --file=schema.sql
npx wrangler secret put API_KEY
npm run deploy

2. MCP Server 등록

~/.claude/settings.json:

{
  "mcpServers": {
    "ai-usage-monitor": {
      "command": "node",
      "args": ["/absolute/path/to/ai-usage-monitor/dist/mcp.mjs"],
      "env": {
        "WORKER_URL": "https://ai-usage-monitor.YOUR_SUBDOMAIN.workers.dev",
        "WORKER_API_KEY": "your-api-key",
        "OPENAI_ADMIN_KEY": "sk-admin-..."
      }
    }
  }
}

3. OpenAI Admin Key

OpenAI Admin API Keys에서 발급.

Development

npm install
npm run build          # Build both worker + MCP
npm run build:worker   # Worker only
npm run build:mcp      # MCP only
npx wrangler dev       # Local Workers dev server

Workers API

| Method | Path | Auth | Description | |--------|------|------|-------------| | GET | /health | No | Health check | | POST | /api/snapshots | Yes | Push snapshot | | GET | /api/snapshots?provider=claude&since=7d&limit=100 | Yes | Query history | | GET | /api/dashboard | Yes | Latest per provider |