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

pixelapi

v0.1.0

Published

Official JavaScript/TypeScript SDK for PixelAPI — AI image generation, background removal, upscaling, and audio generation API

Readme

PixelAPI JavaScript SDK

Official JavaScript/TypeScript client for PixelAPI — the cheapest AI image generation, background removal, upscaling, and audio generation API.

10 AI models, one API key, from $0.002/image.

npm TypeScript License: MIT

Installation

npm install pixelapi

Quick Start

import { PixelAPI } from "pixelapi";

const client = new PixelAPI("pk_live_your_key");

// Generate an image ($0.003)
const result = await client.image.generate({ prompt: "a cat astronaut, digital art" });
const completed = await client.generation.wait(result.id);
console.log(completed.outputUrl);

Features

🖼️ Image Generation

// FLUX Schnell — fast, photorealistic (~3s)
const result = await client.image.generate({
  prompt: "product on marble table, studio lighting",
  model: "flux-schnell",
});

// SDXL — versatile, great for illustrations
const result = await client.image.generate({
  prompt: "watercolor painting of mountains",
  model: "sdxl",
});

const completed = await client.generation.wait(result.id);
console.log(completed.outputUrl);

✂️ Background Removal — $0.002/image

const result = await client.image.removeBackground({
  imageUrl: "https://example.com/product.jpg",
});
const completed = await client.generation.wait(result.id);
console.log(completed.outputUrl); // Transparent PNG

🎨 Background Replacement — $0.005/image

const result = await client.image.replaceBackground({
  imageUrl: "https://example.com/product.jpg",
  prompt: "product on marble countertop, soft studio lighting",
});

🔍 4x Upscaling — $0.02/image

const result = await client.image.upscale({
  imageUrl: "https://example.com/low-res.jpg",
});

👤 Face Restoration — $0.003/image

const result = await client.image.restoreFace({
  imageUrl: "https://example.com/blurry-portrait.jpg",
});

🧹 Object Removal — $0.005/image

const result = await client.image.removeObject({
  imageUrl: "https://example.com/photo.jpg",
  maskUrl: "https://example.com/mask.png",
});

🎵 AI Music Generation — $0.005/track

const result = await client.audio.generate({
  prompt: "upbeat electronic music for a product video",
  duration: 15,
});
const completed = await client.generation.wait(result.id);
console.log(completed.outputUrl); // Audio URL

🔄 Polling for Results

// One-shot check
const status = await client.generation.get("gen_abc123");
console.log(status.status); // "pending" | "processing" | "completed" | "failed"

// Wait until done (timeout in ms)
const completed = await client.generation.wait("gen_abc123", {
  timeout: 120000,
  pollInterval: 2000,
});

Error Handling

import { PixelAPI, AuthenticationError, RateLimitError, InsufficientCreditsError } from "pixelapi";

const client = new PixelAPI("pk_live_your_key");

try {
  const result = await client.image.generate({ prompt: "hello world" });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error("Invalid API key");
  } else if (error instanceof RateLimitError) {
    console.error(`Rate limited. Retry after ${error.retryAfter}s`);
  } else if (error instanceof InsufficientCreditsError) {
    console.error("Not enough credits — top up at pixelapi.dev/app");
  }
}

TypeScript

Full TypeScript support with exported types:

import type { Generation, GenerateImageOptions, WaitOptions } from "pixelapi";

API Reference

| Method | Endpoint | Credits | |--------|----------|---------| | client.image.generate() | POST /v1/image/generate | 3 | | client.image.removeBackground() | POST /v1/image/remove-background | 2 | | client.image.upscale() | POST /v1/image/upscale | 20 | | client.image.restoreFace() | POST /v1/image/restore-face | 3 | | client.image.removeObject() | POST /v1/image/remove-object | 5 | | client.image.replaceBackground() | POST /v1/image/replace-background | 5 | | client.audio.generate() | POST /v1/audio/generate | 5 | | client.generation.get() | GET /v1/image/{id} | 0 | | client.generation.wait() | Polls GET /v1/image/{id} | 0 |

Requirements

  • Node.js 18+ (uses native fetch)
  • No external dependencies

Links

License

MIT