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

cost_guard_ai

v1.0.0

Published

Intelligent Prompt Compression and Security Middleware for LLMs / LLM을 위한 지능형 프롬프트 압축 및 보안 미들웨어

Readme

COST_GUARD_AI

Intelligent Prompt Compression & Security Middleware for LLMs

LLM을 위한 지능형 프롬프트 압축 및 보안 미들웨어


English Description

cost_guard_ai is a powerful guardian for developers and enterprises using LLM APIs (OpenAI, Anthropic, etc.). It sits between your application and the AI to optimize costs, ensure data privacy, and maintain high response quality.

Key Features

  1. Semantic Prompt Compression: Reduces token consumption by 20-30% while maintaining context.
  2. PII Masking: Automatically detects and masks sensitive information (emails, phone numbers, credit cards, etc.).
  3. Caching Layer: Instantly returns responses for identical or similar queries from a local/DB cache.
  4. Budget Management: Monitors API usage and prevents overspending with budget alerts and hard limits.

한국어 설명

cost_guard_ai는 LLM API(OpenAI, Anthropic 등)를 사용하는 개발자와 기업을 위한 강력한 가디언입니다. 애플리케이션과 AI 사이에서 비용을 최적화하고, 데이터 프라이버시를 보장하며, 높은 응답 품질을 유지합니다.

핵심 기능

  1. 지능형 프롬프트 압축 (Semantic Prompt Compression): 문맥을 유지하면서 토큰 사용량을 20~30% 절감합니다.
  2. 개인정보 마스킹 (PII Masking): 이메일, 전화번호, 신용카드 번호 등 민감 정보를 자동으로 탐지하여 마스킹 처리합니다.
  3. 캐싱 레이어 (Caching Layer): 동일하거나 유사한 질문에 대해 로컬/DB 캐시에서 즉시 응답을 반환합니다.
  4. 예산 관리 (Budget Management): API 사용량을 모니터링하고 설정된 예산을 초과하지 않도록 알림 및 차단 기능을 제공합니다.

Installation / 설치

npm install cost_guard_ai

Usage / 사용법

import { AICostGuard } from 'cost_guard_ai';
import OpenAI from 'openai';

const guard = new AICostGuard({
  maxTokenBudget: 10000, // Daily budget limit / 일일 예산 설정
  maskPII: true,         // Enable PII masking / 개인정보 마스킹 활성화
  compress: true         // Enable prompt compression / 프롬프트 압축 활성화
});

const openai = new OpenAI();

// Wrap the existing call / 기존 호출 방식에 가드를 입힘
const response = await guard.wrap(openai.chat.completions.create({
  model: "gpt-4",
  messages: [{ role: "user", content: "Check the balance for customer Hong Gil-dong (010-1234-5678)." }]
}));

License / 라이선스

MIT License Copyright (c) 2008-2026 Rheehose (Rhee Creative)