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

@lymit/sdk

v0.1.2

Published

Edge-first, application-level rate limiting for AI apps. Limit by user, workspace or tier and deduct real LLM token cost with one call.

Readme

@lymit/sdk

Edge-first, application-level rate limiting for AI apps. Limit by userId, workspaceId or tier — not IP — and deduct real LLM token cost from a budget with one call. Zero dependencies; tested on every release against Node (ESM and CJS), Bun, Deno and Cloudflare Workers (workerd).

npm install @lymit/sdk
import { Lymit } from "@lymit/sdk";

const lymit = new Lymit({ apiKey: process.env.LYMIT_API_KEY });

const ai = lymit.namespace("ai_generation", {
  algorithm: "tokenBucket",
  capacity: 5000, // tokens the bucket holds
  refillRate: 1000, // tokens added every `interval`
  interval: "1h",
});

const { success, remaining, reset, retryAfter } = await ai.limit(user.id, {
  cost: estimatedTokens,
});
if (!success) return new Response("Budget exhausted", { status: 429 });

API

new Lymit(options)

| Option | Default | Notes | | --------- | ---------------------- | ------------------------------------------ | | apiKey | — | Required. lym_live_… from the dashboard. | | baseUrl | https://api.lymit.io | Point at staging or wrangler dev. | | fetch | global fetch | Inject for tests or custom agents. |

lymit.namespace(name, config)

Declares a namespace. config is validated immediately, so a typo fails at startup rather than on the first request. Limits can be changed later from the dashboard (Pro) without touching code — the edge layers workspace config and per-identifier rules over what you declare here.

| Algorithm | Config | Use for | | --------------- | ------------------------------------ | --------------------------------------------------------- | | fixedWindow | { limit, window } | Simple request caps | | slidingWindow | { limit, window } | Caps without boundary bursts | | tokenBucket | { capacity, refillRate, interval } | Budgets where requests have different costs (LLM tokens). |

Durations are ms or "500ms", "30s", "10m", "1h", "1d".

namespace.limit(identifier, { cost? })

Resolves to { success, limit, remaining, reset, retryAfter? }.

  • cost — non-negative integer, default 1; 0 peeks without consuming.
  • reset — Unix ms. Windows: end of the current window. Token bucket: when full again (success) or when cost is affordable (rejection).
  • retryAfter — ms until a retry can succeed. Absent on success and when the rejection can never clear (cost > capacity).

A rate-limit rejection is a normal result (success: false), never an exception. A failure to reach Lymit or a server-side refusal (bad key, plan gate) is a LymitError with a stable code (invalid_api_key, feature_not_in_plan, quota_exceeded, bad_request, network_error, timeout, internal) and status.

Resilience

One attempt plus one retry on network failure or timeout; HTTP responses are never retried. If Lymit is down, times out, or returns a 5xx, failMode decides: open (default) lets the request through with remaining = limit and calls onError, because an outage on our side must never take your app down; closed rejects it. See the repository's docs/ for the full design.