7 synchronicity-labs
sync-api Skill
通过 sync. REST API 或官方 Python(syncsdk)与 TypeScript(@sync.so/sdk)SDK,将 sync. labs(sync.so)的口型同步、配音和图片说话功能集成到应用、后端、脚本或流水线中。涵盖 API 密钥、上传、使用幂等键创建生成任务、带签名校验的 webhook、轮询、模型、成本估算、错误处理和并发限制。凡代码调用或需要调用 sync. API 时均可使用,例如"给我的 Next.js 应用加口型同步""写个用 sync. 给视频配音的 Python 脚本""处理 sync. webhook""我的 sync. 请求为什么返回 429"等。
安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。
技能指令原文(SKILL.md)
Build with the sync. API
sync. labs | API integration guide
Builds a server-side integration that uploads media, saves each request before submitting it, tracks jobs to completion, and retries without starting duplicate paid work.
Ground rules
- Server-side only. The API key goes in
SYNC_API_KEYon the server, never in browser or mobile code. Browsers talk to your backend, and your backend talks to sync. Keys come from https://sync.so/settings/api-keys. - Base URL
https://api.sync.so/v2, headerx-api-key. - SDKs: Python
pip install syncsdk(from sync import Sync), TypeScriptnpm i @sync.so/sdk(new SyncClient()). Both readSYNC_API_KEY. The SDKs cover generations (create,get,list). Some newer request fields can lag behind the API: image inputs,dubParams,dialogueEdit,projectId, uploads and cost estimates. When the installed SDK's types don't include one, call the endpoint over HTTP as the references show, instead of forcing the types. - Docs for anything not covered here: https://sync.so/docs/llms-full.txt, plus the error catalog at
GET https://api.sync.so/v2/errors, which needs no key.
The flow to implement
- Get the media into sync. Public
https://URLs work directly. For user uploads or local files, use the three-step asset upload (presigned URL,PUT, register) and keep the returned asset ID. Don't proxy large files through your own API. - Create the generation with
POST /v2/generate(SDKgenerations.create): themodel, one visual input (video, or an image with sync-3) and one speech input (audio, or text with an ElevenLabsvoiceId), plus optionaloptions,webhookUrlandoutputFileName. Send anIdempotency-Keyheader. Create the key once per user action, store it with your job record before the request, and reuse it on every retry. A retry with the same key and body replays the original generation instead of starting a paid duplicate. - Find out when it's done. Prefer a
webhookUrl, and verify theSync-Signatureheader (references/webhooks.md). Keep pollingGET /v2/generate/{id}as a fallback: with?wait=true&timeout=10the server holds the request open up to 10 seconds. Terminal statuses areCOMPLETED,FAILEDandREJECTED. The video is atoutputUrl. Copy it to your own storage if you need to keep it. - Handle errors. Use the table in references/api.md. The cases that matter most are a
429 concurrency_limit_reached(waitretryAfterSeconds, then retry with the same key), plan and credit errors (stop and tell the user), and unknown outcomes after a timeout (retry with the same key, never a new one).
Full examples: references/python.md and references/typescript.md. REST with curl: references/api.md.
Choosing options
- Model: default to
sync-3, the most capable: it handles close-ups, profile angles, occlusion and still images.lipsync-2-proandlipsync-2cost less per second. Take current model names fromGET /v2/modelsrather than hard-coding a list. Get prices fromPOST /v2/generations/estimate({"model", "duration"}), not from constants in code, because pricing differs by plan. sync_mode, for when the audio and video lengths differ:bounce(the default),loop,cut_off,silenceorremap. Expose it to users when they upload mismatched clips.- Several faces: set
options.active_speaker_detection, for example{"auto_detect": true}, or point at the speaker withframe_numberandcoordinates. - Dubbing: one video input and
dubParams: {"providerName": "elevenlabs", "targetLang": "es"}, with no audio input. - Different audio on different parts of one video: use
segments. See https://sync.so/docs/developer-guides/segments.
Scale
- Each plan caps how many generations run at once. The 429 response carries
concurrencyLimitandretryAfterSeconds, plusX-Sync-Concurrency-LimitandRetry-Afterheaders. Queue jobs on your side and keep at most that many in flight. Creating generations is also rate-limited, at about 100 a minute.
Before you hand the code back
- No key in source, logs or client bundles.
.envfiles are ignored by git. - Every create carries an idempotency key that is stored before the call and reused on retry.
- The webhook handler verifies the signature against the raw body, answers
2xxquickly, and tolerates duplicate deliveries. - Long jobs are tracked in your own store with their generation ID, not held in a request that's waiting.
- Test with a short clip first. Generations are billed, so use
POST /v2/generations/estimateto show the cost before an expensive run.