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>"
}
'import requests
url = "https://api.electronhub.ai/v1/videos/generations"
payload = {
"model": "midjourney-video",
"prompt": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'midjourney-video', prompt: '<string>'})
};
fetch('https://api.electronhub.ai/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.electronhub.ai/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'midjourney-video',
'prompt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.electronhub.ai/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"midjourney-video\",\n \"prompt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.electronhub.ai/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"midjourney-video\",\n \"prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"midjourney-video\",\n \"prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"Videos
Video Generations
Generate videos from text prompts via Server-Sent Events (SSE)
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>"
}
'import requests
url = "https://api.electronhub.ai/v1/videos/generations"
payload = {
"model": "midjourney-video",
"prompt": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'midjourney-video', prompt: '<string>'})
};
fetch('https://api.electronhub.ai/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.electronhub.ai/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'midjourney-video',
'prompt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.electronhub.ai/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"midjourney-video\",\n \"prompt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.electronhub.ai/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"midjourney-video\",\n \"prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"midjourney-video\",\n \"prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<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)
curl -N -X POST "https://api.electronhub.ai/v1/videos/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
--max-time 900 \
-d '{
"model": "midjourney-video",
"prompt": "a playful cat",
"size": "16:9"
}'
Authorizations
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.
⌘I
