Luma AI Text-to-Video
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.
Authentication​
All API requests require a Bearer token for authentication. Include your token in the Authorization
header of each request.
Pricing​
Each generation costs 500 000 UmamiAI Tokens
API Reference​
Ensure you replace "your-api-key"
with your actual API key before running the code.
Generate a video using Luma AI.​
Generates a video based on a prompt using Luma AI, allowing for video creation from textual descriptions.
path=/luma-ai/generations
method=post
Example​
Python
import requests
url = "https://api.umamiai.xyz/v1/luma-ai/generations"
payload = {
"aspect_ratio": "16:9",
"expand_prompt": True,
"user_prompt": "Flying jellyfish"
}
headers = {
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
JavaScript
const axios = require('axios');
const url = "https://api.umamiai.xyz/v1/luma-ai/generations";
const payload = {
aspect_ratio: "16:9",
expand_prompt: true,
user_prompt: "Flying jellyfish"
};
const headers = {
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY",
"content-type": "application/json"
};
axios.post(url, payload, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));
Curl
curl -L \
-X POST \
-H 'Authorization: Bearer YOUR_UMAMIAI_API_KEY'
-H 'Content-Type: application/json' \
'https://api.umamiai.xyz/v1/luma-ai/generations' \
-d '{"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"}'
Response
{
"created_at": "text",
"estimate_wait_seconds": "text",
"id": "text",
"liked": "text",
"prompt": "text",
"state": "text",
"video": {
"height": 0,
"width": 0,
"thumbnail": "text",
"url": "text"
}
}
List video generations by IDs in Luma AI.​
Returns a list of video generations by their IDs in Luma AI.
path=/luma-ai/generation
method=get
Python
import requests
response = requests.get(
"https://api.umamiai.xyz/v1/luma-ai/generation?ids=text",
headers={"Authorization": "Bearer YOUR_UMAMIAI_API_KEY"},
)
data = response.json()
Javascript
const response = await fetch('https://api.umamiai.xyz/v1/luma-ai/generation?ids=text', {
method: 'GET',
headers: {"Authorization": "Bearer YOUR_UMAMIAI_API_KEY"},
});
const data = await response.json();
Curl
curl -L \
-H 'Authorization: Bearer YOUR_UMAMIAI_API_KEY'
'https://api.umamiai.xyz/v1/luma-ai/generation?ids=text'
Response
[
{
"created_at": "text",
"estimate_wait_seconds": "text",
"id": "text",
"liked": "text",
"prompt": "text",
"state": "text",
"video": {
"height": 0,
"width": 0,
"thumbnail": "text",
"url": "text"
}
}
]
Example​
Python
import requests
url = "https://api.umamiai.xyz/v1/luma-ai/generation"
querystring = {"ids[0]":"4c9126f3-d9a6-4eaf-aa4c-b64b634f65bd"}
headers = {
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY",
"content-type": "application/json"
}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
JS
const axios = require('axios');
const url = "https://api.umamiai.xyz/v1/luma-ai/generation";
const params = {
"ids[0]": "4c9126f3-d9a6-4eaf-aa4c-b64b634f65bd"
};
const headers = {
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY",
"content-type": "application/json"
};
axios.get(url, { headers, params })
.then(response => console.log(response.data))
.catch(error => console.error(error));
Extend a video using Luma AI.​
Extends an existing video using Luma AI, creating additional content for video projects.
path=/luma-ai/generations/taskId/extend
method=post
Python
import requests
response = requests.post(
"https://api.umamiai.xyz/v1/luma-ai/generations/{taskId}/extend",
headers={"Content-Type":"application/json","Authorization": "Bearer YOUR_UMAMIAI_API_KEY"},
json={"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"}
)
data = response.json()
Javascript
const response = await fetch('https://api.umamiai.xyz/v1/luma-ai/generations/{taskId}/extend', {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY"
},
body: JSON.stringify({
"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"
}),
});
const data = await response.json();
Curl
curl -L \
-X POST \
-H 'Authorization: Bearer YOUR_UMAMIAI_API_KEY' \
-H 'Content-Type: application/json' \
'https://api.umamiai.xyz/v1/luma-ai/generations/{taskId}/extend' \
-d '{"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"}'
Response
{
"id": "text",
"created_at": "text",
"estimate_wait_seconds": "text",
"liked": "text",
"prompt": "text",
"state": "text",
"video": {
"height": 0,
"width": 0,
"thumbnail": "text",
"url": "text"
}
}
Example​
Python
import requests
url = "https://api.umamiai.xyz/v1/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_UMAMIAI_API_KEY",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
JS
const axios = require('axios');
const url = "https://api.umamiai.xyz/v1/luma-ai/generations/57a6cb80-6da0-49bd-b29a-3f089b9e55e4/extend";
const payload = {
aspect_ratio: "16:9",
expand_prompt: true,
user_prompt: "Flying jellyfish with a hat"
};
const headers = {
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY",
"content-type": "application/json"
};
axios.post(url, payload, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));