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

@genlook/api

v0.1.2

Published

Official TypeScript SDK for the Genlook API. A powerful virtual try-on API for clothing, accessories, and petwear. Add photorealistic AI virtual try-on to any app or store.

Readme

@genlook/api

Official TypeScript SDK for the Genlook Virtual Try-On API.

What is Genlook?

Genlook is a powerful API for virtual try-on that works on any product type—from clothing and accessories to petwear. Add photorealistic AI virtual try-on to any e-commerce store, mobile app, or internal tool. We turn a product image and a person's photo into a highly realistic virtual fitting room experience, eliminating the need for expensive photoshoots and models.

Whether you are building a clothing try-on feature, an AI fitting room, or a petwear virtual try-on experience, the @genlook/api package provides a strongly typed, zero-dependency (beyond Zod) SDK for Node 20+, Deno, Bun, and edge runtimes.

Use Cases

What you can build with the Genlook Virtual Try-On API:

  • Virtual try-on for e-commerce — Let shoppers see themselves in your clothing before they buy, driving higher conversion and fewer returns.
  • AI virtual fitting rooms — Create interactive, photorealistic try-on experiences on your product pages.
  • Photoshoot replacement — Generate on-model product imagery without a studio.
  • Personalized marketing — Power campaigns where each customer sees themselves wearing your apparel.

Supported Product Types

Genlook supports a wide variety of product categories. The API automatically classifies and routes the try-on generation based on the product.

Supported product types include:

  • Clothes (Tops, bottoms, dresses, outerwear, suits, etc.)
  • Lingerie (Bras, underwear, intimates, corsets, bodysuits)
  • Glasses (Sunglasses, prescription eyewear)
  • Shoes (Sneakers, boots, sandals)
  • Hats (Caps, beanies, fedoras, headwear)
  • Jewelry (Rings, necklaces, earrings, bracelets, pendants)
  • Petwear (Dog/cat sweaters, costumes, bandanas, collars)
  • Wigs (Wigs, hair extensions, hairpieces)
  • Swimwear (Bikinis, one-pieces, trunks, board shorts)
  • Accessories (Scarves, belts, gloves, ties, socks, watches)
  • Handbags (Purses, totes, clutches, backpacks, crossbody bags)
  • Fabric Closeups (Sarees, dupattas, flat fabric swatches)
  • Pasties (Nipple covers, breast petals)

Getting Started

1. Get an API Key

To get your API key, visit: https://genlook.app/try-on/api

2. Install the SDK

pnpm add @genlook/api
# or
npm install @genlook/api
yarn add @genlook/api
bun add @genlook/api

3. Quick Start

import { Genlook } from "@genlook/api";
import { readFile } from "node:fs/promises";

// Initialize the client
const client = new Genlook({ apiKey: process.env.GENLOOK_API_KEY! });

// 1. Upload the customer photo (reuse the imageId across many try-ons)
const { imageId } = await client.images.upload(await readFile("./customer.jpg"), {
  mimeType: "image/jpeg",
});

// 2. Run the try-on. Reference an existing product, or upsert one inline.
// The engine automatically detects the best model based on the product image/title/description.
const generation = await client.tryOn.create({
  product: {
    externalId: "dog-sweater-01",
    title: "Cozy Knit Pet Sweater",
    description: "Warm red knit sweater for small to medium dogs",
    images: [{ url: "https://cdn.example.com/pet-sweater.jpg" }],
  },
  customer: { id: imageId },
});

// 3. Wait for the result
const result = await client.generations.waitFor(generation.generationId);
console.log("Try-on Result URL:", result.resultImageUrl);

API Resources

| Resource | Methods | Purpose | | -------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------- | | client.images | upload | Pre-upload customer photos and reuse the imageId across generations. | | client.tryOn | create | Queue a try-on generation (inline-upsert product or reference by ID). | | client.generations | retrieve, waitFor | Poll status; waitFor replaces hand-rolled polling loops. | | client.products | upsert, list, iterate, get, delete, stats | Catalog management — optional. Most integrations use inline tryOn. | | client.account | credits | Inspect remaining credit balance. | | client.customers | delete | GDPR right-to-erasure (wipe per-customer images + anonymize generations). |

Error Handling

Every request that fails throws a typed GenlookError subclass. Branch on error.code or use instanceof:

import { Genlook, GenlookError, InsufficientCreditsError, ProductNotFoundError } from "@genlook/api";

try {
  await client.tryOn.create({
    product: { externalId: "shirt-42" },
    customer: { id: imageId },
  });
} catch (err) {
  if (err instanceof ProductNotFoundError) {
    // Cache miss — retry with the full inline payload.
  } else if (err instanceof InsufficientCreditsError) {
    // Surface "top up" CTA.
  } else if (err instanceof GenlookError) {
    console.error(err.code, err.message, err.requestId);
  } else {
    throw err;
  }
}

Configuration

const client = new Genlook({
  apiKey: process.env.GENLOOK_API_KEY!,
  baseUrl: "https://api.genlook.app/tryon/v1", // override for testing
  timeoutMs: 60_000, // per-request budget
  maxRetries: 2, // 429 / 5xx / network retries
  fetch: customFetch, // inject your own fetch
});

Runtimes

  • Node 20+ (preferred — picks up the global fetch/FormData/Blob).
  • Deno ≥ 1.40.
  • Bun ≥ 1.0.
  • Cloudflare Workers / Vercel Edge — pass { fetch } if the runtime hides the global, otherwise it works automatically.

Browser is intentionally unsupported. API keys must not be embedded in client-side bundles — proxy requests through your backend.

License

MIT