Generate short video clips from text prompts.
Video Generation produces short clips from a text prompt. It runs asynchronously: submit a job, then poll until the clip is ready. It is billed per second of output video in DA, and clips are stored temporarily — download them promptly. The OpenAI SDK has no video resource, so call the endpoint directly with httpx.
import os
import httpx
import time
headers = {"Authorization": f"Bearer {os.environ['OPENDUNES_API_KEY']}"}
# Submit the generation job — responds 202 with a poll URL
resp = httpx.post(
"https://opendunes.com/v1/videos",
headers=headers,
json={
"model": "example-provider/video-model",
"prompt": "A time-lapse of sand dunes shifting under a clear Algerian sky, golden hour, cinematic.",
"duration": 6,
},
)
job = resp.json()
job_id = job["id"]
# Poll until terminal
while True:
status = httpx.get(
f"https://opendunes.com/v1/videos/{job_id}",
headers=headers,
).json()
if status["status"] == "completed":
print(status["unsigned_urls"][0]) # download with the same Authorization header
break
elif status["status"] == "failed":
print("Generation failed")
break
time.sleep(5)| Parameter | Description |
|---|---|
model | Video generation model slug, from GET /v1/videos/models. |
prompt | Text description of the desired video. |
duration | Seconds of video. The lengths a model takes are its supported_durations. |
Nothing is charged at submission: the wallet moves once, when the job completes. A failed or timed-out job charges nothing. The download link does not expire, the clip is kept until you delete it, and downloading is free. See the video API reference.