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

tokenoscopy

v0.5.0

Published

Flight recorder & spend control for AI agents and the apps that call Claude. Records Claude Code sessions, enforces budgets, and puts stop-limits on production Anthropic API spend.

Readme

tokenoscopy

Flight recorder & spend control for coding-agent fleets — and stop-limits for the production apps that call Claude. Records every Claude Code session — every prompt, tool call, file edit, and dollar — into a replayable timeline with budgets that can actually stop a runaway run.

npm install -g tokenoscopy
tokenoscopy init

No key to paste: init opens your browser to pair the machine with your workspace, you confirm the code it shows, and it finishes in the terminal. The Setup screen at tokenoscopy.com then waits for your first session and shows it to you as it lands. Headless or CI? Pass a key from Settings → Ingest keys with --key tok_… (or TOKENOSCOPY_KEY).

Install globally rather than relying on npx: the budget guard runs before every Bash and MCP tool call, and npx re-resolves the package each time.

Production apps: tokenoscopy/anthropic

For apps and jobs that call the Anthropic API directly — no Claude Code session, no admin key:

import Anthropic from "@anthropic-ai/sdk";
import { monitor, flush } from "tokenoscopy/anthropic";

const anthropic = monitor(new Anthropic(), { service: "checkout-api" });
const msg = await anthropic.messages.create({ /* unchanged */ });

// Serverless: upload before the function returns.
await flush();
  • Reports counts, never content. Token counts, request and error counts, the model, and the service / feature labels you give it — uploaded every 10 seconds with TOKENOSCOPY_KEY. Tokenoscopy prices them.
  • Stop-limits, enforced in your app. Set a block limit for a service on the Production page. The wrapper refreshes the decision every 15 seconds in the background (no added latency) and throws TokenoscopyLimitError before the next call is sent. onLimit: "warn" logs instead.
  • Fails open, always. No key, no network, a timeout, a bad response, or a Tokenoscopy outage — the call goes through. Only an explicit block stops one.
  • Any runtime. One self-contained file with no imports: Node, Bun, Deno, Vercel Functions, edge. Works with the Bedrock / Vertex / Foundry clients too (same messages surface).

Observed: messages.create (streaming and not), messages.parse, messages.stream, and their beta.messages twins. Not observed: withResponse() on a streaming create, a raw stream consumed via toReadableStream(), and the Batches API.

Commands

| Command | What it does | |---|---| | init | Wires Claude Code hooks (live events + transcript flush + budget guard) into ~/.claude/settings.json. Idempotent; keeps a backup; never touches your other hooks. --project targets ./.claude/settings.json for CI. --print shows the config without writing. | | flush | Parses the current session transcript, computes list-price spend, redacts secrets client-side, uploads. Called by hooks; safe to run manually with --transcript <path>. | | guard | PreToolUse budget check. Hard 1500ms timeout; every failure path fails open — your session never stalls on us. | | tail | Watches ~/.claude/projects and flushes transcripts as they change. --backfill uploads the last 7 days first; --since <days> widens that and relabels each session's billing lane. | | doctor | Verifies config, hook wiring, API reachability, key validity, and the billing lane (with the evidence that decided it). |

Privacy

Redaction runs on your machine before anything uploads: credential shapes (Anthropic/OpenAI/GitHub/Slack/AWS/Google/Stripe), JWTs, private-key blocks, Authorization headers, connection-string passwords, secret assignments, and emails in content. Replays include the paths of files the agent read or edited (and each one relative to the repo root); branch drift is counted from local git refs, with no network call.

Environment

  • TOKENOSCOPY_KEY — ingest key (overrides config file; use in CI)
  • TOKENOSCOPY_API_URL — API base (default https://tokenoscopy.com)
  • TOKENOSCOPY_CONFIG_DIR — config location (default ~/.config/tokenoscopy)

MIT © Tokenoscopy