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 金鑰,並將其設定在伺服器環境中。所有請求都使用 Bearer 驗證。
export SANDBASE_API_KEY="YOUR_API_KEY"請將金鑰保留在伺服器端,不要在瀏覽器程式碼中公開,也不要提交到儲存庫。
使用此模型 ID 及其輸入,向 /v1/run 發送 POST。上方的請求範例包含提交與輪詢。
使用回傳的執行 ID 持續輪詢,直到狀態為 completed、failed 或 timeout。只有在 completed 之後才讀取輸出。
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"在模型的 image、video 或 audio 欄位中傳入可公開存取的檔案 URL。支援格式與限制會顯示在每個 Playground 輸入欄位旁。
在 Playground 中支援的圖片欄位上使用上傳或取代控制項。影片 URL 欄位可接受託管的 driving video;它們不代表支援影片上傳。
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"
}已完成的執行會在輸出中顯示結果。以下為模型已儲存的範例,並非新的生成結果。
[
{
"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"
}
]