# 1. Create the video job
JOB=$(curl -s https://api.runcrate.ai/v1/videos \
-H "Authorization: Bearer rc_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-ai/Wan2.1-T2V-14B",
"prompt": "Ocean waves crashing on a rocky shore at sunset"
}')
VIDEO_ID=$(echo $JOB | jq -r '.id')
echo "Job created: $VIDEO_ID"
# 2. Poll for completion
while true; do
STATUS=$(curl -s https://api.runcrate.ai/v1/videos/$VIDEO_ID \
-H "Authorization: Bearer rc_live_YOUR_API_KEY" | jq -r '.status')
echo "Status: $STATUS"
if [ "$STATUS" = "completed" ]; then break; fi
if [ "$STATUS" = "failed" ]; then echo "Generation failed"; exit 1; fi
sleep 5
done
# 3. Download the video
curl https://api.runcrate.ai/v1/videos/$VIDEO_ID/download \
-H "Authorization: Bearer rc_live_YOUR_API_KEY" \
--output output.mp4
echo "Video saved to output.mp4"