gen4_aleph
Overview
This is a video-to-video model capable of either modifying the input video or generating the next shot in a story that begins in the input and continues based on your prompt. You can define camera angles and movements, alter the plot, change character appearances, or adjust the environment.
How to Make a Call
API Schemas
Video Generation
You can generate a video using this API. In the basic setup, you need only a video URL and a prompt.
A HTTPS URL pointing to a video or a data URI containing a video
The text description of the scene, subject, or action to generate in the video.
The length of the output video in seconds.
5
Possible values: The width and height of the video
1280:720
Possible values: Varying the seed integer is a way to get different results for the same other request parameters. Using the same value for an identical request will produce similar results. If unspecified, a random number is chosen.
POST /v2/generate/video/runway/generation HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 185
{
"model": "runway/gen4_aleph",
"video_url": "https://example.com",
"prompt": "text",
"duration": 5,
"frame_size": "1280:720",
"seed": 1,
"references": [
{
"type": "image",
"url": "https://example.com"
}
]
}
{
"id": "a12b3456-7c89-0de1-23f4-g567d584f98d",
"status": "queued"
}
Retrieve the generated video from the server
After sending a request for video generation, this task is added to the queue. This endpoint lets you check the status of a video generation task using its id
, obtained from the endpoint described above.
If the video generation task status is complete
, the response will include the final result — with the generated video URL and additional metadata.
Generation ID
a12b3456-7c89-0de1-23f4-g567d584f98d
GET /v2/generate/video/runway/generation HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Accept: */*
{
"id": "a12b3456-7c89-0de1-23f4-g567d584f98d",
"status": "queued",
"video": [
"https://example.com"
],
"error": "text"
}
Full Example: Generating and Retrieving the Video From the Server
Let’s take a video of our running raccoon and ask Aleph to add a small fairy riding on its back. Here’s the prompt we can use:
"
Add a small fairy as a rider on the raccoon’s back. She must have a black-and-golden face and a cloak in the colors of a dark emerald tropical butterfly with bright blue shimmering spots.
"
We combine both methods above in one program: first it sends a video generation request to the server, then it checks for results every 10 seconds.
Don’t forget to replace <YOUR_AIMLAPI_KEY>
with your actual AI/ML API key from your API Key management page — in both places in the code!
import requests
import time
# replace <YOUR_AIMLAPI_KEY> with your actual AI/ML API key
api_key = "<YOUR_AIMLAPI_KEY>"
base_url = "https://api.aimlapi.com/v2"
# Creating and sending a video generation task to the server
def generate_video():
url = f"{base_url}/generate/video/runway/generation"
headers = {
"Authorization": f"Bearer {api_key}",
}
data = {
"model": "runway/gen4_aleph",
"video_url":"https://zovi0.github.io/public_misc/kling-v2-master-t2v-racoon.mp4",
"prompt":'''
Add a small fairy as a rider on the raccoon’s back. She must have a black-and-golden face and a cloak in the colors of a dark emerald tropical butterfly with bright blue shimmering spots.
'''
}
response = requests.post(url, json=data, headers=headers)
if response.status_code >= 400:
print(f"Error: {response.status_code} - {response.text}")
else:
response_data = response.json()
print(response_data)
return response_data
# Requesting the result of the task from the server using the generation_id
def get_video(gen_id):
url = f"{base_url}/generate/video/runway/generation"
params = {
"generation_id": gen_id,
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.get(url, params=params, headers=headers)
# print("Generation:", response.json())
return response.json()
def main():
# Running video generation and getting a task id
gen_response = generate_video()
gen_id = gen_response.get("id")
print("Generation ID: ", gen_id)
# Trying to retrieve the video from the server every 10 sec
if gen_id:
start_time = time.time()
timeout = 1800
while time.time() - start_time < timeout:
response_data = get_video(gen_id)
if response_data is None:
print("Error: No response from API")
break
status = response_data.get("status")
print("Status:", status)
if status == "waiting" or status == "active" or status == "queued" or status == "generating":
print("Still waiting... Checking again in 10 seconds.")
time.sleep(10)
else:
print("Processing complete:/n", response_data)
return response_data
print("Timeout reached. Stopping.")
return None
if __name__ == "__main__":
main()
Processing time: ~3 min 30 sec. Original: 1280×720 Low-res GIF preview:


Last updated
Was this helpful?