Skip to content

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

FieldTypeRequiredDescription
user_promptstringYesPrompt text
expand_promptbooleanNoWhether to enable prompt optimization
image_urlstringNoReference image URL or Base64
image_end_urlstringNoKeyframe image URL or Base64
notify_hookstringNoCallback URL
loopbooleanNoWhether to loop the video end-to-end
aspect_ratiostringNoVideo 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

FieldTypeDescription
idstringTask ID
statestringTask status
created_atstringTask creation time
requestobjectRequest information
request.promptstringOriginal prompt
request.aspect_ratiostringRequested 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"
  }
}