API DocsAI Model APIsVideosHappyHorse

Video Editing

Edit an existing video with style transfer, local replacement, and similar operations, optionally with 0–5 reference images. Output duration follows the input video (max 15 seconds). Supports up to 1080P resolution. This is an async task-based API: submit a request to receive a task_id, poll for status, then download the video when complete.

Base URL

  • https://api.autorouter.top — Production

Authentication

BearerAuth: http (bearer) Authenticate using a Bearer Token. Format: Authorization: Bearer sk-xxxxxx

Endpoints

POST /api/v1/services/aigc/video-generation/video-synthesis

Create Video Editing Task

Create a video editing task from an existing video.

The request header must include X-DashScope-Async: enable.

Request Body

Content-Type: application/json

Example:

{
  "model": "happyhorse-1.0-video-edit",
  "input": {
    "prompt": "Make the horse-headed character in the video wear the striped sweater from the image",
    "media": [
      {
        "type": "video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260409/dozxak/Wan_Video_Edit_33_1.mp4"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260415/hynnff/wan-video-edit-clothes.webp"
      }
    ]
  },
  "parameters": {
    "resolution": "720P"
  }
}

Properties:

NameTypeRequiredDescription
modelstringYesModel name. Fixed value: happyhorse-1.0-video-edit
inputobjectYesBasic input such as the video to edit, reference images, and prompt
input.promptstringYesText prompt describing the editing intent (e.g. style transfer, local replacement). Supports any language. Maximum 5,000 non-Chinese characters or 2,500 Chinese characters; excess is truncated automatically
input.mediaarrayYesMedia list. Must contain exactly one element with type video. May optionally include 0–5 elements with type reference_image
input.media[].typestringYesMedia type. Available values: video (video to edit; required, exactly one), reference_image (optional, 0–5)
input.media[].urlstringYesMedia URL. Video (type=video): Publicly accessible HTTP/HTTPS link (e.g. https://xxx/xxx.mp4). Limits: MP4/MOV (H.264 recommended); duration 3–60 seconds; long side ≤ 4096 px, short side ≥ 360 px; aspect ratio 1:2.5–2.5:1; max 100MB; frame rate > 8fps. Output duration is 3–15 seconds: if input ≤ 15s, output matches input; if input exceeds 15s, only the first 15 seconds are used. Reference image (type=reference_image): Public HTTP/HTTPS link, or Base64 string (data:{MIME_type};base64,{base64_data}). Limits: JPEG/JPG/PNG/WEBP; width and height ≥ 300 px; aspect ratio 1:2.5–2.5:1; max 20MB
parametersobjectNoVideo editing parameters such as resolution
parameters.resolutionstringNoOutput video resolution tier. Available values: 1080P (default), 720P
parameters.watermarkbooleanNoWhether to add a watermark (fixed text "Happy Horse" in the bottom-right corner). true (default) adds it; false does not
parameters.audio_settingstringNoControls video audio. Available values: auto (default, model-controlled audio), origin (keep the original audio from the input video)
parameters.seedintegerNoRandom seed in [0, 2147483647]. Auto-generated if omitted. A fixed seed improves reproducibility but does not guarantee identical results

Responses

200: Task created successfully

Content-Type: application/json

400: Bad request / invalid parameters

Content-Type: application/json

429: Rate limit exceeded

Content-Type: application/json

Request Example

curl -X POST "https://api.autorouter.top/api/v1/services/aigc/video-generation/video-synthesis" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxxxx" \
  -H "X-DashScope-Async: enable" \
  -d '{
  "model": "happyhorse-1.0-video-edit",
  "input": {
    "prompt": "Make the horse-headed character in the video wear the striped sweater from the image",
    "media": [
      {
        "type": "video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260409/dozxak/Wan_Video_Edit_33_1.mp4"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260415/hynnff/wan-video-edit-clothes.webp"
      }
    ]
  },
  "parameters": {
    "resolution": "720P"
  }
}'

Response Example

{
  "output": {
    "task_status": "PENDING",
    "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
  },
  "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Response fields:

NameTypeDescription
outputobjectTask output
output.task_idstringTask ID for status queries. Valid for 24 hours
output.task_statusstringTask status. Enum: PENDING (queued), RUNNING (processing), SUCCEEDED (success), FAILED (failed), CANCELED (canceled), UNKNOWN (missing or unknown)
request_idstringUnique request ID for tracing and troubleshooting
codestringError code. Returned only when the request fails
messagestringError message. Returned only when the request fails

GET /api/v1/tasks/{task_id}

Query Task Result by ID

Query task status and result using the task_id returned when creating the task. Queries are valid for 24 hours.

Headers

NameTypeRequiredDescription
AuthorizationstringYesRequest authentication. Format: Bearer sk-xxxxxx

Path Parameters

NameTypeRequiredDescription
task_idstringYesTask ID

Responses

200: Task queried successfully

Content-Type: application/json

400: Bad request / invalid parameters

Content-Type: application/json

429: Rate limit exceeded

Content-Type: application/json

Request Example

curl -X GET "https://api.autorouter.top/api/v1/tasks/{task_id}" \
  -H "Authorization: Bearer sk-xxxxxx"

Response Example

{
  "request_id": "99243b47-ec5f-9413-9993-xxxxxx",
  "output": {
    "task_id": "4673458e-28be-4a05-bf2a-xxxxxx",
    "task_status": "SUCCEEDED",
    "submit_time": "2026-04-20 17:55:17.075",
    "scheduled_time": "2026-04-20 17:55:17.129",
    "end_time": "2026-04-20 17:56:36.658",
    "orig_prompt": "Make the horse-headed character in the video wear the striped sweater from the image",
    "video_url": "https://dashscope-result.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx"
  },
  "usage": {
    "duration": 5,
    "input_video_duration": 5,
    "output_video_duration": 5,
    "video_count": 1,
    "SR": 720
  }
}

Response fields:

NameTypeDescription
outputobjectTask output
output.task_idstringTask ID. Valid for queries for 24 hours
output.task_statusstringTask status. Enum: PENDING (queued), RUNNING (processing), SUCCEEDED (success), FAILED (failed), CANCELED (canceled), UNKNOWN (missing or unknown). Typical poll flow: PENDINGRUNNINGSUCCEEDED / FAILED
output.submit_timestringTask submission time, format YYYY-MM-DD HH:mm:ss.SSS
output.scheduled_timestringTask execution time, format YYYY-MM-DD HH:mm:ss.SSS
output.end_timestringTask completion time, format YYYY-MM-DD HH:mm:ss.SSS
output.video_urlstringVideo download URL. Returned only when task_status is SUCCEEDED. Link valid for 24 hours; video is MP4 (H.264)
output.orig_promptstringOriginal prompt, corresponding to the request prompt
output.codestringError code. Returned only when the task fails
output.messagestringError message. Returned only when the task fails
usageobjectOutput statistics. Returned only on success
usage.input_video_durationintegerInput video duration in seconds
usage.output_video_durationintegerOutput video duration in seconds
usage.durationintegerTotal video duration used for billing, equal to input_video_duration + output_video_duration
usage.SRintegerOutput video resolution tier
usage.video_countintegerNumber of output videos. Always 1
request_idstringUnique request ID for tracing and troubleshooting

Error Handling

HTTP 400 Parameter Errors (pre-submit validation, no billing)

AutoRouter validates required fields before submitting upstream:

ScenarioResponse
Missing input.prompt{"code":"InvalidParameter","message":"...","request_id":"..."}
Missing input.media or video{"code":"InvalidParameter","message":"...","request_id":"..."}
Unknown model{"code":"InvalidParameter","message":"unknown model: ...","request_id":"..."}

HTTP 401 / 403 Auth Errors

  • 401 Unauthorized: API Key invalid or expired
  • 403 Forbidden: API Key has no access to this model (check token's model allowlist)

HTTP 402 Insufficient Balance

Returns insufficient user quota. Top up at the AutoRouter console.

Task FAILED Status

The task was accepted but upstream generation failed (output.task_status == "FAILED"). See output.code / output.message for details:

ReasonSuggested Action
Content moderationAdjust prompt to avoid sensitive content
Missing video to editmedia must contain exactly one type: video element
Invalid reference image countReference images: 0–5 type: reference_image
Media URL unreachableEnsure the URL is publicly accessible and not expired
Media file violates specsSee video / image limits in Request Body
Illegal parameter comboFollow the Request Body specification

When a task enters FAILED, AutoRouter automatically refunds the billed quota. Check refund records in the logs page.

On this page