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

claude-cache-master

v0.1.1

Published

A zero-config wrapper around the Anthropic SDK that makes Claude prompt caching dead simple, with built-in cost-savings tracking and cache-invalidation warnings.

Readme

claude-cache-master

CI npm version License: MIT

A zero-config wrapper around the Anthropic SDK that makes Claude prompt caching dead simple — with built-in cost-savings tracking and cache-invalidation warnings.

Prompt caching can cut your Claude API input costs by up to 90%, but wiring up the multi-block message structure and cache_control breakpoints by hand is tedious and easy to get wrong. This package handles the structure for you and prints exactly how much you're saving.

Install

npm install claude-cache-master

Before / After

Without claude-cache-master:

const response = await anthropic.messages.create({
  model: "claude-3-5-sonnet-20241022",
  max_tokens: 1024,
  system: [
    {
      type: "text",
      text: "This is a massive 5,000 token documentation brief...",
      cache_control: { type: "ephemeral" },
    },
  ],
  messages: [{ role: "user", content: "Analyze step 3." }],
});

With claude-cache-master:

import { ClaudeCache } from "claude-cache-master";

const client = new ClaudeCache({ apiKey: process.env.ANTHROPIC_API_KEY! });

const { response, metrics } = await client.createWithCache({
  model: "claude-3-5-sonnet-20241022",
  systemDocs: "This is a massive 5,000 token documentation brief...",
  messages: [{ role: "user", content: "Analyze step 3." }],
});

What you get

Terminal cost-savings tracker

Every call prints a summary of cache hit rate and estimated dollars saved:

┌────────────────────────────────────────────────────────┐
│  CLAUDE CACHE METRICS                                   │
├────────────────────────────────────────────────────────┤
│  Cache Hit Rate:  ████████████████████ 92%              │
│  Tokens Saved:    4,600 tokens                          │
│  Est. Cost Saved: $0.0138 (this turn)                   │
│  Cumulative Saved: $4.2100 this session                 │
└────────────────────────────────────────────────────────┘

Smart invalidation warnings

Prompt caching requires an exact prefix match. If you accidentally put a moving timestamp or UUID inside a cached block, the cache breaks silently on every call. claude-cache-master scans cached content and warns you up front:

[ClaudeCache Warning]: You included what looks like a timestamp inside a cached block.
This will break the cache prefix match on every request and cause a 100% cache miss rate.

API

new ClaudeCache(options)

| option | type | description | |---|---|---| | apiKey | string | Your Anthropic API key | | inputPricePerMillion | number? | Base input token price used for cost estimates (defaults to Sonnet pricing, $3/M) |

client.createWithCache(params)

| param | type | description | |---|---|---| | model | string | Claude model id | | systemDocs | string? | Static content to mark as an ephemeral cache breakpoint | | messages | {role, content}[] | Conversation messages | | maxTokens | number? | Defaults to 1024 | | tools | any[]? | Tool definitions, passed through | | temperature | number? | Passed through | | logMetrics | boolean? | Set false to suppress the terminal metrics printout |

Returns { response, metrics }response is the raw Anthropic SDK message, metrics is a CacheMetrics object you can log or assert on in tests.

Why

Prompt caching is one of the highest-leverage cost optimizations available on the Claude API, but the boilerplate and silent-failure modes (cache busted by a stray timestamp) make it easy to get wrong without noticing. This package exists to make the happy path the easy path.

Contributing

PRs welcome — especially for additional cache-busting pattern detection, Python parity, and richer metrics (e.g. per-session cost dashboards).

License

MIT