WWeydub API

Agent skill

Weydub API Skill

Use this skill when building or reviewing code that calls Weydub API from a backend service, script, internal tool, CI job, AI coding tool, or automation agent.

Source Of Truth

Read these docs before implementing:

  • https://weydub.com/docs/api/
  • https://weydub.com/docs/api/quickstart.md
  • https://weydub.com/docs/api/api-reference.md
  • https://weydub.com/docs/api/auth-and-signing.md
  • https://weydub.com/docs/api/async-task-model.md
  • https://weydub.com/docs/api/demo-scenarios.md

Then read the workflow page that matches the task:

  • Subtitle/text removal: https://weydub.com/docs/api/video-subtitle-removal.md
  • Video translation/dubbing: https://weydub.com/docs/api/video-translation.md
  • Subtitle extraction: https://weydub.com/docs/api/subtitle-extraction.md
  • Image translation: https://weydub.com/docs/api/image-translation.md

Core Contract

  • Base URL: https://api.zhaoli.com
  • Protocol: HTTPS
  • Request method: POST
  • Content type: application/json
  • Auth headers: AppKey, AppSign
  • Signature: AppSign = md5(md5(request_body) + AppSecret)
  • Use compact JSON for signing and sending.
  • Treat media jobs as asynchronous.
  • Confirm account entitlement before using image API, Advanced Lite/Pro removal, high-emotion dubbing, or batch-specific flows.
  • Use callbacks in production and polling as a fallback.
  • Verify Callback-Sign for webhook callbacks.
  • Keep AppSecret server-side only.

Unsigned exception:

text
POST /v-w-c/enum/query2

Use it for dynamic enums such as sourceLang, Lang, ProcessStatus, and ImageTaskStatus.

Credential Rules

  • Read credentials from WEYDUB_APP_KEY and WEYDUB_APP_SECRET, or from a secret manager.
  • Never hardcode credentials.
  • Never put AppSecret in browser/client code.
  • Never print AppSecret in logs, screenshots, error messages, or generated docs.
  • Never paste real credentials into prompts, issue trackers, or retained chat history.

Implementation Pattern

  1. Build a small backend client with one apiPost(path, payload) helper.
  2. Serialize payload with compact JSON.
  3. Compute bodyMd5 = md5(body).
  4. Compute AppSign = md5(bodyMd5 + AppSecret).
  5. Send Content-Type, AppKey, and AppSign headers.
  6. Persist returned project/work/task IDs.
  7. Poll status or receive callback.
  8. Verify callback signatures and make callback handlers idempotent.
  9. Store final videoUrl, srcSrtUrl, tgtSrtUrl, image result URLs, and errorDetail.

Four Main Workflows

Remove Subtitles And Text

Endpoint:

text
POST /v-w-c/gateway/ve/work/free

Basic payload:

json
{
  "urls": ["https://example.com/video.mp4"],
  "needChineseOcclude": 1,
  "videoInpaintLang": "all"
}

Use needChineseOcclude: 2 and videoInpaintMasks for known regions. Use extraOptions.extra_inpaint_config.model for Advanced Lite/Pro when enabled. Do not assume moving text, Advanced Lite, Advanced Pro, or CRF override entitlement.

Common models:

  • advanced_lite
  • advanced_large_box
  • advanced_full

CRF override can use extraOptions.write_options.crf when enabled. Lower CRF values such as 15 or 16 can add storage/bandwidth cost.

Keep videoInpaintMasks and extraOptions as compact JSON strings in public API payloads unless the account contract says otherwise.

Translate Videos

Endpoint:

text
POST /v-w-c/gateway/ve/work/free

Full subtitle + dubbing payload:

json
{
  "urls": ["https://example.com/source.mp4"],
  "needWanyin": 1,
  "sourceLang": "en",
  "lang": "es",
  "wyTaskType": "FULL",
  "wyNeedText": 1
}

Other modes:

  • Subtitle only: wyTaskType: "NO_TTS" or account-supported equivalent.
  • ASR only: wyTaskType: "ONLY_ASR", wyNeedText: 0.
  • On-screen text translation: needWanyin: 0, needChineseOcclude: 11.
  • High-emotion dubbing: POST /v-w-c/gateway/ve/work/voice/incorporate only when enabled.

Keep wyVoiceParam and extraOptions as compact JSON strings when used.

Extract Subtitles

OCR payload:

json
{
  "urls": ["https://example.com/video.mp4"],
  "needChineseOcclude": 14,
  "videoInpaintLang": "en",
  "lang": "en",
  "videoInpaintMasks": "[{\"type\":\"trans_only_ocr\",\"region\":[[0,0.8],[1,0.8],[1,1],[0,1]]}]",
  "extraOptions": "{\"extra_inpaint_config\":{\"auto_correct_on\":false,\"strip_last_punct_on\":true,\"scene_filter_on\":false}}"
}

ASR payload:

json
{
  "urls": ["https://example.com/video.mp4"],
  "needWanyin": 1,
  "sourceLang": "en",
  "lang": "en",
  "wyTaskType": "ONLY_ASR",
  "needWyEdit": 0,
  "wyNeedText": 0,
  "extraOptions": "{\"asr_speaker_detect_on\":true,\"extra_video_translate_config\":{\"remove_last_punct_on\":true}}"
}

Use OCR for burned-in captions. Use ASR for spoken dialogue.

Translate Images

Confirm image API activation before production use.

Current public endpoint:

text
POST /v-w-c/gateway/ve/image/translate

Image translation payload:

json
{
  "srcLang": "en",
  "tgtLang": "es",
  "translateOn": 1,
  "synthesisOn": 1,
  "commodityFilterOn": 0,
  "downloadInfo": "{\"url\":\"https://example.com/product.png\",\"fileName\":\"product.png\",\"id\":12345,\"materialName\":\"product.png\"}",
  "app": "WD"
}

Image text removal payload:

json
{
  "srcLang": "en",
  "tgtLang": "en",
  "translateOn": 0,
  "synthesisOn": 1,
  "commodityFilterOn": 0,
  "downloadInfo": "{\"url\":\"https://example.com/banner.png\",\"fileName\":\"banner.png\",\"id\":12346,\"materialName\":\"banner.png\"}",
  "app": "WD"
}

Redo endpoint:

text
POST /v-w-c/gateway/ve/image/translate/redo

For redo, edit only meta_data.translation, meta_data.fill_color, meta_data.stroke_color, and meta_data.trans_font_size unless support confirms otherwise.

Keep downloadInfo, downloadInfos, and redo result stringified.

Limits And Retention

  • Video hard limit: 15 minutes per file.
  • Video hard limit: 1000 MB per file.
  • Image hard limits: 2000*2000 px, 50 MB.
  • Image formats: png, jpeg, jpg, bmp, webp.
  • Image URLs must not contain Chinese characters.
  • Video billing unit: 30 seconds. Clips shorter than 30 seconds count as 30 seconds.
  • Combined services can stack costs.
  • Final failed tasks (processStatus > 1) deduct zero credits.
  • Default resource retention keeps source/rendered assets for the last 30 days. Store result assets after callback.
  • Default video CRF is 17; lower CRF such as 15 or 16 can increase bandwidth/storage cost when enabled.

Callback Rules

  • Callback body is the work/task item, not the polling response wrapper.
  • Verify Callback-Sign with md5(md5(raw_callback_body) + AppSecret).
  • Return HTTP 200 plus any non-empty body only after durable storage succeeds.
  • Failed callbacks for tasks created within 24 hours are retried about every 30 minutes.
  • Make handlers idempotent by work ID or image task ID.
  • Redo operations can change output URLs; store the latest successful URL.

Demo QA

Use official demo assets before customer media:

  • English video: http://gc9.cdn.izhaoli.cn/ghostcut_demo/TextRemoval_Dubbing_Eng.mp4
  • Chinese high-emotion video: http://gc9.cdn.izhaoli.cn/ghostcut_demo/HighEmotion_Dubbing_cn2en.mp4
  • Chinese high-emotion JSON: http://gc9.cdn.izhaoli.cn/ghostcut_demo/HighEmotion_Dubbing_cn2en.json

This repository may include:

bash
python3 scripts/run-weydub-api-demos.py --dry-run
python3 scripts/run-weydub-api-demos.py --scenario removal --submit --wait

Do Not

  • Do not create frontend-only examples that expose AppSecret.
  • Do not sign pretty JSON and send compact JSON.
  • Do not mutate payloads after signing.
  • Do not treat create responses as completed jobs.
  • Do not invent endpoint availability for an account.
  • Do not combine unrelated workflow modes in one request unless the docs show that exact combination.
  • Do not skip result storage; Weydub assets follow retention rules.