Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Sync Batch Processing Script

Process multiple lipsync generation requests efficiently using the Sync Batch API.

Prerequisites

  • Python 3.8+
  • Sync Scale or Enterprise plan - Batch API is not available on lower-tier plans
  • Valid API Key from your Sync account

Quick Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Configure API credentials:

    export SYNC_API_KEY=<your_api_key>

Usage

Create and monitor a new batch:

python main.py --input-file input.jsonl --monitor

Create batch without monitoring:

python main.py --input-file input.jsonl

Validate input file without processing:

python main.py --input-file input.jsonl --dry-run

Monitor existing batch:

python main.py --batch-id your_batch_id --monitor

Input File Format

Your input file must be in JSON Lines format (.jsonl):

{"request_id": "video_001", "endpoint": "/v2/generate", "payload": {"model": "lipsync-2", "input": [{"type": "video", "url": "https://example.com/video1.mp4"}, {"type": "audio", "url": "https://example.com/audio1.wav"}]}}
{"request_id": "video_002", "endpoint": "/v2/generate", "payload": {"model": "lipsync-2", "input": [{"type": "video", "url": "https://example.com/video2.mp4"}, {"type": "audio", "url": "https://example.com/audio2.wav"}]}}

Required fields per line:

Important Limits

  • Max file size: 5MB
  • Max requests per batch: 1000
  • Plan requirement: Scale or Enterprise (you'll get a 402 error on lower plans)

Key Features

  • Results downloaded to local output.jsonl
  • Dry run validation: Test input files without creating batches using --dry-run
  • Status monitoring: Polls every 60 seconds when --monitor is used
  • Validation: Prevents no-op commands (e.g., batch-id without monitor flag)
  • Webhook support: Optional real-time notifications

Documentation