> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elumenta.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Generation

> Generate videos from text or images using Kling, Luma, MiniMax, and MidJourney Video

<Note>
  Video generation is **always asynchronous**. You'll receive a generation ID immediately, then poll for the result. Processing typically takes 20–180 seconds depending on the model.
</Note>

## Request

<ParamField header="Authorization" type="string" required>
  `Authorization: Bearer nb_YOUR_API_KEY`
</ParamField>

<ParamField body="model" type="string" required>
  Video model slug. See [Video Models](/en/concepts/models#video-models).
</ParamField>

<ParamField body="prompt" type="string" required>
  Text description of the video to generate.
</ParamField>

<ParamField body="image_url" type="string">
  Starting image URL for image-to-video generation. When provided, the video animates from this image.
</ParamField>

<ParamField body="duration" type="integer" default="5">
  Video duration in seconds. Supported values: `5` or `10` (model-dependent).
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  Output aspect ratio: `16:9`, `9:16`, `1:1`
</ParamField>

<ParamField body="negative_prompt" type="string">
  Elements to avoid in the video.
</ParamField>

## Request Example

<CodeGroup>
  ```bash cURL — Text to Video theme={null}
  curl -X POST https://elumenta.ru/api/v2/generate \
    -H "Authorization: Bearer nb_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "kling-v2.1",
      "prompt": "A time-lapse of a blooming flower, macro photography, soft natural light",
      "duration": 5,
      "aspect_ratio": "16:9"
    }'
  ```

  ```bash cURL — Image to Video theme={null}
  curl -X POST https://elumenta.ru/api/v2/generate \
    -H "Authorization: Bearer nb_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "luma-ray2",
      "prompt": "The character slowly turns their head and smiles",
      "image_url": "https://example.com/portrait.jpg",
      "duration": 5
    }'
  ```

  ```python Python theme={null}
  import requests, time

  # Start generation
  res = requests.post(
      "https://elumenta.ru/api/v2/generate",
      headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
      json={
          "model": "kling-v2.1",
          "prompt": "A drone flyover of a futuristic city at night",
          "duration": 5,
          "aspect_ratio": "16:9"
      }
  )

  gen = res.json()
  gen_id = gen["id"]
  print(f"Generation started: {gen_id}")

  # Poll for result
  while True:
      status_res = requests.get(
          f"https://elumenta.ru/api/v2/generate/{gen_id}",
          headers={"Authorization": "Bearer nb_YOUR_API_KEY"}
      )
      status = status_res.json()
      
      if status["status"] == "completed":
          print(f"Video ready: {status['result_url']}")
          break
      elif status["status"] == "failed":
          print(f"Failed: {status['error']}")
          break
      
      time.sleep(5)
  ```
</CodeGroup>

## Initial Response (Pending)

```json theme={null}
{
  "id": 18500,
  "status": "pending",
  "model_slug": "kling-v2.1",
  "processing_ms": null,
  "created_at": "2026-03-08T12:05:00Z"
}
```

## Completed Response

```json theme={null}
{
  "id": 18500,
  "status": "completed",
  "model_slug": "kling-v2.1",
  "result_url": "https://storage.elumenta.ru/generations/18500.mp4",
  "tokens_spent": 26,
  "result_metadata": { "duration": 5, "width": 1920, "height": 1080 },
  "created_at": "2026-03-08T12:05:00Z",
  "completed_at": "2026-03-08T12:05:55Z"
}
```

## Model Comparison

| Model                             | Tokens | Speed              | Best For                |
| --------------------------------- | ------ | ------------------ | ----------------------- |
| `luma-flash2`                     | 15–93  | Fast (\~20–30s)    | Quick prototypes        |
| `kling-v2.1`                      | 26–94  | Medium (\~45–90s)  | Versatile, high quality |
| `minimax-video`                   | 88     | Medium (\~60s)     | Character consistency   |
| `luma-ray2`                       | 42–180 | Medium (\~60–120s) | Cinematic quality       |
| `mj-video-480p` / `mj-video-720p` | 50–320 | Slow (\~90s)       | Artistic style          |

Token cost depends on duration and resolution. Use [Calculate Price](/en/api-reference/models/calculate-price) for exact cost.
