The Sync Labs Python SDK (syncsdk) wraps the Sync Labs REST API with typed methods for Python 3.8+. It provides methods for creating lip sync generations, polling for results, estimating costs, and managing assets.
Source code: sync-python-sdk on GitHub
Requires Python 3.8+. Install from PyPI:
We recommend using a virtual environment to avoid dependency conflicts:
The SDK reads your API key from the SYNC_API_KEY environment variable automatically:
You can also pass the key directly:
Create an API key from the API Keys page in your dashboard. See the Authentication guide for security best practices.
Create a lip sync generation, poll until it finishes, and print the output URL.
Run it:
The most common use case. Provide a video and an audio file, and Sync Labs generates matching lip movements.
Use the built-in ElevenLabs integration to go straight from text to lip-synced video. No separate TTS step needed.
The script field has a maximum of 5,000 characters per generation. For longer scripts, split them into segments. See the Text-to-Speech Lip Sync Guide for details.
Polling is the simplest approach. Call generations.get() in a loop until the status is terminal:
Webhooks are better for production. Pass a webhook_url when creating the generation, and Sync Labs sends a POST request when the job finishes:
See the Webhooks guide for payload format and signature verification.
Retrieve your recent generations. Optionally filter by status:
Fetch the full details of a single generation by ID:
Estimate the cost before submitting a generation:
The simplest approach — pass publicly accessible URLs for your video and audio:
If you have uploaded files to the Sync Labs media library (via the dashboard or Assets API), reference them by asset ID:
Upload local files directly using the multipart endpoint:
File uploads are limited to 20MB per file. For larger files, host them at a public URL and use the URL-based input instead.
List and retrieve assets from your media library:
The SDK raises ApiError for HTTP errors. Wrap your calls in try/except blocks:
For production systems, add retry logic with exponential backoff:
The SDK includes an async client for use with asyncio. Use AsyncSync instead of Sync Labs:
The async client supports the same methods as the sync client — create, get, list, estimate_cost, and create_with_files.
The async client works with any asyncio-compatible framework like FastAPI, Sanic, or aiohttp.
The SDK is fully typed. All request parameters, response objects, and enums have type annotations. Your editor will provide autocomplete and inline documentation out of the box.
See the Models page for detailed comparisons.
Yes. The SDK includes an AsyncSync client for use with asyncio. Import AsyncSync instead of Sync Labs and use await with all SDK methods. The async client supports the same operations as the sync client and works with frameworks like FastAPI, Sanic, and aiohttp.
The SDK raises ApiError for HTTP errors including timeouts. Wrap calls in try/except blocks and implement retry logic with exponential backoff for transient errors. For polling, use a sleep interval of 10 seconds between status checks to avoid hitting rate limits.
The Sync Labs API does not currently provide a cancel endpoint for in-progress generations. Once a generation is submitted, it will run to completion or fail. You only pay for successfully completed generations. Monitor status via polling or webhooks to track progress.