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

useleak

v0.4.0

Published

Drop-in cost tracking for Anthropic, OpenAI, and Google Gemini SDKs — see exactly where your LLM spend goes.

Readme

useleak (typescript)

Drop-in cost tracking for the Anthropic TypeScript SDK. See exactly where your LLM spend goes — broken down by feature, user, and model.

Install

pnpm add useleak
# or
npm install useleak
# or
yarn add useleak

Usage

Get a workspace SDK key from Settings → Workspace SDK key in your Leak dashboard. Set it as LEAK_KEY in your env (alongside ANTHROPIC_API_KEY).

import Anthropic from "useleak";

const client = new Anthropic();  // picks up ANTHROPIC_API_KEY + LEAK_KEY

const response = await client.messages.create({
  model: "claude-opus-4-7",
  feature: "icp-scoring",     // ← the one extra param Leak needs
  user: "user_123",            // optional but lets you group by customer
  max_tokens: 1024,
  messages: [{ role: "user", content: "..." }],
});

console.log(response.content);

That's it. Every call gets tracked to your Leak dashboard within a few seconds: model, tokens in/out, cost, feature, user, request ID.

API

new Anthropic(opts) accepts every option the official @anthropic-ai/sdk accepts, plus two of its own:

| Option | Default | Description | |---|---|---| | leakKey | LEAK_KEY env | Your workspace SDK key (lk_live_...) | | leakUrl | https://useleak.cloud/api/ingest | Ingest endpoint, override only if self-hosting |

client.messages.create({...}) accepts every parameter the Anthropic SDK accepts, plus three of its own:

| Field | Required | Description | |---|---|---| | feature | recommended | The feature in your app that triggered this call ("icp-scoring", "playground", etc.) | | user | optional | An end-user identifier — lets you see who is burning tokens | | api_key_label | optional | Free-form label like "Production" / "Staging" |

Tracking is async and non-blocking (using fetch with keepalive: true). If useleak.cloud is down, your Anthropic call still succeeds — Leak failures never propagate.

What it tracks

  • model
  • input tokens / output tokens
  • USD cost (computed locally from the Anthropic price table)
  • feature, user, api_key_label (your tags)
  • Anthropic request ID

It does not send prompts, responses, or any message content.

Runtimes

Works on Node 18+, Bun, Deno, Cloudflare Workers, Vercel Edge — anywhere fetch exists.

License

MIT