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

agentmoney

v1.0.0

Published

Track what your AI agents actually spend. Real-time cost monitoring for Claude, OpenAI, and other LLM APIs.

Readme

agentmoney

npm version License: MIT TypeScript Node.js

Stop guessing what AI costs you. Real-time cost monitoring for Claude, OpenAI, and Gemini APIs.

You run Claude Code overnight. You wake up. Your API bill is $247. You have no idea which session burned it, which model was used, or whether prompt caching saved you anything.

agentmoney shows you exactly where every dollar goes.

Install

npm install -g agentmoney

Or run directly:

npx agentmoney demo

Quick Start

Calculate a single API call cost

# How much does a Sonnet call with 5K input / 1K output cost?
agentmoney calc -m claude-sonnet-4-6 -i 5000 -o 1000

# With prompt caching
agentmoney calc -m claude-sonnet-4-6 -i 5000 -o 1000 --cache-read 3000

Estimate a session cost

# 50 API calls, ~3K input / ~800 output each
agentmoney estimate -m claude-sonnet-4-6 -c 50 --avg-input 3000 --avg-output 800

See all model pricing

agentmoney models

Run the proxy (intercept real API calls)

# Start the proxy on port 8999
agentmoney proxy --port 8999 --alert 5.00

# Then point your API client at the proxy:
ANTHROPIC_BASE_URL=http://localhost:8999 your-app

# View live dashboard at http://localhost:8999/dashboard
# View cost JSON at http://localhost:8999/costs

Fetch real Anthropic usage

# Last 7 days
agentmoney usage

# Last 30 days, JSON output
agentmoney usage --days 30 --json

Run a demo simulation

agentmoney demo

Example Output

  agentmoney demo

  Simulating 8 API calls...

  ........

  agentmoney summary
  ──────────────────────────────────────────────────

    Total cost:      $0.1842
    Total calls:     8
    Sessions:        1

    By provider:
      anthropic       $0.1732  (7 calls)
      openai          $0.0110  (1 calls)

    By model:
      claude-sonnet-4-6              $0.1041  (4 calls, 37.8K tokens)
      claude-opus-4-6                $0.0750  (1 calls, 5.8K tokens)
      claude-haiku-4-5               $0.0027  (2 calls, 3.0K tokens)
      gpt-4o                         $0.0110  (1 calls, 2.6K tokens)

Commands

| Command | Description | | --------------------- | ------------------------------------------------------ | | agentmoney | Show quick start guide and available commands | | agentmoney demo | Simulate 8 API calls and see the cost breakdown | | agentmoney calc | Calculate cost for a single API call | | agentmoney estimate | Estimate cost for a multi-call session | | agentmoney models | List all supported models and pricing | | agentmoney proxy | Start a local proxy with web dashboard + cost tracking | | agentmoney usage | Fetch real usage data from the Anthropic API |

Proxy Mode

The proxy sits between your application and the AI API, intercepting responses to extract token usage and calculate costs in real-time.

Your App → agentmoney proxy (localhost:8999) → api.anthropic.com
                ↓
          Cost tracking
          Web dashboard (Chart.js)
          JSONL call log
          Session reports

Proxy Endpoints

| Path | Description | | ---------------- | --------------------------------------------------------------------------------------- | | GET /dashboard | Web dashboard with Chart.js charts (cost per agent/day, model breakdown, hourly trends) | | GET /health | Proxy status + total cost (JSON) | | GET /costs | Full cost breakdown (JSON API) | | * /* | All other requests proxied to the target |

Alert Thresholds

# Warn when session cost exceeds $5
agentmoney proxy --alert 5.00

Supported Models & Pricing

Pricing is current as of March 2026. Fuzzy model name matching handles date suffixes (claude-sonnet-4-6-20260301) and provider prefixes (anthropic/claude-sonnet-4-6). Unknown models default to Sonnet-tier pricing ($3/$15).

Anthropic

| Model | Input/MTok | Output/MTok | Cache Read/MTok | Cache Write/MTok | | ----------------- | ---------- | ----------- | --------------- | ---------------- | | claude-opus-4-6 | $5.00 | $25.00 | $0.50 | $6.25 | | claude-opus-4-5 | $5.00 | $25.00 | $0.50 | $6.25 | | claude-sonnet-4-6 | $3.00 | $15.00 | $0.30 | $3.75 | | claude-sonnet-4-5 | $3.00 | $15.00 | $0.30 | $3.75 | | claude-haiku-4-5 | $1.00 | $5.00 | $0.10 | $1.25 | | claude-opus-4-1 | $15.00 | $75.00 | $1.50 | $18.75 | | claude-3-5-haiku | $0.80 | $4.00 | $0.08 | $1.00 | | claude-3-haiku | $0.25 | $1.25 | $0.03 | $0.30 |

OpenAI

| Model | Input/MTok | Output/MTok | Cache Read/MTok | | ------------ | ---------- | ----------- | --------------- | | gpt-4.1 | $2.00 | $8.00 | $0.50 | | gpt-4.1-mini | $0.40 | $1.60 | $0.10 | | gpt-4.1-nano | $0.10 | $0.40 | $0.025 | | gpt-4o | $2.50 | $10.00 | $1.25 | | gpt-4o-mini | $0.15 | $0.60 | $0.075 | | o3 | $2.00 | $8.00 | $0.50 | | o4-mini | $1.10 | $4.40 | $0.275 | | o1 | $15.00 | $60.00 | — |

Google

| Model | Input/MTok | Output/MTok | | ---------------- | ---------- | ----------- | | gemini-2.0-flash | $0.10 | $0.40 | | gemini-2.0-pro | $1.25 | $5.00 | | gemini-1.5-flash | $0.075 | $0.30 |

Reports

agentmoney saves reports to .agentmoney/:

  • calls.jsonl — Every API call as a JSON line (append-only log)
  • report-YYYY-MM-DD.json — Daily cost report (structured data)
  • report-YYYY-MM-DD.md — Daily cost report (markdown, shareable)

Configuration

| Flag | Default | Description | | ------------------ | --------------------------- | ----------------------------------------- | | --port <n> | 8999 | Proxy port | | --target <url> | https://api.anthropic.com | Target API URL | | --alert <amount> | none | Warn when session cost exceeds this (USD) | | --json | false | Output as JSON (calc, models, usage) | | --model <id> | required | Model name for calc/estimate | | --days <n> | 7 | Days to fetch for usage command |

Anthropic Usage API

Fetch your real API spending directly from Anthropic (no proxy needed):

agentmoney usage --days 30

Calls the Anthropic /v1/usage endpoint and calculates costs using the same pricing engine. Requires ANTHROPIC_API_KEY with admin-level permissions.

How It Works

  1. Proxy mode: Express server intercepts API responses, extracts the usage block (input_tokens, output_tokens, cache tokens), calculates cost using built-in pricing tables, logs to JSONL, serves web dashboard
  2. Calc mode: Pure math — model + tokens = cost. No API calls needed.
  3. Estimate mode: Calc x number of calls. Quick session budgeting.
  4. Usage mode: Fetches real spending from the Anthropic API.
  5. Pricing engine: Fuzzy model name matching, supports 25+ models across 3 providers. Updated March 2026.

Contributing

PRs welcome. Especially:

  • Updated model pricing
  • New provider support (Mistral, Cohere, DeepSeek, etc.)
  • Better TUI dashboard (blessed/ink)
  • Historical cost tracking and trends
  • Budget limits and alerts

License

MIT