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

mintlyr-sdk

v0.1.4

Published

The official JavaScript/TypeScript SDK for Mintlyr. Govern, optimize, and prove the ROI of your AI portfolio.

Readme

mintlyr-sdk

npm Downloads License

Add one function around your AI calls to automatically track cost, tokens, latency, and usage across OpenAI, Anthropic, Gemini, Groq, Azure OpenAI, and more—without logging prompts or responses.

Why Mintlyr?

Mintlyr SDK captures AI usage and sends telemetry to the Mintlyr platform, where you can monitor costs, usage trends, budgets, and ROI across your AI applications.

Supported Providers

| Provider | Supported | | ------------ | --------- | | OpenAI | ✅ | | Anthropic | ✅ | | Gemini | ✅ | | Azure OpenAI | ✅ | | Groq | ✅ | | OpenRouter | ✅ | | Mistral | ✅ | (Even if some are auto-detected by the SDK!)

Requirements

  • Node.js >= 18
  • Modern Browser
  • Mintlyr API Key

Installation

npm install mintlyr-sdk
# or
yarn add mintlyr-sdk
# or
pnpm add mintlyr-sdk

Quick Start

Initialize the SDK once at the entry point of your application (e.g., index.ts, app.tsx, or server.ts):

import { init } from 'mintlyr-sdk';

init({
  apiKey: "<YOUR_API_KEY>",
  // localMode: process.env.NODE_ENV !== 'production' // Set to true to disable telemetry during dev
});

Environment Variables

If you are using environment variables for your keys:

Next.js

NEXT_PUBLIC_MINTLYR_API_KEY=...

Node.js / Express

MINTLYR_API_KEY=...

Minimal Example

import { init, trackAI } from "mintlyr-sdk";

init({
  apiKey: "<YOUR_API_KEY>"
});

await trackAI({
  feature: "chat",
  call: async () => {
    return await myAiCall();
  }
});

Full Example with OpenAI

Then, wrap your AI calls with the trackAI wrapper:

import { trackAI } from 'mintlyr-sdk';
import OpenAI from 'openai';

const openai = new OpenAI();

async function generateReport(userId: string, prompt: string) {
  // The SDK automatically extracts tokens, measures latency, and calculates costs.
  const response = await trackAI({
    feature: 'generate_report',
    userId: userId, // Automatically hashed for privacy
    provider: 'openai',
    call: () => openai.chat.completions.create({
      model: 'gpt-4o',
      messages: [{ role: 'user', content: prompt }]
    })
  });

  return response.choices[0].message.content;
}

Features

  • Zero Overheads: Operates completely asynchronously. trackAI will never block your main thread or crash your application.
  • Privacy First: We never log your prompts or response bodies. End-user IDs are securely hashed on the client before being sent.
  • Multi-Provider Support: Automatically extracts token usage from OpenAI, Anthropic, Gemini, Mistral, and more.
  • Tree-shakeable & Isomorphic: Works flawlessly in Node.js, Next.js (App & Pages router), Express, and browser environments. Zero external dependencies.

Powered by the Mintlyr Platform

The SDK is the client-side component of the Mintlyr platform. Once telemetry is sent, Mintlyr enables:

  • AI cost analytics
  • Token usage monitoring
  • Provider-level insights
  • Team and feature attribution
  • ROI reporting
  • Budget management
  • Historical trends
  • Future enterprise governance capabilities

API Reference

init(config: MintlyrConfig)

Configures the global Mintlyr client.

| Property | Type | Description | |---|---|---| | apiKey | string | Required. Your Mintlyr Project API Key. | | apiUrl | string | Optional. Override the ingestion endpoint. Defaults to https://api.mintlyr.com. | | localMode | boolean | Optional. If true, tracking events will not be sent to the backend. |

trackAI(options: TrackOptions)

Wraps an asynchronous AI call to capture telemetry.

| Property | Type | Description | |---|---|---| | feature | string | Required. The name of the feature being executed (e.g., chat_bot, summarize). | | call | () => Promise<T> | Required. An async function containing your AI logic. | | userId | string | Optional. A distinct identifier for the end user. Will be hashed. | | sessionId | string | Optional. A distinct identifier for the session/thread. | | provider | Provider | Optional. The AI provider used. Defaults to auto. | | model | string | Optional. The model used. Overrides auto-detection. | | fallback | () => T | Optional. Function to execute if the budget is exhausted. |

Privacy & Data Collection

Mintlyr is built for enterprise observability with privacy as the absolute highest priority.

What we collect:

  • Token counts: input_tokens and output_tokens.
  • Performance metrics: response_time_ms.
  • Metadata: provider, model, feature name, and session_id.
  • End-User ID: Passed through a secure one-way cryptographic hash on the client side before leaving your infrastructure.

What we NEVER collect:

  • Prompts: The text of your users' queries is never tracked.
  • Responses: The content generated by the AI is never tracked.

Platform Support

The SDK is highly isomorphic, shipping with both CommonJS (require) and ESModule (import) builds, fully typed. It runs seamlessly in:

  • Node.js (>= v18)
  • Next.js (App Router & Pages Router)
  • React / Vite / Create React App
  • Express.js / NestJS / Fastify
  • Vanilla Browser Environments

License

MIT