Skip to content

Latest commit

Β 

History

History
922 lines (636 loc) Β· 12.8 KB

File metadata and controls

922 lines (636 loc) Β· 12.8 KB

Reference

Assets

client.assets.list(...)

πŸ“ Description

List all assets in your organization's media library.

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.assets.list(
    limit=10,
    sort_by="dateDesc",
)

βš™οΈ Parameters

project_id: typing.Optional[str] β€” Filter assets by project ID.

limit: typing.Optional[int] β€” Maximum number of assets to return (1-100).

cursor: typing.Optional[str] β€” Cursor for pagination.

search_query: typing.Optional[str] β€” Search assets by name.

sort_by: typing.Optional[AssetSort] β€” Sort order for the results.

types: typing.Optional[typing.Sequence[AssetType]] β€” Filter by asset types. Accepts multiple types as a comma-separated list (AUDIO, VIDEO, IMAGE).

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.assets.get(...)

πŸ“ Description

Retrieve a specific asset by ID.

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.assets.get(
    id="550e8400-e29b-41d4-a716-446655440000",
)

βš™οΈ Parameters

id: AssetId

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Batch

client.batch.create(...)

πŸ“ Description

API for Batch Processing. Available only for Scale and Enterprise plans.

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.batch.create(
    dry_run=True,
)

βš™οΈ Parameters

input: `from future import annotations

core.File` β€” See core.File for more documentation

webhook_url: typing.Optional[str] β€” Optional webhook URL to receive batch completion notifications. A POST request will be sent when the batch completes or fails.

dry_run: typing.Optional[bool] β€” When true, validates the input file without processing. Returns validation status without creating generations.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.batch.get(...)

πŸ“ Description

Retrieve details about a specific batch, including its current status, processing metrics, and output file URL when available.

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.batch.get(
    id="batch_abc123",
)

βš™οΈ Parameters

id: BatchId β€” The unique identifier of the batch

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.batch.list(...)

πŸ“ Description

List all batches for your organization with optional filtering by status and creation date. Results are ordered by creation date (newest first).

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.batch.list()

βš™οΈ Parameters

status: typing.Optional[BatchStatus] β€” Filter batches by status

created_after: typing.Optional[dt.datetime] β€” Filter batches created after this datetime (ISO 8601 format)

created_before: typing.Optional[dt.datetime] β€” Filter batches created before this datetime (ISO 8601 format)

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Generations

client.generations.create(...)

πŸ”Œ Usage

from sync import Sync
from sync.common import Audio, GenerationOptions, Video

client = Sync(
    api_key="YOUR_API_KEY",
)
client.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="loop",
    ),
)

βš™οΈ Parameters

model: Model β€” name of the model to use for generation.

input: typing.Sequence[Input] β€” Array of input objects. Must include one video input item and at least one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration. When using segments, multiple audio inputs can be provided with unique refId values.

options: typing.Optional[GenerationOptions] β€” additional options available for generation.

segments: typing.Optional[typing.Sequence[GenerationSegment]] β€” segments definition list. When provided, allows defining one or more video segments with different audio inputs for each segment. Each segment specifies a time range and references an audio input by refId.

webhook_url: typing.Optional[str] β€” webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data.

output_file_name: typing.Optional[str] β€” Base filename for the generated output without extension. The .mp4 extension will be added automatically. Only alphanumeric characters, underscores, and hyphens are allowed, up to 255 characters.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.generations.create_with_files(...)

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.generations.create_with_files(
    model="lipsync-2",
)

βš™οΈ Parameters

model: Model

video: `from future import annotations

typing.Optional[core.File]` β€” See core.File for more documentation

audio: `from future import annotations

typing.Optional[core.File]` β€” See core.File for more documentation

input: typing.Optional[typing.List[Input]] β€” Array of input objects. Can be used to provide urls for larger files. Each input should either have a file or a url. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration.

options: typing.Optional[GenerationOptions]

webhook_url: typing.Optional[str]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.generations.get(...)

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.generations.get(
    id="6533643b-aceb-4c40-967e-d9ba9baac39e",
)

βš™οΈ Parameters

id: GenerationId

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.generations.list(...)

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.generations.list()

βš™οΈ Parameters

status: typing.Optional[typing.Sequence[GenerationStatus]] β€” Filter generations by status. Accepts multiple statuses as a comma-separated list.

ids: typing.Optional[typing.Sequence[str]] β€” Filter generations by ID. Accepts multiple IDs as a comma-separated list.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.generations.estimate_cost(...)

πŸ”Œ Usage

from sync import Sync
from sync.common import Audio, GenerationOptions, Video

client = Sync(
    api_key="YOUR_API_KEY",
)
client.generations.estimate_cost(
    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="loop",
    ),
)

βš™οΈ Parameters

model: Model β€” name of the model to use for generation.

input: typing.Sequence[Input] β€” Array of input objects. Must include one video input item and at least one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration. When using segments, multiple audio inputs can be provided with unique refId values.

options: typing.Optional[GenerationOptions] β€” additional options available for generation.

segments: typing.Optional[typing.Sequence[GenerationSegment]] β€” segments definition list. When provided, allows defining one or more video segments with different audio inputs for each segment. Each segment specifies a time range and references an audio input by refId.

webhook_url: typing.Optional[str] β€” webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data.

output_file_name: typing.Optional[str] β€” Base filename for the generated output without extension. The .mp4 extension will be added automatically. Only alphanumeric characters, underscores, and hyphens are allowed, up to 255 characters.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Models

client.models.list()

πŸ“ Description

List all available models for the authenticated user. Returns active (non-deprecated) models the user has access to, including any feature-flagged models enabled for their account.

πŸ”Œ Usage

from sync import Sync

client = Sync(
    api_key="YOUR_API_KEY",
)
client.models.list()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.