# Video

> POST /v1/videos — asynchronous video generation: create a job, poll its status, download the video.

Video is generated asynchronously: you create a job, poll its status and
download the finished video. It works only with video models from the
[catalog](https://ai-seller.vibe-codes.ru/en/docs/models); in the examples below put their ID in place of
`VIDEO_MODEL_ID`.

## 1. Create a job

```bash
curl https://ai-seller.vibe-codes.ru/v1/videos \
  -H "Authorization: Bearer $AISELLER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "VIDEO_MODEL_ID",
    "prompt": "Waves crashing against a lighthouse at sunset",
    "seconds": 8
  }'
```

The response is a `202` with the job object:

```json
{"id": "vid_...", "object": "video", "model": "VIDEO_MODEL_ID", "status": "queued", "progress": 0, "created_at": 1790000000}
```

## 2. Poll the status

```bash
curl https://ai-seller.vibe-codes.ru/v1/videos/vid_... \
  -H "Authorization: Bearer $AISELLER_API_KEY"
```

Poll every few seconds until `status` becomes `completed` or `failed`. The
intermediate statuses are `queued` and `in_progress`.

```json
{"id": "vid_...", "object": "video", "status": "completed", "seconds": "8", "data": [{"url": "https://.../v1/videos/vid_.../content"}]}
```

A failed job has `status: "failed"` and `error.code: "video_generation_failed"`;
it is not billed.

## 3. Download the video

The link in `data[0].url` points to `GET /v1/videos/{id}/content`. Download it
with the same key:

```bash
curl -L https://ai-seller.vibe-codes.ru/v1/videos/vid_.../content \
  -H "Authorization: Bearer $AISELLER_API_KEY" \
  -o video.mp4
```

Before the job completes, this address returns `404 not_found`.

## Specifics

- **Billing** is for the video length in seconds from the provider's response
  (the requested seconds if it did not report it), once, when the job
  completes. No balance reserve is held while the video is generated.
- **Parameters:** `prompt`, `seconds` (or `duration`, `duration_seconds`),
  `size`, `aspect_ratio`, `resolution`, `negative_prompt`, `seed`; references —
  `image`, `images`, `video`, `input_reference`. The request body limit is
  70 MiB.
- A job is visible only to keys of your account; someone else's `id` returns
  `404 not_found`.
- Video jobs are not subject to the concurrent request limit.
