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

@reaatech/llm-judge-infra

v0.1.0

Published

Cost tracking, monitoring, and batch processing for LLM Judge Toolkit

Downloads

159

Readme

@reaatech/llm-judge-infra

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

Infrastructure utilities including cost tracking with budget enforcement, structured Pino logging, metrics collection, and batch processing with configurable concurrency and retry.

Installation

npm install @reaatech/llm-judge-infra
# or
pnpm add @reaatech/llm-judge-infra

Feature Overview

  • CostTracker with period-aware cost aggregation and budget alerts
  • Pino logger with structured log helpers (judgment, error, cache hit/miss, budget exceeded)
  • MetricsCollector tracking judgments, latency, scores, costs, and cache hit rates
  • BatchProcessor with concurrency control, progress callbacks, and automatic retry
  • Zero external dependencies beyond pino for logging

Quick Start

import { CostTracker } from '@reaatech/llm-judge-infra';

const tracker = new CostTracker({
  budget: { limit: 10.0, period: 'daily' },
});

tracker.track(judgment);

const report = tracker.generateReport();
console.log(report.totalCost, report.averageCostPerJudgment);
import { BatchProcessor } from '@reaatech/llm-judge-infra';

const processor = new BatchProcessor({
  engine: judgmentEngine,
  concurrency: 5,
  onProgress: (done, total) => console.log(`${done}/${total}`),
  onError: (id, error) => console.error(`Failed ${id}:`, error.message),
});

const results = await processor.process(items);

API Reference

CostTracker

| Export | Description | |--------|-------------| | constructor({budget?, eventBus?}) | Create a tracker with optional budget and event bus | | track(judgment) | Record judgment cost (throws BudgetExceededError if over limit) | | getTotalCost() | Sum of all tracked costs | | getPeriodCost() | Cost within the current period window | | getCostByCriteria() | Cost filtered by evaluation criteria | | getCostByProvider() | Cost filtered by provider name | | getCostByModel() | Cost filtered by model name | | generateReport() | Full cost report with breakdowns |

BatchProcessor

| Export | Description | |--------|-------------| | constructor({engine, concurrency?, onProgress?, onError?}) | Create with engine, concurrency (default 3), and callbacks | | process(items[]) | Evaluate all items, return BatchResult[] | | processWithRetry(items[], options?) | Process with automatic retries on transient errors |

MetricsCollector

| Export | Description | |--------|-------------| | recordJudgment() | Record a single judgment | | recordCacheHit() | Increment cache hit counter | | recordCacheMiss() | Increment cache miss counter | | recordFailure() | Increment failure counter | | snapshot() | Return MetricsSnapshot with all current values | | reset() | Reset all counters to zero |

Logging Helpers

| Export | Description | |--------|-------------| | logger | Raw Pino instance | | logJudgment() | Log a completed judgment with duration | | logError() | Log an error with optional context | | logCacheHit() | Log a cache hit event | | logCacheMiss() | Log a cache miss event | | logBudgetExceeded() | Log when budget threshold is exceeded |

Related Packages

License

MIT