### Install Comfy-CLI and ComfyUI Source: https://sync.so/docs/plugins-and-extensions/comfy-ui Installs the Comfy-CLI tool and then uses it to install ComfyUI. This is a guided setup method. ```bash pip install comfy-cli comfy install ``` -------------------------------- ### Clone and Run Sync Examples Source: https://sync.so/docs/tutorials/video-translation-api-guide Clone the sync-examples repository, navigate to the Python translation directory, install dependencies, and run the main script. Ensure API keys are configured in args.py. ```bash git clone https://github.com/synchronicity-labs/sync-examples.git cd sync-examples/translation/python pip install -r requirements.txt # Configure your API keys in args.py python main.py ``` -------------------------------- ### Clone Sync Examples Repository Source: https://sync.so/docs/tutorials/personalized-video-messaging Clone the repository containing the personalized video messaging example. Navigate to the Python directory for the example. ```bash git clone https://github.com/synchronicity-labs/sync-examples.git cd sync-examples/personalized-video-messsging/python ``` -------------------------------- ### Set Up Virtual Environment and Install Dependencies Source: https://sync.so/docs/tutorials/personalized-video-messaging Create a Python virtual environment and install the necessary project dependencies from the requirements.txt file. ```bash python -m venv venv source venv/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Quick Start: Create and poll for lip sync generation Source: https://sync.so/docs/developer-guides/sdk-python This example demonstrates how to create a lip sync generation, poll for its completion status, and retrieve the output URL. It includes error handling for API requests. ```python import time from sync import Sync from sync.common import Audio, Video, GenerationOptions from sync.core.api_error import ApiError sync = Sync() try: response = sync.generations.create( input=[ Video(url="https://assets.sync.so/docs/example-video.mp4"), Audio(url="https://assets.sync.so/docs/example-audio.wav"), ], model="lipsync-2", options=GenerationOptions(sync_mode="cut_off"), ) except ApiError as e: print(f"Request failed: {e.status_code} - {e.body}") exit() job_id = response.id print(f"Job submitted: {job_id}") # Poll until complete generation = sync.generations.get(job_id) while generation.status not in ["COMPLETED", "FAILED", "REJECTED"]: time.sleep(10) generation = sync.generations.get(job_id) if generation.status == "COMPLETED": print(f"Output: {generation.output_url}") else: print(f"Generation {job_id} failed: {generation.error}") ``` -------------------------------- ### Quick Start: Lip Sync Generation Source: https://sync.so/docs/developer-guides/sdk-typescript This example demonstrates how to create a lip sync generation, poll for its completion, and retrieve the output URL using the Sync Labs TypeScript SDK. ```APIDOC ## Quick Start: Lip Sync Generation ### Description Create a lip sync generation, poll for completion, and get the output URL. ### Method Signature `async function main()` ### Usage ```typescript import { SyncClient, SyncError } from "@sync.so/sdk"; const sync = new SyncClient(); async function main() { // 1. Submit a generation const response = await sync.generations.create({ input: [ { type: "video", url: "https://assets.sync.so/docs/example-video.mp4" }, { type: "audio", url: "https://assets.sync.so/docs/example-audio.wav" }, ], model: "lipsync-2", options: { sync_mode: "cut_off" }, }); const jobId = response.id; console.log(`Job submitted: ${jobId}`); // 2. Poll until complete let generation = await sync.generations.get(jobId); while (!["COMPLETED", "FAILED", "REJECTED"].includes(generation.status)) { await new Promise((r) => setTimeout(r, 10000)); generation = await sync.generations.get(jobId); } // 3. Get output if (generation.status === "COMPLETED") { console.log(`Output: ${generation.outputUrl}`); } else { console.log(`Generation ${jobId} failed`); } } main(); ``` ### Running the Example ```bash npx tsx quickstart.ts ``` ``` -------------------------------- ### Set up virtual environment and install syncsdk Source: https://sync.so/docs/developer-guides/sdk-python Set up a virtual environment and install the Sync Labs Python SDK within it to avoid dependency conflicts. ```bash python -m venv .venv source .venv/bin/activate # macOS/Linux pip install syncsdk ``` -------------------------------- ### Start ComfyUI Application Source: https://sync.so/docs/plugins-and-extensions/comfy-ui Starts the ComfyUI application from the main directory. This is used after manual installation methods (A or B) or if prompted after using the Manager GUI (Method C). ```bash cd /path/to/ComfyUI/ python main.py ``` -------------------------------- ### Clone Sync Examples Repository Source: https://sync.so/docs/tutorials/translation-dubbing Clone the repository containing the translation and dubbing examples. Navigate to the Python translation directory. ```bash git clone https://github.com/synchronicity-labs/sync-examples.git cd sync-examples/translation/python ``` -------------------------------- ### Install ComfyUI Lipsync Node via Git Clone Source: https://sync.so/docs/plugins-and-extensions/comfy-ui Clones the sync-comfyui repository into the custom_nodes directory and installs its dependencies. This is an alternative manual setup method. ```bash # Inside the custom_nodes folder git clone https://github.com/synchronicity-labs/sync-comfyui.git cd sync-comfyui/ pip install -r requirements.txt ``` -------------------------------- ### Install Python SDK Source: https://sync.so/docs/developer-guides/sdk Install the Sync Labs Python SDK. Requires Python 3.8+. ```bash pip install syncsdk ``` -------------------------------- ### Run TypeScript Quick Start Script Source: https://sync.so/docs/developer-guides/sdk-typescript Execute the quick start TypeScript script using tsx. ```bash npx tsx quickstart.ts ``` -------------------------------- ### Install Sync Labs SDK Source: https://sync.so/docs/tutorials/video-dubbing-api-guide Install the Sync Labs SDK for Python or TypeScript using pip or npm. ```bash $ pip install syncsdk ``` ```bash $ npm i @sync.so/sdk ``` -------------------------------- ### Run the quick start script Source: https://sync.so/docs/developer-guides/sdk-python Execute the Python script to create and monitor a lip sync generation job. ```bash python quickstart.py ``` -------------------------------- ### Install Sync Labs TypeScript SDK Source: https://sync.so/docs/developer-guides/sdk-typescript Install the SDK using npm, yarn, or pnpm. Requires Node.js 18+. ```bash # npm npm i @sync.so/sdk # yarn yarn add @sync.so/sdk # pnpm pnpm add @sync.so/sdk ``` -------------------------------- ### Estimate Cost Request Example Source: https://sync.so/docs/api-reference/api/generate-api/estimate-cost This snippet shows a basic example of how to call the Estimate Cost API. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```bash curl --request POST \ --url https://api.sync.so/v2/analyze/cost \ --header 'Content-Type: application/json' \ --header 'x-api-key: YOUR_API_KEY' \ --data '{ "model": "sync-3", "video": { "url": "https://example.com/video.mp4" }, "prompt": "A cinematic shot of a dragon flying over a castle.", "output_format": "mp4" }' ``` -------------------------------- ### Install TypeScript SDK Source: https://sync.so/docs/developer-guides/sdk Install the Sync Labs TypeScript SDK. Requires Node.js 18+. ```bash npm i @sync.so/sdk ``` -------------------------------- ### Install ComfyUI Lipsync Node via CLI Source: https://sync.so/docs/plugins-and-extensions/comfy-ui Installs the comfyui-sync-lipsync-node directly within the ComfyUI custom nodes directory using the Comfy-CLI. This method also handles dependency installation. ```bash # Run this inside the custom_nodes folder comfy node install comfyui-sync-lipsync-node ``` -------------------------------- ### API Key Header Example Source: https://sync.so/docs/api-reference/guides/authentication Include your API key in the 'x-api-key' header for authentication. ```bash x-api-key: your-api-key ``` -------------------------------- ### sync-3 Generation Source: https://sync.so/docs/api-reference/api/generate-api/create This example demonstrates how to create a generation task using the sync-3 model. It shows the request payload structure and the expected response, along with SDK examples in various languages. ```APIDOC ## POST /v2/generate ### Description Initiates a content generation task using the specified model and input. ### Method POST ### Endpoint https://api.sync.so/v2/generate ### Parameters #### Request Body - **model** (string) - Required - The model to use for generation (e.g., "sync-3"). - **input** (array) - Required - An array of input objects, each specifying a type and URL. - **type** (string) - Required - The type of input (e.g., "video", "audio"). - **url** (string) - Required - The URL of the input resource. ### Request Example ```json { "model": "sync-3", "input": [ { "type": "video", "url": "https://assets.sync.so/docs/example-video.mp4" }, { "type": "audio", "url": "https://assets.sync.so/docs/example-audio.wav" } ] } ``` ### Response #### Success Response (200) - **createdAt** (string) - The timestamp when the generation task was created. - **id** (string) - The unique identifier for the generation task. - **input** (array) - The input provided for the generation. - **model** (string) - The model used for generation. - **status** (string) - The current status of the generation task (e.g., "PENDING"). - **error** (string) - Any error message if the generation failed. - **options** (object) - Additional options for the generation. - **outputDuration** (number) - The duration of the generated output. - **outputUrl** (string) - The URL of the generated output. - **webhookUrl** (string) - A webhook URL for status updates. #### Response Example ```json { "createdAt": "2026-04-07T12:00:00Z", "id": "id", "input": [ { "type": "video", "url": "https://assets.sync.so/docs/example-video.mp4" }, { "type": "audio", "url": "https://assets.sync.so/docs/example-audio.wav" } ], "model": "sync-3", "status": "PENDING", "error": "error", "options": {}, "outputDuration": 10.5, "outputUrl": "", "webhookUrl": "" } ``` ``` -------------------------------- ### Check Python Version Source: https://sync.so/docs/product/troubleshooting Verify your Python installation meets the SDK's minimum version requirement. ```bash python --version ``` -------------------------------- ### Sync-3 Request Example Source: https://sync.so/docs/api-reference/api/generate-api/create This JSON object represents a request to the sync-3 model, specifying video and audio inputs. ```json { "model": "sync-3", "input": [ { "type": "video", "url": "https://assets.sync.so/docs/example-video.mp4" }, { "type": "audio", "url": "https://assets.sync.so/docs/example-audio.wav" } ] } ``` -------------------------------- ### Get Generation Status with Swift Source: https://sync.so/docs/api-reference/api/generate-api/get This Swift example shows how to fetch generation status using URLSession. It configures the request with the necessary headers, including the API key. ```swift import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.sync.so/v2/generate/6533643b-aceb-4c40-967e-d9ba9baac39e")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Generation Status with PHP (Guzzle) Source: https://sync.so/docs/api-reference/api/generate-api/get This PHP example uses the Guzzle HTTP client to retrieve generation status. It includes setting the API key in the request headers. ```php request('GET', 'https://api.sync.so/v2/generate/6533643b-aceb-4c40-967e-d9ba9baac39e', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Set Up Python Virtual Environment Source: https://sync.so/docs/product/troubleshooting Create and activate a virtual environment to isolate project dependencies and avoid conflicts. ```bash python -m venv .venv source .venv/bin/activate pip install syncsdk ``` -------------------------------- ### List Generations using Java Unirest Source: https://sync.so/docs/api-reference/api/generate-api/list An example of listing generations using the Unirest library in Java. This concise code sets the API key header and executes the GET request. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.sync.so/v2/generations") .header("x-api-key", "") .asString(); ``` -------------------------------- ### Go: Create Generation with Files using HTTP Client Source: https://sync.so/docs/api-reference/api/generate-api/create-with-files This Go example shows how to make a POST request to the generation endpoint using the standard net/http package. It constructs a multipart/form-data payload for file uploads and includes the API key in the request headers. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.sync.so/v2/generate" payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"video\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nlipsync-2\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"options\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhookUrl\"\r\n\r\n\r\n-----011000010111000001101001--\r\n") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Video and Audio Inputs Source: https://sync.so/docs/developer-guides/sdk-python Demonstrates how to initialize Video and Audio objects using either public URLs or asset IDs from the Sync Labs media library. ```APIDOC ## Video and Audio Inputs ### URL Inputs Pass publicly accessible URLs for your video and audio files. ```python from sync.common import Video, Audio Video(url="https://your-cdn.com/video.mp4") Audio(url="https://your-cdn.com/audio.wav") ``` ### Asset IDs Reference files already uploaded to the Sync Labs media library by their asset ID. ```python from sync.common import Video, Audio Video(asset_id="550e8400-e29b-41d4-a716-446655440000") Audio(asset_id="660e8400-e29b-41d4-a716-446655440001") ``` ``` -------------------------------- ### Running ComfyUI with Listen Argument Source: https://sync.so/docs/plugins-and-extensions/comfy-ui Launch ComfyUI with the '--listen' argument to enable network access, often required after adjusting security settings for the ComfyUI Manager. ```bash python main.py --listen 127.0.0.1 ``` -------------------------------- ### Get Generation Status with JavaScript (Fetch API) Source: https://sync.so/docs/api-reference/api/generate-api/get Make a GET request to the Sync API endpoint using the Fetch API in JavaScript to get generation details. Remember to replace `` with your actual API key. ```javascript const url = 'https://api.sync.so/v2/generate/6533643b-aceb-4c40-967e-d9ba9baac39e'; const options = {method: 'GET', headers: {'x-api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### List Assets using cURL Source: https://sync.so/docs/api-reference/api/assets-api/list Demonstrates how to list assets using a cURL command. Includes API key authentication and query parameters for filtering and sorting. ```bash $ curl -G https://api.sync.so/v2/assets \ -H "x-api-key: " \ -d limit=10 \ -d sortBy=dateDesc ``` -------------------------------- ### Python SDK: Create Generation with Files Source: https://sync.so/docs/api-reference/api/generate-api/create-with-files Use the Sync Python SDK to create a generation by providing file references for video, image, and audio. Ensure you have initialized the Sync client with your API key. ```python from sync import Sync client = Sync( api_key="YOUR_API_KEY_HERE", ) client.generations.create_with_files( video="example_video", image="example_image", audio="example_audio", ) ``` -------------------------------- ### Generation Response Example Source: https://sync.so/docs/api-reference/api/generate-api/get This is an example of the JSON response you can expect when retrieving generation details. It includes status, input, and output information. ```json { "createdAt": "2024-01-15T09:30:00Z", "id": "6533643b-aceb-4c40-967e-d9ba9baac39e", "input": [ { "type": "video", "url": "https://example.com/video.mp4" } ], "model": "lipsync-2", "status": "PENDING", "error": "", "options": {}, "outputDuration": 1.1, "outputUrl": "", "webhookUrl": "" } ``` -------------------------------- ### Get Generation by ID Source: https://sync.so/docs/api-reference/api/generate-api/get Fetches the details of a specific generation job using its ID. This is a GET request to the /v2/generate/{id} endpoint. ```APIDOC ## GET /v2/generate/{id} ### Description Retrieves the status and details of a specific generation job. ### Method GET ### Endpoint /v2/generate/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the generation job. #### Request Headers - **x-api-key** (string) - Required - Your API key for authentication. ### Response #### Success Response (200) - **createdAt** (string) - The timestamp when the generation job was created. - **id** (string) - The unique identifier of the generation job. - **input** (array) - An array of input objects, each specifying a type and URL. - **model** (string) - The model used for the generation. - **status** (string) - The current status of the generation job (e.g., PENDING, PROCESSING, COMPLETED, FAILED). - **error** (string) - An error message if the generation failed, otherwise empty. - **options** (object) - Additional options used for the generation. - **outputDuration** (number) - The duration of the generated output. - **outputUrl** (string) - The URL to the generated output, if available. - **webhookUrl** (string) - The URL to which a webhook notification will be sent upon completion. ### Response Example ```json { "createdAt": "2024-01-15T09:30:00Z", "id": "6533643b-aceb-4c40-967e-d9ba9baac39e", "input": [ { "type": "video", "url": "https://example.com/video.mp4" } ], "model": "lipsync-2", "status": "PENDING", "error": "", "options": {}, "outputDuration": 1.1, "outputUrl": "", "webhookUrl": "" } ``` ``` -------------------------------- ### Initialize Python SDK with Direct API Key Source: https://sync.so/docs/api-reference/guides/authentication Alternatively, you can pass the API key directly to the Python SDK constructor. ```python sync = Sync(api_key="your-api-key") ``` -------------------------------- ### Python: Create Generation with Image Input Source: https://sync.so/docs/models/sync-3 Use the Sync SDK in Python to create a generation request with image and audio inputs. Ensure the Sync SDK is installed. ```python from sync import Sync from sync.common import Audio, Image sync = Sync() response = sync.generations.create( input=[ Image(url="https://assets.sync.so/docs/example-image.jpg"), Audio(url="https://assets.sync.so/docs/example-audio.wav") ], model="sync-3" ) ``` -------------------------------- ### List Generations API Response Example Source: https://sync.so/docs/api-reference/api/generate-api/list This is an example of the JSON response structure when listing generations. It includes details for a single generation entry. ```json [{"createdAt": "2024-01-15T09:30:00Z","id": "id","input": [{"type": "video","url": "https://example.com/video.mp4"}],"model": "lipsync-2","status": "PENDING","error": "error","options": {},"outputDuration": 1.1,"outputUrl": "","webhookUrl": ""}] ``` -------------------------------- ### Python: Create Generation with Video Input Source: https://sync.so/docs/models/sync-3 Use the Sync SDK in Python to create a generation request with video and audio inputs. Ensure you have the Sync SDK installed. ```python from sync import Sync from sync.common import Audio, Video sync = Sync() response = sync.generations.create( input=[ Video(url="https://assets.sync.so/docs/example-video.mp4"), Audio(url="https://assets.sync.so/docs/example-audio.wav") ], model="sync-3" ) ``` -------------------------------- ### Get Batch Details (Java Unirest) Source: https://sync.so/docs/api-reference/api/batch-api/get Use the Unirest library in Java to perform a GET request for batch job details. Set the 'x-api-key' header. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.sync.so/v2/batch/batch_abc123") .header("x-api-key", "") .asString(); ``` -------------------------------- ### OpenAPI Specification for Get Batch Source: https://sync.so/docs/api-reference/api/batch-api/get This OpenAPI 3.1.0 specification defines the GET /v2/batch/{id} endpoint, including parameters, request/response schemas, and error handling. ```yaml openapi: 3.1.0 info: title: api version: 1.0.0 paths: /v2/batch/{id}: get: operationId: get summary: Get Batch description: >- Retrieve details about a specific batch, including its current status, processing metrics, and output file URL when available. tags: - subpackage_batch parameters: - name: id in: path description: The unique identifier of the batch required: true schema: $ref: '#/components/schemas/type_common:BatchId' - name: x-api-key in: header required: true schema: type: string responses: '200': description: Response with status 200 content: application/json: schema: $ref: '#/components/schemas/type_common:BatchResponse' '401': description: Unauthorized - Invalid or missing authentication content: application/json: schema: $ref: '#/components/schemas/type_common:GenerationError' '404': description: Job not found content: application/json: schema: $ref: '#/components/schemas/type_common:GenerationError' '500': description: Internal Server Error - Failed to create or queue generation content: application/json: schema: $ref: '#/components/schemas/type_common:GenerationError' servers: - url: https://api.sync.so description: Default - url: https://dev-api.sync.so description: dev components: schemas: type_common:BatchId: type: string description: A unique identifier for the batch. title: BatchId type_common:BatchStatus: type: string enum: - PENDING - JOBS_CREATED - PROCESSING - COMPLETED - FAILED description: The status of the batch processing. title: BatchStatus type_common:BatchMetrics: type: object properties: total_generations: type: integer description: Total number of generation requests in the batch. success_count: type: integer description: Number of successfully completed generations. failed_count: type: integer description: Number of failed generations. pending_count: type: integer description: Number of generations still pending or processing. required: - total_generations - success_count - failed_count - pending_count title: BatchMetrics type_common:BatchResponse: type: object properties: id: $ref: '#/components/schemas/type_common:BatchId' created_at: type: string format: date-time description: The date and time the batch was created. status: $ref: '#/components/schemas/type_common:BatchStatus' description: The current status of the batch. metrics: $ref: '#/components/schemas/type_common:BatchMetrics' description: Metrics about the batch processing progress. webhookUrl: type: string description: The webhook URL for batch status notifications. outputUrl: type: string description: >- The URL to download the batch results file (available when completed). required: - id - created_at - status - metrics - outputUrl title: BatchResponse type_common:GenerationErrorMessage: oneOf: - type: string - type: array items: type: string description: A message describing the error. title: GenerationErrorMessage type_common:GenerationError: type: object properties: message: $ref: '#/components/schemas/type_common:GenerationErrorMessage' description: A message describing the error. statusCode: type: number format: double description: The type of error that occurred. required: - message - statusCode title: GenerationError securitySchemes: apiKey: type: apiKey in: header name: x-api-key ``` -------------------------------- ### Initialize Sync SDK Source: https://sync.so/docs/developer-guides/sdk-python Initialize the Sync SDK client. It automatically reads the API key from the SYNC_API_KEY environment variable. ```python from sync import Sync sync = Sync() # picks up SYNC_API_KEY from environment ``` -------------------------------- ### Install MCP Server Package Globally Source: https://sync.so/docs/plugins-and-extensions/mcp-server If you encounter 'command not found' errors with npx, install the package globally to resolve path issues with Node version managers. ```bash npm install -g @sync.so/mcp-server ``` -------------------------------- ### Get Generation Status with C# (RestSharp) Source: https://sync.so/docs/api-reference/api/generate-api/get Use the RestSharp library in C# to make a GET request to the Sync API. The API key is added as a header to the request. ```csharp using RestSharp; var client = new RestClient("https://api.sync.so/v2/generate/6533643b-aceb-4c40-967e-d9ba9baac39e"); var request = new RestRequest(Method.GET); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Video and Audio from URLs Source: https://sync.so/docs/developer-guides/sdk-python Pass publicly accessible URLs for video and audio inputs when creating Sync objects. ```python from sync.common import Video, Audio Video(url="https://your-cdn.com/video.mp4") Audio(url="https://your-cdn.com/audio.wav") ``` -------------------------------- ### OpenAPI Specification for Get Generation Source: https://sync.so/docs/api-reference/api/generate-api/get This OpenAPI 3.1.0 specification defines the GET /v2/generate/{id} endpoint, including parameters, request/response schemas, and possible status codes. ```yaml openapi: 3.1.0 info: title: api version: 1.0.0 paths: /v2/generate/{id}: get: operationId: get summary: Get Generation tags: - subpackage_generations parameters: - name: id in: path required: true schema: $ref: '#/components/schemas/type_common:GenerationId' - name: x-api-key in: header required: true schema: type: string responses: '200': description: Job status retrieved successfully content: application/json: schema: $ref: '#/components/schemas/type_common:Generation' '401': description: Unauthorized - Invalid or missing authentication content: application/json: schema: $ref: '#/components/schemas/type_common:GenerationError' '404': description: Job not found content: application/json: schema: $ref: '#/components/schemas/type_common:GenerationError' '500': description: Internal Server Error - Failed to create or queue generation content: application/json: schema: $ref: '#/components/schemas/type_common:GenerationError' servers: - url: https://api.sync.so description: Default - url: https://dev-api.sync.so description: dev components: schemas: type_common:GenerationId: type: string description: A unique identifier for the generation. title: GenerationId type_common:AssetId: type: string description: A unique identifier for an asset. title: AssetId type_common:SegmentSecs: type: array items: type: array items: type: number format: double description: >- start and end times (in seconds) of the video segment to apply generation to title: SegmentSecs type_common:SegmentFrames: type: array items: type: array items: type: integer description: start and end frames of the video segment to apply generation to title: SegmentFrames type_common:Video: type: object properties: type: type: string enum: - video url: type: string description: >- URL of the video to be used for generation. Either `url` or `assetId` must be provided. assetId: $ref: '#/components/schemas/type_common:AssetId' description: >- ID of a video asset from your media library. Either `url` or `assetId` must be provided. segments_secs: $ref: '#/components/schemas/type_common:SegmentSecs' description: >- [DEPRECATED] Use the top-level [segments](/api-reference/api/generate-api/create#request.body.segments) array instead for multi-segment support. segments_frames: $ref: '#/components/schemas/type_common:SegmentFrames' description: >- [DEPRECATED] Use the top-level [segments](/api-reference/api/generate-api/create#request.body.segments) array instead for multi-segment support. frames 100 and 200 of the video required: - type description: >- Video input for generation. Provide either `url` or `assetId` (one is required). title: Video type_common:Image: type: object properties: type: type: string enum: - image url: type: string description: >- URL of the image to be used for generation. Either `url` or `assetId` must be provided. assetId: $ref: '#/components/schemas/type_common:AssetId' description: >- ID of an image asset from your media library. Either `url` or `assetId` must be provided. required: - type description: >- Image input for sync-3 model. Use instead of video when generating from a static image. Provide either `url` or `assetId` (one is required). title: Image type_common:Audio: type: object properties: type: type: string enum: - audio url: type: string description: >- URL of the audio to be used for generation. Either `url` or `assetId` must be provided. assetId: $ref: '#/components/schemas/type_common:AssetId' description: >- ``` -------------------------------- ### Create Generation via HTTP POST (Go) Source: https://sync.so/docs/api-reference/api/generate-api/create This Go program demonstrates how to make an HTTP POST request to the generate endpoint. Ensure you replace '' with your actual API key. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.sync.so/v2/generate" payload := strings.NewReader("{ \n \"model\": \"sync-3\",\n \"input\": [\n {\n \"type\": \"video\",\n \"url\": \"https://assets.sync.so/docs/example-video.mp4\"\n },\n {\n \"type\": \"audio\",\n \"url\": \"https://assets.sync.so/docs/example-audio.wav\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Batch Details (C# RestSharp) Source: https://sync.so/docs/api-reference/api/batch-api/get Use the RestSharp library in C# to make a GET request to the batch API. Add your API key to the request headers. ```csharp using RestSharp; var client = new RestClient("https://api.sync.so/v2/batch/batch_abc123"); var request = new RestRequest(Method.GET); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Type Hinting for SDK Objects Source: https://sync.so/docs/developer-guides/sdk-python The SDK is fully typed, providing autocomplete and inline documentation. This example shows how to use type hints for request parameters and response objects. ```python from sync.common import ( Audio, Video, TTS, GenerationOptions, Generation, GenerationStatus, Model, ) # Response objects are typed -- your editor knows all available fields generation: Generation = sync.generations.get("job-id") status: GenerationStatus = generation.status # "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED" | "REJECTED" model: Model = generation.model # "lipsync-2" | "lipsync-2-pro" | ... output_url: str | None = generation.output_url ```