# Create a video

> Start a video generation job from a prompt, a first frame, a last frame or reference images. Returns the job right away.

`POST https://api.getlykia.com/v1/videos`

Starts a video job and returns the job object at once with `status: "queued"`. Follow it with [`GET /videos/{id}`](https://www.getlykia.com/en/docs/api-reference/videos-get) and download the file with [`GET /videos/{id}/content`](https://www.getlykia.com/en/docs/api-reference/videos-content). Walkthrough: [Video generation](https://www.getlykia.com/en/docs/guides/video-generation).

## Request body

- `model` (string, required) — A video model id (for example `bytedance/seedance-1.0-pro`) or a preset such as `@video`. List video models with `GET /models?kind=video`.
- `prompt` (string, required) — What should happen in the video.
- `image` (string) — A first frame: a public `https://` URL or a data URI.
- `last_frame` (string) — A last frame, together with `image`, on models with `lastFrame`.
- `reference_images` (string\[]) — Up to 32 reference images, as the model allows.
- `duration` (number) — Length in seconds, within the model's `durations`. `duration_seconds` and `seconds` are read too.
- `aspect_ratio` (string) — From the model's `aspectRatios`.
- `resolution` (string) — From the model's `resolutions`.
- `audio` (boolean) — Sound on or off, for models where it can be chosen.
- `seed` (integer) — On models that support it.
- `provider_options` (object) — Provider-specific options from the model's allow-list.
- `models`, `provider`, `user`, `metadata` — As in [`POST /images/generations`](https://www.getlykia.com/en/docs/api-reference/images-generations).

## Example

**Request**

cURL

```bash
curl https://api.getlykia.com/v1/videos \
  -H "Authorization: Bearer $LYKIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bytedance/seedance-1.0-pro",
    "prompt": "Waves rolling onto a quiet beach at dusk, slow camera pan",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }'
```

Python

```python
import os

import requests

response = requests.post(
    "https://api.getlykia.com/v1/videos",
    headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
    json={
        "model": "bytedance/seedance-1.0-pro",
        "prompt": "Waves rolling onto a quiet beach at dusk, slow camera pan",
        "duration": 5,
        "resolution": "720p",
        "aspect_ratio": "16:9",
    },
    timeout=60,
)
response.raise_for_status()
job = response.json()
print(job["id"], job["status"])  # keep the id: it is how you follow the job
```

TypeScript

```typescript
const response = await fetch("https://api.getlykia.com/v1/videos", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.LYKIA_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "bytedance/seedance-1.0-pro",
    prompt: "Waves rolling onto a quiet beach at dusk, slow camera pan",
    duration: 5,
    resolution: "720p",
    aspect_ratio: "16:9",
  }),
});
if (!response.ok) throw new Error(`Lykia returned ${response.status}: ${await response.text()}`);

const job = (await response.json()) as { id: string; status: string };
console.log(job.id, job.status); // keep the id: it is how you follow the job
```

**Response (200)**

```json
{
    "id": "gen-1795463406-qOWSYdRnX7cEsv8q",
    "object": "video",
    "status": "queued",
    "progress": 0,
    "model": "bytedance/seedance-1.0-pro",
    "provider": "bytedance",
    "created_at": 1795463406,
    "completed_at": null,
    "expires_at": null,
    "duration_seconds": null,
    "params": {
        "duration": 5,
        "aspect_ratio": "16:9",
        "resolution": "720p",
        "image": false,
        "last_frame": false,
        "reference_images": 0
    }
}
```

The job object is described under [`GET /videos/{id}`](https://www.getlykia.com/en/docs/api-reference/videos-get). `params` summarises what you asked for; image inputs show only whether they were given.

## Errors

| Status | Code                      | When                                                                                      |
| ------ | ------------------------- | ----------------------------------------------------------------------------------------- |
| `400`  | `unsupported_input`       | An unsupported value (`metadata.param`), or an option combination that is not priced yet. |
| `400`  | `unsupported_model`       | The model does not make videos.                                                           |
| `402`  | `insufficient_credits`    | The balance, key limit or project budget cannot cover the job's reservation.              |
| `403`  | `platform_sales_disabled` | The provider is not offered on Lykia credits yet; add your own key for it.                |
| `403`  | `byok_only_no_key`        | The project only allows its own provider keys and has none for this model.                |
| `429`  | `media_queue_full`        | The project already has the most jobs Lykia lets it keep waiting.                         |

For example, a duration outside the model's range:

```json
{
    "error": {
        "message": "duration must be between 2 and 12 seconds for seedance-1-0-pro-250528",
        "type": "invalid_request_error",
        "code": "unsupported_input",
        "status": 400,
        "metadata": {
            "reason": "unsupported_input",
            "param": "duration"
        }
    }
}
```
