Tip: Use the job_id returned to check the status of your video.
Request:
Copy
POST https://api.shuttleai.com/v1/video/generations/jobsContent-Type: application/jsonAuthorization: Bearer YOUR_API_KEY{ "prompt": "A cat playing piano in a jazz bar.", "model": "sora", "width": 480, "height": 480, "n_seconds": 5}
from shuttleai import ShuttleAIimport timeclient = ShuttleAI()video_response = client.video.generations.generate( prompt="A serene sunset over a calm ocean with gentle waves", model="sora", width=480, height=480, n_seconds=5)print(f"Video generation job created with ID: {video_response.id}")print(f"Initial status: {video_response.status}")job_id = video_response.idwhile True: status_response = client.video.generations.get_job_status(job_id) print(f"Job status: {status_response.status}") if status_response.is_completed: if status_response.first_video and status_response.first_video.video_url: print(f"Video generated successfully! URL: {status_response.first_video.video_url}") # Save the video to a file status_response.first_video.to_file("output_video.mp4") print("Video saved to output_video.mp4") else: print("No video URL available.") break elif status_response.has_failed: print("Video generation job failed.") break else: print("Job still processing, waiting...") time.sleep(5) # Wait before polling again