Quickstart

Generate your first lip-synced video with the Sync API in about 5 minutes. This guide walks you through creating an API key, installing the SDK, and submitting a generation request.

Quick reference

Generation timeMost generations complete within a few minutes, depending on model and input length
Supported video formatsMP4 via public URL, direct upload (max 20 MB), or asset ID — all supported formats
Supported audio formatsWAV or MP3 via public URL, direct upload (max 20 MB), or asset ID — all supported formats
Default modellipsync-2 — best general-purpose lip sync
Free trial3 generations/month on free accounts, max 20s per generation, no credit card required
SDK requirementsPython 3.8+ (pip install syncsdk) or Node.js 18+ (npm i @sync.so/sdk)

How do I create an API key?

Create your API key from the Dashboard. You will use this key to securely access the Sync API.

Make your first generation

The following example shows how to make a lipsync generation using the Sync API.

1

Install Sync SDK

$pip install syncsdk
2

Make your first generation

Copy the following code into a file quickstart.py and set SYNC_API_KEY environment variable with your generated API key.

quickstart.py
1import time
2from sync import Sync
3from sync.common import Audio, GenerationOptions, Video
4from sync.core.api_error import ApiError
5
6# ----------[OPTIONAL] UPDATE INPUT VIDEO AND AUDIO URL ----------
7# URL to your source video
8video_url = "https://assets.sync.so/docs/example-video.mp4"
9# URL to your audio file
10audio_url = "https://assets.sync.so/docs/example-audio.wav"
11# ----------------------------------------
12
13sync = Sync()
14
15print("Starting lip sync generation job...")
16
17try:
18 response = sync.generations.create(
19 input=[Video(url=video_url),Audio(url=audio_url)],
20 model="lipsync-2",
21 options=GenerationOptions(sync_mode="cut_off"),
22 output_file_name="quickstart"
23 )
24except ApiError as e:
25 print(f'create generation request failed with status code {e.status_code} and error {e.body}')
26 exit()
27
28job_id = response.id
29print(f"Generation submitted successfully, job id: {job_id}")
30
31generation = sync.generations.get(job_id)
32status = generation.status
33while status not in ['COMPLETED', 'FAILED', 'REJECTED']:
34 print('polling status for generation', job_id)
35 time.sleep(10)
36 generation = sync.generations.get(job_id)
37 status = generation.status
38
39if status == 'COMPLETED':
40 print('generation', job_id, 'completed successfully, output url:', generation.output_url)
41else:
42 print('generation', job_id, 'failed')

Run the script:

$python quickstart.py
3

Done!

It may take a few minutes for the generation to complete. You should see the generated video URL in the terminal post completion.

1

Install dependencies

$npm i @sync.so/sdk
2

Make your first generation

Copy the following code into a file quickstart.ts and set SYNC_API_KEY environment variable with your generated API key.

quickstart.ts
1import { SyncClient, SyncError } from "@sync.so/sdk";
2
3// ----------[OPTIONAL] UPDATE INPUT VIDEO AND AUDIO URL ----------
4// URL to your source video
5const videoUrl = "https://assets.sync.so/docs/example-video.mp4";
6// URL to your audio file
7const audioUrl = "https://assets.sync.so/docs/example-audio.wav";
8// ----------------------------------------
9
10const sync = new SyncClient();
11
12async function main() {
13 console.log("Starting lip sync generation job...");
14
15 let jobId: string;
16 try {
17 const response = await sync.generations.create({
18 input: [
19 {
20 type: "video",
21 url: videoUrl,
22 },
23 {
24 type: "audio",
25 url: audioUrl,
26 },
27 ],
28 model: "lipsync-2",
29 options: {
30 sync_mode: "cut_off",
31 },
32 outputFileName: "quickstart"
33 });
34 jobId = response.id;
35 console.log(`Generation submitted successfully, job id: ${jobId}`);
36 } catch (err) {
37 if (err instanceof SyncError) {
38 console.error(`create generation request failed with status code ${err.statusCode} and error ${JSON.stringify(err.body)}`);
39 } else {
40 console.error('An unexpected error occurred:', err);
41 }
42 return;
43 }
44
45 let generation;
46 let status;
47 while (status !== 'COMPLETED' && status !== 'FAILED' && status !== 'REJECTED') {
48 console.log(`polling status for generation ${jobId}...`);
49 try {
50 await new Promise(resolve => setTimeout(resolve, 10000));
51 generation = await sync.generations.get(jobId);
52 status = generation.status;
53 } catch (err) {
54 if (err instanceof SyncError) {
55 console.error(`polling failed with status code ${err.statusCode} and error ${JSON.stringify(err.body)}`);
56 } else {
57 console.error('An unexpected error occurred during polling:', err);
58 }
59 status = 'FAILED';
60 }
61 }
62
63 if (status === 'COMPLETED') {
64 console.log(`generation ${jobId} completed successfully, output url: ${generation?.outputUrl}`);
65 } else {
66 console.log(`generation ${jobId} failed`);
67 }
68}
69
70main();

Run the script:

$npx tsx quickstart.ts -y
3

Done!

You should see the generated video URL in the terminal.

Well done! You’ve just made your first lipsync generation with sync.so!

Ready to unlock the full potential of lipsync? Dive into our interactive Studio to experiment with all available models, or explore our API Documentation to take your lip-sync generations to the next level!

Frequently Asked Questions

Generation time depends on the model and input length. Most generations complete within a few minutes. You can poll the generation status using the SDK or set up webhooks to receive a notification when the job finishes. The terminal statuses are COMPLETED, FAILED, or REJECTED.

You can create a Sync account and get an API key from the dashboard to start experimenting. Visit the Billing page to see available plans and any free trial credits. The quickstart example uses sample video and audio URLs so you can test the workflow immediately.

Verify that the SYNC_API_KEY environment variable is set correctly before running your script. Ensure the key has not been revoked in your dashboard. A missing or invalid key returns a 401 Unauthorized error. You can create a new key from the API Keys page at any time.