Viral video remake

Introduction

Capability key: video.edit · API origin: https://api.anycap.io

Viral video remake renders a new video from a source video you own. The platform keeps the source motion, camera work, composition and timing, and applies your editing instruction together with target reference images, reference videos and reference audio: replace a person, a product, an object or a background, or transfer a consistent style. It is an asynchronous task: submit once, then read the durable task state until it completes.

Unified API (recommended)

New integrations call POST /v1/generations with type=video_edit. The /v1/videos/edits endpoints below remain supported for compatibility.

BASH
curl -X POST https://api.anycap.io/v1/generations \  -H "Authorization: Bearer $ANYCAP_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "type": "video_edit",    "model": "<model from GET /v1/generations/models?type=video_edit>",    "input": {      "video_file_id": "<owned source video id>",      "prompt": "replace the product on the table, keep the camera move"    },    "parameters": { "resolution": "480P", "ratio": "adaptive" }  }'
FieldMeaning
input.video_file_id
Owned source video; upload it to POST /v1/video-materials?kind=video first.
input.prompt
Editing instruction. Reference media by order: 图1, 参考视频1.
input.reference_*_file_ids
Optional owned reference images (JPG/WebP/BMP), videos or audio.
parameters
resolution, ratio, duration.
Video-edit jobs return 202 with job; poll GET /v1/generations/{id}?result=true. DELETE cancels only a queued job; the LAS operator has no cancellation.

1. Setup

  • Create a connection key in the console under Agent Access and authorize the editing capability.
  • Upload the source video, reference videos, reference audio and reference images to POST /v1/video-materials?kind=video|audio|image with a multipart file field. The upload is retained for 72 hours. The source video must be an Anycap-owned upload no longer than 15 seconds; public URLs are not accepted for the source video. Use the returned id as video_file_id or a reference file id.
  • Every request uses Authorization: Bearer <ANYCAP_API_KEY> and Content-Type: application/json. Never send Cookie or Origin, and never reuse a browser session.
  • There is one discovery surface: query GET /v1/videos/models?capability=video.edit. It returns the editing models with their own prices and limits; create with one of those model values. Never invent model names or prices.
BASH
curl -X POST "https://api.anycap.io/v1/video-materials?kind=video" \  -H "Authorization: Bearer $ANYCAP_API_KEY" \  -F "[email protected]"

2. Endpoints

StepMethodPathSuccess
Model discoveryGET/v1/videos/models?capability=video.edit200
Upload owned mediaPOST/v1/video-materials?kind=video201
Create an editing taskPOST/v1/videos/edits202
Read a taskGET/v1/videos/edits/{id}200
Read a task and fetch the result URLGET/v1/videos/edits/{id}?result=true200
Cancel a task not yet submitted upstreamDELETE/v1/videos/edits/{id}200

prompt is the editing instruction: describe what to replace, restyle or keep in the source video.

3. Create a task

Example:

BASH
curl -X POST https://api.anycap.io/v1/videos/edits \  -H "Authorization: Bearer $ANYCAP_API_KEY" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: remake-7f4c2b1a" \  -d '{    "model": "doubao-seedance-2-0-mini-260615",    "video_file_id": "<source video file id>",    "prompt": "replace the product on the table with the target product, keep the camera move",    "resolution": "720P",    "ratio": "original",    "reference_image_urls": ["https://cdn.example.com/target-product.png"]  }'
FieldRequiredMeaning
modelYes
MeaningModel from model discovery; an unavailable model is rejected with field=model, never a silent substitution.
video_file_idYes
MeaningAnycap-owned source video file id from POST /v1/video-materials?kind=video; it must be unexpired and no longer than 15 seconds.
promptYes
MeaningEditing instruction. The effective limit is the selected source's max_prompt_characters; an empty prompt is rejected.
resolutionNo
Meaning480P, 720P or 1080P. 4K is not offered and returns 400.
ratioNo
MeaningMust be supported by the source. original and adaptive both keep the source video's ratio.
durationNo
MeaningOutput length in whole seconds, at least the source's min_duration (4 s for Seedance 2.x) and never above its maximum. Omit it to follow the source video's length.
reference_image_urlsNo
MeaningPublic HTTPS target images (the person, product or style to place in the remake).
reference_image_file_idsNo
MeaningAnycap-owned reference images (JPG, WebP or BMP; PNG is not accepted). Combined with reference_image_urls, the source's max_reference_images (1–30) is the effective limit.
reference_video_file_idsNo
MeaningAnycap-owned reference videos in addition to the source video. The source's max_reference_videos caps the count, each clip must be at least 2 seconds, and the source plus all reference videos must stay within max_total_video_seconds.
reference_audio_file_idsNo
MeaningAnycap-owned reference audio. The source's max_reference_audios caps the count, each clip must be between audio_min_seconds and audio_max_seconds, and all audio must stay within max_total_audio_seconds.
idempotency_keyNo
MeaningOptional; the Idempotency-Key header takes precedence. A repeated key returns the recorded job and never resubmits.

Every model entry publishes input_types plus max_reference_images, max_reference_videos, max_reference_audios, audio_min_seconds, audio_max_seconds, max_total_video_seconds and max_total_audio_seconds; a request outside the chosen model's limits is rejected with 400 before submission.

  • The source video is the edit input and counts toward max_total_video_seconds; additional reference videos are capped separately by max_reference_videos.
  • Reference videos must each be at least 2 seconds and are measured with the source video before pricing.
  • Each reference audio must be between audio_min_seconds and audio_max_seconds; all audio is summed against max_total_audio_seconds.
  • Reference videos and audio must be Anycap-owned uploads from POST /v1/video-materials?kind=video|audio, unexpired: only their measured seconds can be billed. Owned reference images must be JPG, WebP or BMP (PNG is not accepted); public HTTPS image URLs are also accepted.
Omitting duration means the output follows the source video's length: the platform measures the upload, freezes the output at the next whole second (at least the source's min_duration, 4 seconds for Seedance 2.x) and sends that length to the provider, so the render matches the quote. Measured input plus frozen output must stay within 30 seconds, otherwise the request is rejected (400) and nothing is submitted.

4. Task state and result

  • The create response is 202 and returns the durable job with state and billing_status. 202 does not prove upstream success or settled billing.
  • Poll GET /v1/videos/edits/{id}. A task moves through queued, submitting, submitted, processing and finalizing to completed, failed or pending.
  • Send ?result=true only when you need the output URL. It re-queries the provider and never recharges or regenerates. The URL is temporary and provider-hosted; download and store it yourself if you need it long-term.
  • DELETE cancels only a task still queued before any billable upstream call and releases its reservation exactly once. The editing operator publishes no cancellation, so a job already in flight returns 409 and keeps its reservation for reconciliation.

5. Errors

StatusMeaning
400Invalid request: missing video_file_id, an empty prompt or an unknown model, 4K, or a reference value, count or duration outside the selected source's limits. Nothing is submitted or charged.
401Missing or invalid connection key.
403The key is not authorized for this source or capability.
409Idempotency or quote conflict, or a task that is no longer cancellable.
503No authorized, enabled and priced editing source matched, or the platform is temporarily unavailable.