imagestringbắt buộc
First frame. JPEG, PNG or WebP URL.
heygen/heygen-video/image-to-videoHeyGen Video Image to Video animates a first-frame image into a 5-15 second video at up to 2K resolution.
Thử model
PNG, JPEG, WebP hoặc GIF · tối đa 20 MiB
Bạn muốn làm gì tiếp theo?
Chọn một ví dụ để nạp đầu vào và kết quả của nó vào playground.
{
"image": "https://static.sandbase.ai/examples/94899ae4-37d0-4620-ba7a-ef9556167062/input/4374abb0-8e3b-43b7-b3cf-44e962c720ad.png",
"prompt": "The rabbit looks around curiously, its ears twitch, then it hops toward the camera. Soft breeze in the grass."
}{
"image": "https://static.sandbase.ai/examples/543f913b-7360-4a9b-ab31-f1181ba8525a/input/96539bb1-0347-4611-bc77-48e917251d11.png",
"prompt": "The tiger slowly turns its head and lets out a low growl, slow cinematic dolly-in."
}HeyGen Video animates a first-frame image into a 5–15 second video at up to 2K resolution.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Motion, camera and sound. |
image | image URL, required | — | First frame. JPEG, PNG or WebP URL. The output follows its aspect ratio. |
resolution | 480p / 768p / 1080p / 2k | 768p | Output resolution; 1080p and 2k cost more. |
duration | 5–15 | 5 | Output length in seconds. |
Billed per output second: $0.02 at 480p, $0.036 at 768p, $0.10 at 1080p and 2k.
| Output | Price |
|---|---|
| 5s, 768p (default) | $0.18 |
| 5s, 480p | $0.10 |
| 5s, 1080p | $0.50 |
| 15s, 2k | $1.50 |
| Failed runs are not charged. |
Other HeyGen Video endpoints: heygen/heygen-video/text-to-video, heygen/heygen-video/reference-to-video.
Bắt đầu xây dựng
Gửi model này qua SandBase Unified Run API.
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "heygen/heygen-video/image-to-video",
"duration": 5,
"resolution": "768p"
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"Tạo một SandBase API key và đặt nó trong môi trường máy chủ của bạn. Tất cả request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key trên máy chủ. Không hiển thị trong mã trình duyệt hoặc commit vào repository.
POST tới /v1/run với model ID này và các đầu vào của nó. Ví dụ request ở trên bao gồm cả bước gửi và polling.
Dùng run ID được trả về để poll cho đến khi trạng thái là completed, failed hoặc timeout. Chỉ đọc đầu ra sau khi completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Cung cấp một URL tệp có thể truy cập công khai trong trường image, video hoặc audio của model. Các định dạng và giới hạn được hỗ trợ hiển thị bên cạnh từng input trong Playground.
Dùng điều khiển upload hoặc replace trên các trường image được hỗ trợ trong Playground. Trường URL video chấp nhận một video driving được host; điều này không đồng nghĩa hỗ trợ tải lên video.
imagestringbắt buộcFirst frame. JPEG, PNG or WebP URL.
promptstringbắt buộcDescribe the scene, action, camera and sound.
durationintegerOutput length in seconds (5-15).
Mặc định: 5
Tối thiểu: 5
Tối đa: 15
resolutionstringOutput resolution. 1080p and 2k cost more.
Mặc định: "768p"
Giá trị có thể dùng: "480p", "768p", "1080p", "2k"
{
"model": "heygen/heygen-video/image-to-video",
"duration": 5,
"resolution": "768p"
}Một run đã hoàn tất sẽ hiển thị kết quả trong output. Phần sau là ví dụ đã lưu của model, không phải một lần tạo mới.
[
{
"url": "https://static.sandbase.ai/examples/94899ae4-37d0-4620-ba7a-ef9556167062/output/c0274567-9113-4b52-a275-15cc2f133690.mp4"
}
]