Text-to-Video v1 (legacy)
Overview
The Luma AI Dream Machine API allows developers to generate, retrieve, and extend AI-generated content using a variety of inputs. This API is particularly useful for creative applications, such as generating visual content from text prompts.
Each generation costs 500 000 AI/ML Tokens.
Setup your API Key
If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.
How to Make a Call
API Schemas
Generate Video
post
Authorizations
Body
modelstring · enumOptionalDefault:
ray-1-6
Possible values: aspect_ratiostring · enumRequiredExample:
The aspect ratio of the image
16:9
Possible values: expand_promptbooleanOptionalDefault:
Whether to expand the prompt
false
Example: true
image_end_urlstring · uriOptionalExample:
The URL for the end of the image
https://example.com/image-end.jpg
image_urlstring · uriOptionalExample:
The URL of the main image
https://example.com/main-image.jpg
user_promptstringRequiredExample:
The user-provided prompt for image generation
A beautiful sunset over the ocean
Responses
201Success
post
POST /luma-ai/generations HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 213
{
"model": "ray-1-6",
"aspect_ratio": "16:9",
"expand_prompt": true,
"image_end_url": "https://example.com/image-end.jpg",
"image_url": "https://example.com/main-image.jpg",
"user_prompt": "A beautiful sunset over the ocean"
}
201Success
No content
Example
import requests
url = "https://api.aimlapi.com/luma-ai/generations"
payload = {
"aspect_ratio": "16:9",
"expand_prompt": True,
"user_prompt": "Flying jellyfish"
}
headers = {
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Fetch Generations
get
Authorizations
Query parameters
idsanyRequired
Array of UUID strings or string with comma-separated UUID strings
Responses
200Success
get
GET /luma-ai/generation HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Accept: */*
200Success
No content
Example
import requests
url = "https://api.aimlapi.com/luma-ai/generation"
querystring = {"ids[0]":"4c9126f3-d9a6-4eaf-aa4c-b64b634f65bd"}
headers = {
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
"content-type": "application/json"
}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
Extend Video
Extend allows you to effortlessly add length to an existing video.
post
Authorizations
Path parameters
taskIdstringRequired
Body
all ofOptional
Responses
201Success
post
POST /v1/luma-ai/generations/{taskId}/extend HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 213
{
"model": "ray-1-6",
"aspect_ratio": "16:9",
"expand_prompt": true,
"image_end_url": "https://example.com/image-end.jpg",
"image_url": "https://example.com/main-image.jpg",
"user_prompt": "A beautiful sunset over the ocean"
}
201Success
No content
Example
import requests
url = "https://api.aimlapi.com/luma-ai/generations/57a6cb80-6da0-49bd-b29a-3f089b9e55e4/extend"
payload = {
"aspect_ratio": "16:9",
"expand_prompt": True,
"user_prompt": "Flying jellyfish with a hat"
}
headers = {
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Last updated
Was this helpful?