The Sync Labs TypeScript SDK (@sync.so/sdk) provides typed methods for Node.js 18+ applications. It wraps the full Sync Labs API surface for creating lip sync generations, polling status, and retrieving results from any TypeScript/JavaScript runtime.
Requires Node.js 18+. The SDK ships with both ESM and CommonJS builds, so it works with any module system.
The SDK reads your API key from the SYNC_API_KEY environment variable automatically.
Create a key from the API Keys page in your dashboard.
You can also pass the key explicitly:
Never expose your API key in client-side code. The SDK is designed for server-side use only. See Framework Integration for details.
Create a lip sync generation, poll for completion, and get the output URL:
Run it with:
The most common pattern. Provide a source video and an audio track — Sync Labs generates lip movements matching the audio.
Use the built-in ElevenLabs integration to go from text to lip-synced video in a single call:
Enable the ElevenLabs integration from your Integrations settings before using the TTS input type.
The quick start above uses polling. For production systems, webhooks are more efficient — you receive a POST notification when the job finishes instead of making repeated API calls.
Retrieve your recent generations:
Fetch a specific generation by ID:
Estimate the cost of a generation before submitting it:
The simplest approach. Provide publicly accessible URLs for your video and audio files:
If your files are not hosted at public URLs, use the Assets API to upload them first. Then reference the returned URLs in your generation request.
For direct file uploads, use the create with files endpoint.
The SDK throws SyncError for API errors. Wrap calls in try/catch to handle failures gracefully.
Common error scenarios:
See the Error Handling guide for the full list of error codes.
The SDK is fully typed. Import types directly for use in your own functions and interfaces:
The SDK exports types for all request and response objects, so you get autocomplete and compile-time checks across your entire codebase.
The Sync Labs SDK is server-side only. Never import it in client-side code — doing so would expose your API key.
Use the SDK in Server Components, Route Handlers, or Server Actions:
Store your SYNC_API_KEY in environment variables or a secrets manager. Do not hardcode it in your source files.
The Sync Labs TypeScript SDK requires Node.js 18 or later. It ships with both ESM and CommonJS builds, so it works with any module system. The SDK is designed for server-side use only — never import it in client-side code as this would expose your API key.
No. The SDK is server-side only. Using it in the browser would expose your API key to end users. Instead, create a server-side endpoint that calls the Sync Labs API and have your frontend communicate with your server. See the Framework Integration section for examples.
The SDK throws SyncError for API errors. Wrap your calls in try/catch blocks and inspect the statusCode and body properties. For transient errors like 500 or 429, implement retry logic with exponential backoff. Check the Error Handling guide for the full list of error codes.