cdance2.0-0807
Before use, press Access Basics to set
SHANHAI_BASE_URL(this site’s root address) andSHANHAI_API_KEY(this site’s token). The following command is suitable for Bash; the material example address must be replaced with a real address that can be downloaded directly.
Supports text, first frame, first and last frame, as well as pictures, videos, and audio references. Create, query and download using POST /v1/videos, GET /v1/videos/{task_id} and GET /v1/videos/{task_id}/content respectively.
request parameters
| Parameter | Type | Required | Value and behavior |
|---|---|---|---|
model |
The string | is | cdance2.0-0807. |
prompt |
String | Conditions required | Screen, action, lens and material usage; text can also be placed in content. Text and material cannot all be empty. |
content |
Array | Condition required | Material list, see the table below. |
seconds |
Integer or numeric string | No | 4 ~ 15 Seconds, or -1 Let the model decide automatically; 5 seconds if omitted. It is recommended to fill it in explicitly. |
resolution |
String | No | 480p, 720p, 1080p, 4k; default 720p. |
ratio |
String | No | Aspect ratio; for example, 16:9, 9:16, 1:1. The first frame mode gives priority to the same proportion as the material. |
generate_audio |
Boolean | No | true Generate sound, false Off; not a switch for uploading reference audio. |
watermark |
Boolean value | No | Whether to add a visible watermark; explicitly pass false when no watermark is required. |
seed |
Integer | No | Controls randomness; nonnegative integers can be used. When omitted, it is handled by the model, and the same seed is not guaranteed to be completely consistent. |
camera_fixed |
Boolean value | No | Fixed lens setting; the specific effects of different material modes are handled by the model. |
return_last_frame |
Boolean | No | The request returns the last frame; the video file is still downloaded through the content interface. |
reference material, first and last frames
type |
Content field | role |
Purpose |
|---|---|---|---|
text |
text |
Leave | blank for text description, and prompt choose one to fill in. |
image_url |
image_url.url |
first_frame |
First frame, maximum 1 frame. |
image_url |
image_url.url |
last_frame |
The last frame, up to 1 frame, must be provided at the same time. |
image_url |
image_url.url |
reference_image |
Reference pictures. |
video_url |
video_url.url |
reference_video |
Reference video. |
audio_url |
audio_url.url |
reference_audio |
Reference sound, rhythm or background music. |
Maximum 9 pictures, 3 videos, 3 audio clips, the total of the three types of materials is up to 15 items; the first and last frames are also included in the number of pictures. Audio references must be accompanied by pictures or videos, not just audio. Use "Picture 1", "Video 1" and "Audio 1" to quote similar materials in the order, and clarify the purpose of each material.
Local file and network address
Refer to audio and video to fill in the public network direct link that does not require login or additional request headers; do not fill in the local path, blob: or network disk preview page. Upload the local file to your own file storage first, then use its address; keep the address valid until the end of the task. When the file format, size and encoding are not acceptable, the material should be converted according to the error prompts.
Request Example
Text generation video
curl --fail-with-body "$SHANHAI_BASE_URL/v1/videos" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cdance2.0-0807",
"prompt": "红色陶瓷杯放在木桌上,镜头缓慢靠近。",
"seconds": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}'
first and last frame generation
{
"model": "cdance2.0-0807",
"prompt": "从首帧的空杯自然过渡到尾帧的果茶。",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/last.png"
},
"role": "last_frame"
}
],
"seconds": 5,
"resolution": "720p"
}
Common reference for pictures, videos and audios
curl --fail-with-body "$SHANHAI_BASE_URL/v1/videos" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cdance2.0-0807",
"prompt": "保留图片1中的杯子外观,参考视频1的镜头运动,音频1作为背景音乐。",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/cup.jpg"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/camera.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/music.mp3"
},
"role": "reference_audio"
}
],
"seconds": 8,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": true,
"watermark": false
}'
Query tasks and downloads
The submission interface is POST /v1/videos. Save id in the response and use GET /v1/videos/{task_id} to query; successful task creation does not mean that the video has been generated.
curl --fail-with-body "$SHANHAI_BASE_URL/v1/videos/TASK_ID" \
-H "Authorization: Bearer $SHANHAI_API_KEY"
queued is queued, in_progress is being generated, and the query will continue after a few seconds; use GET /v1/videos/{task_id}/content to download after completed. Check the returned error cause when failed is reached and stop polling. Downloads must first check the status code to avoid saving error messages as videos.
curl --fail-with-body "$SHANHAI_BASE_URL/v1/videos/TASK_ID/content" \
-H "Authorization: Bearer $SHANHAI_API_KEY" -o result.mp4
Replace TASK_ID with the real task number. After the network times out, existing tasks will be queried first to avoid repeated submissions. For a complete polling example, see General Description of Video Interface.
Get the last frame of the generated video
After setting return_last_frame:true in the request, when the task is successful and the last frame is returned, the result file list can be viewed through GET /v1/tasks/{task_id}/artifacts. The key of the last frame is last_frame, read GET /v1/tasks/{task_id}/artifacts/last_frame/content download; both interfaces use the local token. When the last frame is not returned, do not download the video address as an image.
encountered a problem
If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, task number, error time and error message. Do not provide the complete token.