Task: Generate Video
Luma video generation API for creating short videos from prompt text.
Overview
- Method:
POST - Path:
/luma/generations - Content-Type:
application/json - Category: Video Models (Video) / Luma Video
Authentication
- Header:
Authorization: Bearer <token>
Request Parameters
JSON Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
| user_prompt | string | Yes | Prompt text |
| expand_prompt | boolean | No | Whether to enable prompt optimization |
| image_url | string | No | Reference image URL or Base64 |
| image_end_url | string | No | Keyframe image URL or Base64 |
| notify_hook | string | No | Callback URL |
| loop | boolean | No | Whether to loop the video end-to-end |
| aspect_ratio | string | No | Video aspect ratio, supports 1:1, 4:3, 3:4, 16:9, 9:16 |
Request Example
curl Example
bash
curl -X POST "https://api.gpt.ge/luma/generations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YOUR_TOKEN" \
-d '{
"user_prompt": "cat dance",
"expand_prompt": true,
"image_url": "https://example.com/reference.png",
"image_end_url": "https://example.com/keyframe.png",
"notify_hook": "https://example.com/hook",
"loop": true,
"aspect_ratio": "16:9"
}'JavaScript (fetch) Example
javascript
fetch('https://api.gpt.ge/luma/generations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({
user_prompt: 'cat dance',
expand_prompt: true,
image_url: 'https://example.com/reference.png',
image_end_url: 'https://example.com/keyframe.png',
notify_hook: 'https://example.com/hook',
loop: true,
aspect_ratio: '16:9'
})
})
.then(res => res.json())
.then(console.log)Python Example (requests)
python
import requests
resp = requests.post(
'https://api.gpt.ge/luma/generations',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
json={
'user_prompt': 'cat dance',
'expand_prompt': True,
'image_url': 'https://example.com/reference.png',
'image_end_url': 'https://example.com/keyframe.png',
'notify_hook': 'https://example.com/hook',
'loop': True,
'aspect_ratio': '16:9'
}
)
print(resp.json())Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Task ID |
| state | string | Task status |
| created_at | string | Task creation time |
| request | object | Request information |
| request.prompt | string | Original prompt |
| request.aspect_ratio | string | Requested aspect ratio |
Response Example (200)
json
{
"id": "e70fdf3c-ce95-4dd1-a967-220ce957aff5",
"state": "pending",
"created_at": "2024-12-24T18:01:25.319129Z",
"request": {
"prompt": "mermaid",
"aspect_ratio": "16:9"
}
}