audiostring
URL of an audio file for the avatar to lip-sync to. When provided, overrides prompt and voice.
heygen/heygen-avatar4/image-to-videoHeygen Avatar4 is HeyGen's image-to-video AI model. Bring static images to life with fluid animation, consistent character motion, and professional-grade video output.
ลองใช้โมเดล
PNG, JPEG, WebP หรือ GIF · สูงสุด 20 MiB
ต้องการทำอะไรต่อ
เลือกตัวอย่างเพื่อโหลดอินพุตและผลลัพธ์ลงใน playground
{
"image": "https://static.sandbase.ai/examples/58f680f7-93d6-4f27-9255-0043d7b5c44c/input/48d5dacb-cf6b-4678-a54d-dd7bc01337fb.png",
"prompt": "Hey friends! Welcome to the GPU force podcast and today we are going to discuss about the rising GPU cost!"
}HeyGen Avatar 4: turn a single photo into a talking presenter, driven by a script or an audio track.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string | — | Script to speak. |
image | image URL, required | — | Photo of the presenter. JPEG, PNG, or WebP URL. |
audio | audio URL | — | Optional voice track. |
aspect_ratio | 16:9 / 9:16 / 4:5 / 5:4 / 1:1 | — | Output frame shape. |
voice | string | Melissa | Voice for the script. |
resolution | 360p / 480p / 540p / 720p / 1080p | 720p | Video resolution preset. |
talking_style | stable / expressive | stable | expressive adds more head and hand motion. |
$0.10 per output second; length follows the audio or the spoken script. The quote before submission assumes 5 seconds.
| Output | Price |
|---|---|
| 5s | $0.50 |
| 30s | $3.00 |
| 60s | $6.00 |
Failed runs are not charged.
Related: heygen/avatar5/digital-twin.
เริ่มสร้าง
ส่งโมเดลนี้ผ่าน 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-avatar4/image-to-video",
"image": "https://v3b.fal.media/files/b/0a90062c/A7EIviZqNxZ2HAs0yHeZ6_77a05b99-8588-4ffc-90aa-be7f9d34e9d3.png",
"voice": "Melissa",
"prompt": "Hey friends! Welcome to the GPU force podcast and today we are going to discuss about the rising GPU cost!",
"resolution": "720p",
"talking_style": "stable"
}
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"สร้าง SandBase API key และตั้งค่าไว้ในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอทั้งหมดใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ key ไว้บนเซิร์ฟเวอร์ อย่าเปิดเผยในโค้ดฝั่งเบราว์เซอร์หรือคอมมิตลง repository
POST ไปที่ /v1/run ด้วย model ID นี้และอินพุตของมัน ตัวอย่างคำขอด้านบนมีทั้งการส่งและการ polling
ใช้ run ID ที่ส่งกลับมาเพื่อ polling จนกว่าสถานะจะเป็น completed, failed หรือ timeout ให้อ่าน output หลังจาก completed เท่านั้น
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"ส่ง URL ไฟล์ที่เข้าถึงได้สาธารณะในช่อง image, video หรือ audio ของโมเดล รูปแบบและข้อจำกัดที่รองรับแสดงอยู่ข้างแต่ละอินพุตใน Playground
ใช้ตัวควบคุม upload หรือ replace ในช่องรูปภาพที่รองรับใน Playground ช่อง URL ของวิดีโอรองรับวิดีโอ driving ที่โฮสต์ไว้; ไม่ได้หมายความว่าสามารถอัปโหลดวิดีโอได้
audiostringURL of an audio file for the avatar to lip-sync to. When provided, overrides prompt and voice.
imagestringจำเป็นURL of the image to animate. The image should contain a clear face.
voicestringThe voice ID to use for the avatar.
ค่าเริ่มต้น: "Melissa"
promptstringThe text the avatar will speak
resolutionstringVideo resolution preset.
ค่าเริ่มต้น: "720p"
ค่าที่เป็นไปได้: "360p", "480p", "540p", "720p", "1080p"
aspect_ratiostringOutput aspect ratio. Omit to keep the source aspect ratio (falls back to 16:9 when it cannot be read).
ค่าที่เป็นไปได้: "16:9", "9:16", "4:5", "5:4", "1:1"
talking_stylestringTalking style: 'stable' for minimal movement, 'expressive' for more animation.
ค่าเริ่มต้น: "stable"
ค่าที่เป็นไปได้: "stable", "expressive"
{
"model": "heygen/heygen-avatar4/image-to-video",
"image": "https://v3b.fal.media/files/b/0a90062c/A7EIviZqNxZ2HAs0yHeZ6_77a05b99-8588-4ffc-90aa-be7f9d34e9d3.png",
"voice": "Melissa",
"prompt": "Hey friends! Welcome to the GPU force podcast and today we are going to discuss about the rising GPU cost!",
"resolution": "720p",
"talking_style": "stable"
}run ที่เสร็จสมบูรณ์จะแสดงผลลัพธ์ใน output ต่อไปนี้เป็นตัวอย่างที่บันทึกไว้ของโมเดล ไม่ใช่การสร้างใหม่
[
{
"poster": "https://static.sandbase.ai/examples/posters/a1f21fe6264568c9ddae.jpg",
"source": "heygen schema mirror",
"source_url": "https://heygen.example/",
"url": "https://static.sandbase.ai/examples/58f680f7-93d6-4f27-9255-0043d7b5c44c/output/3fac915a-6088-4da9-9af5-2ba18962809a.mp4"
}
]