SDK Reference

Video & Foreground

Run removal and handle transparent foreground assets.

Workflow

  1. Open or reference input video.
  2. Call remove background operation.
  3. Receive foreground output and metadata.
  4. Pass output to composition or download pipeline.

Node.js Example

import { RemoveBGVideoClient } from 'removebgvideo-node';

const client = new RemoveBGVideoClient(process.env.REMOVEBGVIDEO_API_KEY!);

const created = await client.createJob({
  video_url: 'https://cdn.example.com/input.mp4',
  model: 'original',
  output_format: 'webm',
  bg_type: 'transparent',
  auto_start: true,
});

const result = await client.waitForCompletion(created.id);
console.log(result.output_url);

Python Example

from removebgvideo import RemoveBGVideoClient

client = RemoveBGVideoClient(api_key='YOUR_API_KEY')

job = client.create_job(
    video_url='https://cdn.example.com/input.mp4',
    model='human',
    bg_type='transparent',
    output_format='webm',
    auto_start=True
)

result = client.wait_for_completion(job['id'])
print(result['output_url'])

Recommended SDK Usage Pattern

  1. Initialize singleton client per service process.
  2. Wrap SDK calls with your own timeout/retry decorators.
  3. Map SDK/domain errors into internal error taxonomy.
  4. Capture job_id and business context in your tracing system.

SDK Hardening Checklist

  • Add per-call timeout defaults and circuit breaking.
  • Track SDK version in logs for post-incident debugging.
  • Test SDK upgrade in staging with archived production payloads.
  • Implement fallback strategy by model and output format.

Media Input Governance

  • Validate source metadata before calling remove background.
  • Reject unsupported codecs early in pipeline.
  • Keep canonical input URL/file references for reproducibility.