Skip to main content
HungerG
Get Credits
Video Generation API Architecture

Seedance 2.0 & MAGI-2 Video API Template Reference

Production patterns for text-to-video and image-to-video endpoints—covering idempotency, async polling, fail-closed moderation, and cost-per-second budgeting.

1. Asynchronous Video Generation Pattern

Frontier video models take 45–90 seconds per clip and must never be called synchronously inside short edge timeouts:

  1. Pre-screen uploads (fail-closed): For image-to-video, validate MIME type (JPG/PNG/WebP ≤ 5 MB) and run nsfw-filter-2 before deducting credits or submitting to the video model.
  2. Submit once with Idempotency-Key: Generate a unique UUID per job so network retries never trigger duplicate upstream GPU billing.
  3. Receive signed callback + poll fallback: Verify webhook HMAC signatures on your backend and poll job status every 3–5 seconds as a fallback.
  4. Atomic credit refund on failure: If status resolves to failed, canceled, or expired, immediately refund 100% of deducted credits to the originating credit bucket.

2. Parameter Matrix (Seedance 2.0 vs MAGI-2 Reference)

Parameter Seedance 2.0 (Live on HungerG) MAGI-2 Reference API (Sand.ai)
Modalities text-to-video, image-to-video text-to-video, image-to-video, omni-reference (up to 20 items)
Resolution / FPS 480p, 720p, 1080p Up to 1080p @ 25fps
Duration 5s & 8s studio tiers 4s to 30s continuous
Native Audio generate_audio: true (foley, score, ambience) Single-stream native dialogue, foley & music
Pricing Baseline 10–80 credits ($1.07–$3.99 per std video) ~$0.08/s raw compute before retries & hosting

Generate copy-pasteable cURL, Python, and TypeScript snippets in our API Template Generator, or test prompts immediately in our Text-to-Video Studio.