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

@inferall/sdk

v0.1.1

Published

Official TypeScript SDK for the InferAll AI gateway — one API for every model provider.

Readme

@inferall/sdk

Official TypeScript SDK for the InferAll AI gateway. One API, every model provider — OpenAI, Anthropic, Google Gemini, Replicate, and more — behind a single bearer token.

This is the TypeScript counterpart to the inferall-ai Python package and mirrors its surface one-to-one.

Zero runtime dependencies. The client uses only the platform fetch API, so it ships cleanly into Node, edge functions, and browsers. ESM, CJS, and full type declarations are all bundled.

Install

npm install @inferall/sdk

Requires Node 18+ (or any runtime with a global fetch).

Quick start

import { Inferall } from "@inferall/sdk";

const ai = new Inferall(); // reads INFERALL_API_KEY from the environment

// The built-in default is Gemini, which is a PAID model. On the no-card trial
// pass a free NVIDIA model so this first call succeeds.
console.log(
  await ai.text("Summarize the theory of relativity in two sentences.", {
    provider: "nvidia",
    model: "nvidia/nemotron-3-ultra-550b-a55b",
  }),
);

Explicit credentials

const ai = new Inferall({ apiKey: "ifu_..." });

System prompt + custom model

await ai.text("Translate to French: 'Where is the library?'", {
  system: "You are a careful translator.",
  provider: "openai",
  model: "gpt-4o-mini",
  temperature: 0.2,
});

Multi-turn chat

await ai.chat([
  { role: "user", content: "Hello!" },
  { role: "assistant", content: "Hi there — how can I help?" },
  { role: "user", content: "What's 2 + 2?" },
]);

Vision

import { readFile } from "node:fs/promises";

const imageBase64 = (await readFile("receipt.jpg")).toString("base64");

await ai.vision(imageBase64, "What's the total on this receipt?");

Raw responses

When you need access to tool calls, automatic-fallback metadata (fallback_used / actual_provider), or any provider-specific field, use generate() to get the full payload:

const raw = await ai.generate({
  provider: "anthropic",
  model: "claude-sonnet-4-6",
  operation: "chat",
  messages: [{ role: "user", content: "..." }],
});

Environment variables

| Variable | Purpose | | ------------------- | ------------------------------------------------------------------- | | INFERALL_API_KEY | Bearer token. Used when apiKey isn't passed to the constructor. | | INFERALL_BASE_URL | Override the gateway URL (default https://api.inferall.ai). | | AI_GATEWAY_KEY | Legacy fallback for INFERALL_API_KEY (recognised for back-compat).| | AI_GATEWAY_URL | Legacy fallback for INFERALL_BASE_URL. |

Environment variables are only read in runtimes that expose process.env (Node, most edge functions). In the browser, pass apiKey / baseURL explicitly.

Errors

Gateway failures throw InferallError. A status of 0 indicates a transport-level failure (network error or timeout) rather than an HTTP error response.

import { Inferall, InferallError } from "@inferall/sdk";

const ai = new Inferall();
try {
  await ai.text("...");
} catch (err) {
  if (err instanceof InferallError) {
    console.error(err.status, err.body);
  }
}

Python ↔ TypeScript

| Python (inferall-ai) | TypeScript (@inferall/sdk) | | ---------------------------------- | ------------------------------------------- | | from inferall import Inferall | import { Inferall } from "@inferall/sdk" | | Inferall(api_key=...) | new Inferall({ apiKey: ... }) | | ai.text(prompt, system=...) | ai.text(prompt, { system: ... }) | | ai.chat(messages) | ai.chat(messages) | | ai.vision(img_b64, prompt) | ai.vision(imgBase64, prompt) | | ai.generate(provider=..., ...) | ai.generate({ provider: ..., ... }) | | InferallError | InferallError |

Keyword arguments map to a trailing options object; snake_case parameters become camelCase (max_tokens → maxTokens, base_url → baseURL). Behaviour (defaults, env-var resolution, the /ai/v1/generate route, and response normalization) is identical.

License

MIT