Back to Case Studies
Full StackDeployed

Automated Video Production: Text-to-Video Pipeline with Smart Delivery

Client: Private ClientRegion: United StatesIndustry: Video / Content Automation
92%Success rate
$0.01Cost per video
3,840Videos/day (3 GPUs)
<1sAPI acknowledgment

Production-ready n8n API endpoint for AI video generation with async polling, timeout handling, and graceful degradation — 92% success rate, $0.009–0.012 cost per video, 3,840 videos/day capacity per 3-GPU setup.

The Problem

AI video generation takes 30 seconds to 5+ minutes. Synchronous HTTP requests time out at 30–120 seconds. Users needed immediate acknowledgment without waiting for completion. Without proper async handling: 40–60% request abandonment from timeouts, $500–1,000 monthly waste from orphaned GPU processes, and no way to handle concurrent requests.

The Solution

n8n webhook receives POST request with prompt, num_frames, num_inference_steps, and guidance_scale. Initializes a counter (check_count=0, max_attempts=12). Sends to RunPod FastAPI service which queues the job and returns a job_id immediately. Waits 5 seconds (catches 20–30% of fast completions). Polls /status/{job_id} endpoint. JavaScript increments counter. If status = 'completed', downloads binary video from /download/{job_id} and responds with success JSON including download URL. If not completed and check_count > 12 (3 minutes total: 5s + 12×15s), responds with graceful timeout JSON including a status URL. If not completed and attempts remain, waits 15 seconds and polls again. Progressive polling: 5s initial, 15s subsequent — balances responsiveness with server efficiency.

Tech Stack

n8nRunPodFastAPIPython

Results

  • 92% successful video generation rate with graceful degradation on the remaining 8%
  • API acknowledges requests in under 1 second even for 5-minute generation jobs
  • Progressive polling (5s initial, 15s subsequent) reduces API calls by 75% vs aggressive polling
  • Timeout handling provides status URL instead of hard failure — no lost requests
  • 3,840 videos per day capacity per 3-GPU setup at $0.009–0.012 per video all-in cost