API v1

Generate a video

Requests for text to video, first frames, first and last frames, reference images and reference media.

View Markdown
On this page

Every case calls the same endpoint, POST /v1/video/generations; only the content items differ. The task, its reservation and its idempotency record are accepted together, and the API answers with 202 and the task ID while generation runs in the background. All parameters are on Create a video task.

Text to video

Put a single text item in content that describes the scene, the action and the camera.

IDEMPOTENCY_KEY=${IDEMPOTENCY_KEY:-$(uuidgen)}
printf '%s\n' "Save IDEMPOTENCY_KEY for retries: ${IDEMPOTENCY_KEY}" >&2
curl --request POST "${CHENVOYA_BASE_URL}/v1/video/generations" \
  --header "Authorization: Bearer ${CHENVOYA_API_KEY}" \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "dreamina-seedance-2-0-260128",
  "content": [
    {
      "type": "text",
      "text": "A paper boat crossing a moonlit lake."
    }
  ]
}'

First frame and last frame

Put each image in an image_url item with role set to first_frame or last_frame. With a single image you may leave out role and it becomes the first frame; with several images every one needs a role.

content
"content": [
  {"type": "text", "text": "A paper boat crossing a moonlit lake."},
  {"type": "image_url", "role": "first_frame", "image_url": {"url": "https://example.com/first.png"}},
  {"type": "image_url", "role": "last_frame", "image_url": {"url": "https://example.com/last.png"}}
]

Reference images

Set role to reference_image, with up to 9 images. This example references a registered asset:

IDEMPOTENCY_KEY=${IDEMPOTENCY_KEY:-$(uuidgen)}
printf '%s\n' "Save IDEMPOTENCY_KEY for retries: ${IDEMPOTENCY_KEY}" >&2
ASSET_ID_PATTERN='^ast-[0-9a-f]{32}$'
if [[ ! ${ASSET_ID} =~ ${ASSET_ID_PATTERN} || ${ASSET_ID} == *[!A-Za-z0-9._-]* ]]; then
  printf '%s\n' 'Set ASSET_ID to the ID from the creation response first.' >&2
  exit 1
fi
curl --request POST "${CHENVOYA_BASE_URL}/v1/video/generations" \
  --header "Authorization: Bearer ${CHENVOYA_API_KEY}" \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "dreamina-seedance-2-0-260128",
  "duration": 5,
  "ratio": "16:9",
  "resolution": "720p",
  "content": [
    {
      "type": "text",
      "text": "Animate the reviewed reference image."
    },
    {
      "type": "image_url",
      "role": "reference_image",
      "image_url": {
        "url": "asset://'"${ASSET_ID}"'"
      }
    }
  ]
}'

Reference video and audio

  • Reference videos use video_url items with role reference_video; reference audio uses audio_url items with role reference_audio.
  • Each clip lasts 2–15 seconds; the videos together and the audio clips together each stay within 15 seconds, with at most 3 videos and 3 audio clips.
  • Reference audio needs a reference image or video.
  • A reference video given as an HTTPS link reserves funds for 15 input seconds. Preparation checks the actual length: a task whose total is too long fails with input_duration_exceeded, the whole reservation is released and nothing is charged.

Media sources

Each image, video or audio item takes one of three sources:

SourceFormNotes
HTTPS linkhttps://…The platform downloads, checks and stores the file before generation; meanwhile the task is in preparing_assets. If preparation fails, the whole reservation is released and nothing is charged.
Registered assetasset:// and the asset IDRegister the asset first and reference it once it is active.
base64 data URIdata:image/png;base64,…Images in JPEG, PNG or WebP, smaller than 30 MB once decoded; audio in WAV or MP3, up to 15 MB and 2–15 seconds; not for video.

HTTPS links use port 443 and carry no user information, IP address or local host name, at most 2048 bytes. One request may combine HTTPS links and base64 data, but neither can be mixed with asset:// references.

Sound, aspect ratio and duration

  • generate_audio: whether to generate sound with the video; default false.
  • ratio: aspect ratio; default adaptive, chosen by the model from the input.
  • duration: 4–15 seconds; default 5.
  • resolution: default 720p; Seedance 2.0 Fast and Mini go up to 720p.
  • watermark, seed, return_last_frame: see Video models.

Large requests

A body can be up to 64 MiB. A body over 2 MiB must arrive within 120 seconds, and each team can send only a few large requests at the same time; when they are all in use the answer is 429 rate_limited: retry later with the same Idempotency-Key.

Next steps