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

vantageaiops

v1.0.1

Published

LLM cost tracking and AI API monitoring SDK for TypeScript and JavaScript — track OpenAI, Anthropic, Google and Mistral spending

Downloads

109

Readme

vantageaiops

LLM cost tracking and AI API monitoring SDK for TypeScript and JavaScript.

Track token usage, cost, latency and quality for OpenAI, Anthropic, Google and Mistral — with one line of code.

npm License: MIT

Install

npm install vantageaiops
# peer deps — install whichever providers you use
npm install openai              # for OpenAI proxy
npm install @anthropic-ai/sdk   # for Anthropic proxy

Quickstart — OpenAI

import { init, createOpenAIProxy } from "vantageaiops";
import OpenAI from "openai";

// 1. Init once (e.g. in app startup)
init({ apiKey: "vnt_your_key" });

// 2. Wrap your OpenAI client — zero other changes needed
const openai = createOpenAIProxy(new OpenAI());

// 3. Use normally — every call is automatically tracked
const res = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
});

Quickstart — Anthropic

import { init, createAnthropicProxy } from "vantageaiops";
import Anthropic from "@anthropic-ai/sdk";

init({ apiKey: "vnt_your_key" });
const client = createAnthropicProxy(new Anthropic());

const res = await client.messages.create({
  model: "claude-3-5-sonnet-20241022",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello!" }],
});

Manual tracking

import { getClient } from "vantageaiops";

getClient().capture({
  eventId: crypto.randomUUID(),
  provider: "openai",
  model: "gpt-4o",
  promptTokens: 500,
  completionTokens: 120,
  totalCostUsd: 0.0035,
  latencyMs: 842,
  team: "search",
  environment: "production",
});

Agent / multi-step traces

import { init, trace } from "vantageaiops";
import OpenAI from "openai";

init({ apiKey: "vnt_your_key" });

const traceId = crypto.randomUUID();

// Wrap each LLM call with trace() to group them
const step1 = await trace(
  () => openai.chat.completions.create({ model: "gpt-4o", messages: [...] }),
  { traceId, spanDepth: 0, team: "agent" }
);

const step2 = await trace(
  () => openai.chat.completions.create({ model: "gpt-4o-mini", messages: [...] }),
  { traceId, spanDepth: 1, team: "agent" }
);

Traces appear in the Agent Traces tab of your dashboard with per-span cost breakdown.

Cost calculator

import { calculateCost, findCheapest } from "vantageaiops";

const cost = calculateCost("gpt-4o", 10_000, 2_000);
console.log(`Cost: $${cost.totalCostUsd.toFixed(4)}`);

const alt = findCheapest("gpt-4o", 10_000, 2_000);
console.log(`Save ${((cost.totalCostUsd - alt.costUsd) / cost.totalCostUsd * 100).toFixed(0)}% with ${alt.model}`);

Configuration

import { init } from "vantageaiops";

init({
  apiKey: "vnt_your_key",
  org: "acme",                         // auto-parsed from key if omitted
  team: "platform",                    // default team tag
  environment: "production",           // default: "production"
  ingestUrl: "https://api.vantageaiops.com", // default
  flushInterval: 2,                    // seconds between auto-flush
  batchSize: 50,                       // events per HTTP request
  debug: false,
});

Links