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

@getanyapi/sdk

v0.1.0

Published

Official typed TypeScript SDK for AnyAPI: any API, one wallet, USD, no subscriptions.

Readme

@getanyapi/sdk

Official typed TypeScript SDK for AnyAPI: any API, one wallet, USD, no subscriptions. Reach hundreds of scraping and data APIs through one interface and one key; pay per request in real US dollars. Zero runtime dependencies (global fetch), ESM + CJS, Node 18+ and edge runtimes.

npm install @getanyapi/sdk

Quickstart

import { AnyAPI } from "@getanyapi/sdk";

// Reads ANYAPI_API_KEY from the environment when apiKey is omitted.
const client = new AnyAPI({ apiKey: process.env.ANYAPI_API_KEY });

const res = await client.reddit.search({ query: "mechanical keyboard" });
for (const post of res.output.posts) {
  console.log(post.title, post.score);
}
console.log("charged", res.costUsd, "USD");

Every SKU is a typed method under its platform namespace (client.amazon.reviews(...), client.google.search(...)). You can also call any SKU generically by slug with full typing:

const rev = await client.run("amazon.reviews", { product: "B07FZ8S74R", limit: 3 });

Not found vs error

A successful call always resolves. For most SKUs the payload is wrapped in a found flag: output.found is false when the upstream had no matching entity (this is not an error). Use unwrap to get the data or throw ResultNotFoundError when empty:

import { unwrap, ResultNotFoundError } from "@getanyapi/sdk";

const res = await client.amazon.reviews({ product: "B07FZ8S74R" });
try {
  const data = unwrap(res); // the typed data payload, or throws
} catch (e) {
  if (e instanceof ResultNotFoundError) {
    // empty result (found: false), not an HTTP failure
  }
}

ResultNotFoundError extends NotFoundError, so catch (NotFoundError) catches both an HTTP 404 and an empty result; catch ResultNotFoundError to handle only empty results. A few SKUs (e.g. reddit.search) return their data object directly as output with no found wrapper; unwrap returns it as-is and never throws for those.

Pagination

Paginated SKUs expose an iterator that yields items across pages and follows the cursor for you. Call .pages() on it to walk whole results instead (each carries its own costUsd).

// Flatten items across pages, capped at 100 total.
for await (const post of client.reddit.iterSearch({ query: "coffee" }, { maxItems: 100 })) {
  console.log(post.title);
}

// Or walk pages to read per-page cost.
for await (const page of client.reddit.iterSearch({ query: "coffee" }).pages()) {
  console.log(page.costUsd);
}

Request options (context-cost savers)

Pass a second argument to shape the response. These trim what comes back but do NOT change the price:

await client.google.search(
  { query: "coffee" },
  {
    fields: ["title", "link"], // keep only these keys on each item
    maxItems: 5,               // cap result rows returned
    summary: true,             // structural outline instead of full data
  },
);

Per-call transport overrides: timeoutMs, maxRetries, and an AbortSignal via signal.

Errors and retries

| Class | HTTP | Meaning | | --- | --- | --- | | BadRequestError | 400 | Input failed validation | | AuthenticationError | 401 | Missing or invalid API key | | InsufficientBalanceError | 402 | Wallet balance or per-key cap exceeded | | NotFoundError | 404 | Slug or resource does not exist | | ResultNotFoundError | - | unwrap on an empty found-data result | | RateLimitedError | 429 | Too many requests (retried automatically) | | UpstreamError | 502 | An upstream backend failed | | ConnectionError | 0 | Network or transport failure (retried) | | TimeoutError | 0 | Request exceeded its timeout (not retried) |

All extend AnyAPIError (with status and requestId). Retries cover only 429 and network failures, with jittered exponential backoff honoring Retry-After. Default maxRetries is 2 (up to 3 attempts); set it on the client or per request. Timeouts are never retried. Configure with new AnyAPI({ timeoutMs, maxRetries }).

Agent signup

Bootstrap a key with no account (for autonomous agents):

import { agentSignup } from "@getanyapi/sdk";

const { secret, capUsd, claimUrl } = await agentSignup({ label: "my-agent" });
const client = new AnyAPI({ apiKey: secret });

The key ships with a small starter credit and a per-key spend cap; a human funds it by claiming it at claimUrl.

Docs

Full API reference and catalog: getanyapi.com/docs.

License

MIT