SDK

@hypervideo-dev/sdk is the official TypeScript SDK for the Hypervideo API. Works in Node.js and browser environments.

npm | GitHub

Installation

bash
npm install @hypervideo-dev/sdk

Setup

typescript
import { Hypervideo } from '@hypervideo-dev/sdk';
const client = new Hypervideo({ apiKey: 'hc_...' });

Sync Processing

typescript
const result = await client.video.removeBackground({
file: videoFile, // File or Buffer
format: 'webp', // Single format
quality: 40, // WebP/APNG quality
});
console.log(result.url); // base64 data URL
console.log(result.format); // "webp"
console.log(result.size); // bytes
console.log(result.processingTime); // ms

Multiple Formats

typescript
const result = await client.video.removeBackground({
file: videoFile,
formats: ['webp', 'stacked-alpha'],
});
for (const output of result.outputs) {
console.log(output.format, output.url, output.size);
}

Async Jobs

For longer videos, use the jobs API to avoid timeouts:

typescript
// Submit job (returns immediately)
const { jobId } = await client.jobs.submit({
file: videoFile,
formats: ['webm', 'stacked-alpha'],
});
// Poll with progress callback
const job = await client.jobs.poll(jobId, {
onProgress: (j) => {
console.log(`${j.progress}% - ${j.stage}`);
},
});
// Access results
console.log(job.result.outputUrl);
console.log(job.result.outputs);

From URL

typescript
const result = await client.video.removeBackground({
url: 'https://example.com/video.mp4',
format: 'webp',
});

Image Processing

typescript
// Remove image background
const image = await client.image.removeBackground({
file: imageFile,
tolerance: 30,
});
// Detect background color
const color = await client.image.detectBackgroundColor({
file: imageFile,
});
console.log(color.hex); // "#E92FBC"

Configuration

typescript
const client = new Hypervideo({
apiKey: 'hc_...',
baseUrl: 'https://api.hypervideo.dev', // default
});