Node.js SDK

@pixozip/sdk — TypeScript, dependency-free.

npm install @pixozip/sdk

Constructor

import { Pixozip } from "@pixozip/sdk";
 
const client = new Pixozip({
  apiKey: process.env.PIXOZIP_API_KEY!,
  // baseUrl: "https://api.pixozip.pretzl.dev", // default
  // maxRetries: 3,                              // 429 + 5xx, exponential
  // retryBaseDelayMs: 500,
  // defaultTimeoutMs: 60_000,
});

shrink(body, options)

const out = await client.shrink(bytesOrBlob, {
  contentType: "image/jpeg",
  qualityTier: "balanced",   // fast | balanced | max
  output: "webp",
  quality: 80,
  resize: { width: 1280, fit: "inside" },
  async: false,
  idempotencyKey: "deploy-2026-05-24-photo-42",
});
console.log(out.outputBytes, out.ratio);
const optimized = await out.download(); // Uint8Array

getJob(jobId)

const job = await client.getJob("f5012a57-...");
if (job.status === "completed") console.log(await job.download());

Errors

import { PixozipError } from "@pixozip/sdk";
try {
  await client.shrink(...);
} catch (e) {
  if (e instanceof PixozipError) console.error(e.status, e.body);
}

The SDK retries 429 and 5xx automatically (exponential backoff). 4xx errors are thrown immediately.