Create original short videos from text prompts. This endpoint streams results over SSE. Send Accept: text/event-stream
to receive incremental updates until completion.
Video generation typically takes 3–6 minutes to complete. Set your HTTP client timeout to at least 600–900 seconds to avoid premature disconnects.
Examples
import httpx, orjson
url = "https://api.electronhub.ai/v1/videos/generations"
payload = {
"model": "midjourney-video",
"prompt": "a playful cat",
# "size": "16:9", # optional
}
headers = {
"Accept": "text/event-stream",
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
}
with httpx.stream("POST", url, json=payload, headers=headers, timeout=900) as response:
for line in response.iter_lines():
if line:
data = orjson.loads(line)
if data:
if data.get("heartbeat"):
print("Pending...")
else:
print(line)
Enter your API key (starts with 'ek-')
SSE stream of video generation events
The response is of type string
.