Skip to main content
Runs on Node 20+, Deno 1.40+, Bun 1.0+, Cloudflare Workers and Vercel Edge. Server-side only: never ship your API key to the browser. Proxy through your backend instead.

Full flow

Prefer to queue and come back later? client.tryOn.create(...) takes the same input and returns a generationId right away. Then call client.generations.waitFor(generationId) or receive a webhook. See Create Try-On.

Example app: Next.js + @genlook/api

Product grid, try-on widget and server-side routes. Clone it, add your key, run pnpm dev.

Client options

Every method also takes a last options argument for that call only: signal (an AbortSignal), timeoutMs and maxRetries.

Methods

waitFor

Polls until the generation finishes. Returns the completed generation. Throws GenerationFailedError on FAILED and GenerationTimeoutError past timeoutMs.
It polls every 1s up to 4s, every 300ms up to 12s (when most results land), then every 1s. Set pollIntervalMs for a fixed interval.

Errors

Every failed call throws a GenlookError subclass carrying code, status, details and requestId.
err.is("PRODUCT_NOT_FOUND") also works. Quote err.requestId when you contact support. All codes: Errors.

Uploads

images.upload accepts Blob, File, Buffer, Uint8Array, ArrayBuffer, a web ReadableStream or a Node Readable.
Before 0.2.0 these options were named customerId and retentionDays. The old names still work.
To send product image bytes instead of URLs, reference them with fileKey and pass the bytes in files:

Pagination