Repository navigation
feat(avatar): add sync-3 hosted lipsync via the sync. API - #994
Open
nachoiacovino wants to merge 1 commit into
Open
nachoiacovino wants to merge 1 commit into
nachoiacovino wants to merge 1 commit into
Conversation
Adds `sync_lipsync` (provider `sync`, env SYNC_API_KEY), a hosted lip-sync
option next to the local Wav2Lip `lip_sync` tool. It defaults to sync-3 and
also offers lipsync-2-pro and lipsync-2 as cheaper per-second options.
- Video or still-image input (image is sync-3 only) plus speech audio, local
paths or public HTTPS URLs. Local files upload through sync.'s presigned
asset flow; the API key is never sent to the upload URL.
- Submit-then-poll on POST /v2/generate and GET /v2/generate/{id}. Every
submit carries an Idempotency-Key saved with the job before the request, so
a timeout or 5xx is resumed with resume_job and cannot start a second paid
generation.
- sync_mode, active_speaker_detection and native options pass through;
options sync-3 manages itself (temperature, occlusion_detection_enabled,
reasoning_enabled) are rejected locally before any paid call.
- NO_OP, FAILED and REJECTED are reported as failures with the error code;
plan and credit errors set needs_user_action; 429 concurrency is retryable.
- estimate_cost raises PriceQuoteRequired (pricing varies by plan);
dry_run returns a free quote from POST /v2/generations/estimate.
- Offered next to lip_sync in the localization-dub and avatar-spokesperson
asset stages as an optional tool; the local Wav2Lip tool is unchanged.
- Layer 3 skill sync-lipsync, contract tests with faked HTTP, PROVIDERS.md,
ARCHITECTURE.md, .env.example and lip-sync skill docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds sync-3 as a hosted lip-sync option through the sync. API: a new
sync_lipsynctool (providersync, envSYNC_API_KEY) that sits next to the local Wav2Liplip_synctool under theavatarcapability. sync-3 is the default model;lipsync-2-proandlipsync-2are the cheaper per-second options.sync-3 comes from the team behind Wav2Lip, which OpenMontage's
lip_syncalready runs. It adds what Wav2Lip struggles with: close-ups, profile and over-the-shoulder angles, hands or mics over the mouth, long takes, 4K output, and a still image as input. It needs no local GPU.localization-dubgets the most out of it.I added a separate tool rather than a backend inside
lip_sync.lip_syncis pinned as the local Wav2Lip tool (provider == "wav2lip", runtimelocal_gpu, asserted intest_kling_official_avatar.py), and hosted providers here get their own tool (kling_lip_sync,heygen_avatar). Both pipelines that uselip_syncnow listsync_lipsyncas an optional tool next to it, so it shows up as an option wherever lip sync does.Billing is bring-your-own-key: each user creates a key at https://sync.so/settings/api-keys and is billed per output second by sync.
Related issue
None. Opened after the maintainer said yes to the proposal by email.
Changes
tools/avatar/sync_lipsync.py: newSyncLipSync(BaseTool),capability="avatar", auto-discovered by the registry.video_path/video_url/image_path/image_url(images need sync-3) plusaudio_pathoraudio_url.modelis one ofsync-3(default),lipsync-2-proorlipsync-2.sync_modeis one ofbounce(default),loop,cut_off,silenceorremap. Also acceptsactive_speaker_detectionand passthroughoptions.POST /v2/assets/upload,PUT,POST /v2/assets). The API key is never sent to the upload URL, and nothing goes to a third-party host.POST /v2/generateandGET /v2/generate/{id}. Every submit carries anIdempotency-Keythat is saved tojob_pathbefore the request. A timeout or 5xx on submit returnsresume_job, and resuming replays the same key and body, so it can never create a second paid generation. A poll timeout returnsresume_jobwith the generation id, and resuming only polls.temperature,occlusion_detection_enabled,reasoning_enabled) are rejected locally before any paid call.reasoning_enabled: trueon sync-3 is an API 400.NO_OP(nothing lipsynced, e.g. no face found) is reported as a failure, never as a finished lipsync.FAILED/REJECTEDsurfaceerror_code. Plan and credit errors setneeds_user_action.429 concurrency_limit_reachedis retryable throughresume_job.estimate_costraisesPriceQuoteRequiredbecause pricing depends on the plan.dry_run: truereturns a free quote fromPOST /v2/generations/estimatewithout uploading or generating, using ffprobe for a localaudio_pathorduration_secondsfor a URL. A resume preflight returns the saved quote.pipeline_defs/localization-dub.yaml,pipeline_defs/avatar-spokesperson.yaml:sync_lipsyncadded tooptional_toolsandtools_availablenext tolip_sync. Nothing is required, and no default routing changes..agents/skills/sync-lipsync/SKILL.md: Layer 3 skill covering model choice, inputs, speaker selection, sync modes, quoting, the dubbing workflow, failure codes and resume.docs/PROVIDERS.md(env summary, quick-start row, provider section, provider table, avatar coverage),docs/ARCHITECTURE.md(avatar inventory, env table),.env.example(SYNC_API_KEY, optionalSYNC_API_BASE_URL),skills/creative/lip-sync-usage.md, both asset-director skills,skills/INDEX.md.tests/contracts/test_sync_lipsync.py: 35 tests with all HTTP faked. They cover metadata, registry discovery, status with and without the key, pipeline wiring, the local Wav2Lip tool being unchanged, request building and validation, upload, submit, poll and download, key saved before submit, resume with and without a generation id, poll timeout,FAILED/REJECTED/NO_OP, 429 and 402 handling, dry-run quotes, and the base URL override.The existing
lip_sync(Wav2Lip) tool is not modified.Testing
pytest tests/contracts/test_sync_lipsync.py: 35 passed.make lintpasses.pytest tests/: 2941 passed, 20 skipped, 9 failed. The same 9 tests fail on unmodifiedmainon my machine, because local ffmpeg lackslibvorbis,drawtextandlibass(audio_enhance libvorbis, bmts_lite, caption isolation, showcase_card). None touch this change; onmainthe totals were 2905 passed and the same 9 failed.SYNC_API_KEYunset,sync_lipsyncis discovered asunavailablewith setup instructions and appears inprovider_menu. With the key set it reportsavailable.SyncLipSync().execute(...)in this PR. Happy to do one and post the generation id, or to send you a budget-capped key so you can try it end to end.Checklist
make test-contracts/make test) where applicable.Disclosure: I work at sync. (sync.so).
🤖 Generated with Claude Code