POST
/
videos
/
generations
Generate Videos
curl --request POST \
  --url https://api.electronhub.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "midjourney-video",
  "prompt": "<string>",
  "size": "16:9"
}'
"<string>"
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)

Authorizations

Authorization
string
header
required

Enter your API key (starts with 'ek-')

Body

application/json

Response

200 - text/event-stream

SSE stream of video generation events

The response is of type string.