开发者 API 目前仍处于 Beta 阶段,接口可能随时调整,现阶段更适合个人测试与体验,暂不建议用于生产环境。
在线测试
用AI将照片转化为精彩视频 - 从静态图像创建动态视频内容。
POST /api/v1/image-to-video/submit → /queryAPI 仅向订阅用户开放。网站和 API 共用同一订阅积分余额。
查看订阅方案可选请求参数。请遵循表格所示的类型、默认值和可接受值。
必填请求参数。请遵循表格所示的类型和可接受值。
可选请求参数。请遵循表格所示的类型、默认值和可接受值。
可选请求参数。请遵循表格所示的类型、默认值和可接受值。
可选请求参数。请遵循表格所示的类型、默认值和可接受值。
#!/usr/bin/env bash
set -euo pipefail
SUBMIT_RESPONSE="$(curl --fail-with-body --silent --show-error -X POST "https://vidmage.ai/api/v1/image-to-video/submit" \
-H "Authorization: Bearer ${VIDMAGE_API_KEY}" \
-H "Content-Type: application/json" \
--data-raw '{
"firstFrameImageUrl": "https://vidmage.ai/assets/images/samples/blue-eyed-woman-sunlight.webp",
"prompt": "The subject gently turns toward the camera as a light breeze moves the hair and background leaves",
"duration": "5",
"ratio": "adaptive",
"resolution": "720p"
}')"
TASK_ID="$(printf '%s' "$SUBMIT_RESPONSE" | jq -er '.["taskId"]')"
while true; do
QUERY_RESPONSE="$(curl --fail-with-body --silent --show-error -X POST "https://vidmage.ai/api/v1/image-to-video/query" \
-H "Authorization: Bearer ${VIDMAGE_API_KEY}" \
-H "Content-Type: application/json" \
--data-raw "{\"taskId\":\"${TASK_ID}\"}")"
STATUS="$(printf '%s' "$QUERY_RESPONSE" | jq -r '(.status // .data.status // "") | ascii_downcase')"
case "$STATUS" in
success|succeeded|completed)
printf '%s' "$QUERY_RESPONSE" | jq -r '(.result // .["videoUrl"] // .data["videoUrl"] // empty)'
break
;;
failed|error)
printf '%s' "$QUERY_RESPONSE" | jq -r '(.message // .error // .data.error // "Task failed")' >&2
exit 1
;;
esac
sleep 5
done