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

ailabtools

v0.5.4

Published

Official Node.js and TypeScript SDK for AILabTools AI image APIs: background removal, image upscaling, hairstyle changer, face retouching, object removal, and more.

Downloads

863

Readme

AILabTools SDK - AI Image API for Node.js and TypeScript

Official Node.js and TypeScript SDK for AILabTools AI Image APIs.

Build AI-powered photo editing features with simple API calls: background removal, image upscaling, object removal, face retouching, hairstyle changer, age and gender swap, cartoon avatar generation, skin analysis, virtual try-on, and more.

Requirements

  • Node.js 18 or later

Installation

npm install ailabtools

Quick Start

1. Get your API key

Create or copy your API key from the AILabTools Developer Console.

export AILAB_API_KEY="your_api_key_here"

2. Remove an image background

import { readFileSync } from "node:fs";
import { AILabClient } from "ailabtools";

const client = new AILabClient({
  apiKey: process.env.AILAB_API_KEY!,
});

const result = await client.background.remove({
  image: readFileSync("./photo.jpg"),
  returnForm: "whiteBK",
});

console.log(result.data?.image_url);

The SDK uses camelCase parameters and maps them automatically to API field names. For example, upscaleFactor maps to upscale-factor, and returnForm maps to return_form.

Popular Use Cases

| Popular API | Typical use case | SDK method | Try online | | --- | --- | --- | --- | | Cartoon Yourself API | Create cartoon portraits and avatars from photos. | client.portrait.portraitCartoonYourself() | Try Cartoon Yourself online | | Change Facial Expressions API | Edit smiles, grins, sadness, and other facial expressions. | client.portrait.portraitExpressionEditing() | Try Change Facial Expressions online | | Hairstyle Changer Premium API | Preview preset hairstyles or transfer a hairstyle from a reference image. | client.portrait.portraitHairstyleEditingPremium() | Try Hairstyle Changer online | | Try on Clothes Premium API | Generate high-quality virtual clothing try-on results. | client.portrait.portraitTryOnClothesPremium() | Try Virtual Clothes Try-On online | | Skin Analyze Pro API | Analyze skin condition, texture, tone, acne, pores, and wrinkles. | client.portrait.portraitSkinAnalysisProfessional() | Try AI Skin Analyzer online | | Face Beauty Pro API | Apply advanced portrait beautification and face shaping. | client.portrait.portraitFacialBeautificationPro() | Try Retouch Portraits online | | AI Face Swap API | Swap a face into a target portrait while preserving the scene. | client.portrait.portraitAIFaceSwap() | Try AI Face Swap online | | AI Breast Expansion API | Apply a controlled bust-area adjustment to a portrait. | client.portrait.portraitAIBreastExpansion() | Try AI Breast Expansion online |

Browse more demos in AILabTools AI Portrait Tools and AILabTools AI Image Tools.

View the complete AILabTools SDK API index.

Common Developer-Friendly Aliases

Both full API method names and short aliases are supported. For example, client.background.remove() calls the same Universal Background Removal API as client.cutout.cutoutUniversalBackgroundRemoval().

| API | Full method | Alias | | --- | --- | --- | | Universal Background Removal | client.cutout.cutoutUniversalBackgroundRemoval() | client.background.remove() | | Image Upscaler | client.image.imageLosslessEnlargement() | client.image.upscale() | | Remove Objects | client.image.imageRemoveObjects() | client.image.removeObjects() | | Hairstyle Changer Pro | client.portrait.portraitHairstyleEditingPro() | client.portrait.changeHairstyle() | | Smart Beauty | client.portrait.portraitIntelligentBeautification() | client.portrait.retouch() |

View the complete method and alias reference.

File Uploads

FileInput supports Buffer | ArrayBuffer | Uint8Array.

Async Task Example

Some APIs return task_id for long-running image generation or enhancement jobs. Use waitForTask to poll until the task succeeds, fails, or times out.

const task = await client.portrait.changeHairstyle({
  taskType: "async",
  image: readFileSync("./portrait.jpg"),
  hairStyle: "BuzzCut",
  color: "blonde",
});

const taskId = task.task_id || task.data?.task_id;
const result = await client.waitForTask(taskId!, {
  intervalMs: 5000,
  timeoutMs: 300000,
  throwOnFailed: true,
});

console.log(result.data);

API Reference

Error Handling

API errors throw AILabApiError, which includes troubleshooting fields such as requestId and logId.

try {
  const result = await client.background.remove({
    image: readFileSync("./photo.jpg"),
    returnForm: "whiteBK",
  });

  console.log(result.data?.image_url);
} catch (error) {
  console.error("AILabTools API Error:", error);
  // Send request_id and log_id to support if you need help.
}

Testing

AILAB_API_KEY=xxx npm test

License

MIT