> For the complete documentation index, see [llms.txt](https://docs.mozilla.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozilla.ai/api-reference/completion-1/video.md).

# Video

Job, output and parameter models for the video API

The job returned by `any_llm.video_generation()`, `any_llm.retrieve_video()` and `any_llm.poll_video()`, and the parameters a provider receives.

**Import:** `from any_llm.types.video import VideoJob, VideoOutput, VideoError`

### Job

`VideoJob.status` is one of `queued`, `in_progress`, `completed` or `failed`; `done` is `True` for the last two.

#### `VideoJob`

A video generation job.

Generation is slow, so every provider returns a job first. Poll it with `retrieve_video` until `done`; `outputs` is empty until then.

| Field          | Type                                                      | Description                                                                              |
| -------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `id`           | `str`                                                     | Provider-assigned job ID; pass it to `retrieve_video`.                                   |
| `model`        | `str`                                                     | Model that renders the video.                                                            |
| `status`       | `Literal['queued', 'in_progress', 'completed', 'failed']` | Where the job is. Providers' own words map onto these four.                              |
| `created_at`   | `int \| None`                                             | Unix timestamp of the request, when the provider reports it.                             |
| `completed_at` | `int \| None`                                             | Unix timestamp of completion, when the provider reports it.                              |
| `progress`     | `int \| None`                                             | Percent complete, when the provider reports it.                                          |
| `seconds`      | `int \| None`                                             | Length of the video in seconds, when the provider reports it.                            |
| `size`         | `str \| None`                                             | `WIDTHxHEIGHT` of the output, when the provider reports it.                              |
| `cost`         | `float \| None`                                           | What the provider charged for the job, in USD, when it reports it.                       |
| `tokens`       | `int \| None`                                             | The units the provider bills the job by, when it bills video by tokens and reports them. |
| `error`        | `VideoError \| None`                                      | Why a `failed` job failed.                                                               |
| `outputs`      | `list[VideoOutput]`                                       | The rendered videos; empty until `completed`.                                            |

#### `VideoOutput`

One generated video, as a URL, inline base64 data, or both.

| Field       | Type          | Description                                                                                              |
| ----------- | ------------- | -------------------------------------------------------------------------------------------------------- |
| `url`       | `str \| None` | Where the video can be fetched. Some providers' URLs need their credentials; `download_video` adds them. |
| `b64_data`  | `str \| None` | The video, base64-encoded, when the provider returns it inline.                                          |
| `mime_type` | `str`         | Media type of the video.                                                                                 |

#### `VideoError`

Why a video job failed.

| Field     | Type          | Description                                   |
| --------- | ------------- | --------------------------------------------- |
| `message` | `str`         | What went wrong, in the provider's words.     |
| `code`    | `str \| None` | The provider's error code, when it gives one. |

### Parameters

#### `VideoGenerationParams`

Parameters for video generation requests.

| Field              | Type                | Description                                                                                                               |
| ------------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `model_id`         | `str`               | The provider's own model ID, without a `provider:` prefix.                                                                |
| `prompt`           | `str`               | What the video shows.                                                                                                     |
| `seconds`          | `int \| None`       | Length of the video in seconds.                                                                                           |
| `size`             | `str \| None`       | `WIDTHxHEIGHT`, such as `1280x720`. Says both how sharp and what shape; not combined with `resolution` or `aspect_ratio`. |
| `resolution`       | `str \| None`       | How sharp, by short side: `480p`, `720p`, `1080p` or `4k`. Pair it with `aspect_ratio` for the shape.                     |
| `aspect_ratio`     | `str \| None`       | What shape, as `WIDTH:HEIGHT` such as `16:9` or `9:16`.                                                                   |
| `seed`             | `int \| None`       | Seed for reproducible generation.                                                                                         |
| `negative_prompt`  | `str \| None`       | What the video should not contain.                                                                                        |
| `reference_images` | `list[str] \| None` | Image URLs, provider file URIs or `data:` URLs the video takes its subjects or style from.                                |
| `reference_audios` | `list[str] \| None` | Audio URLs the video follows, for lip sync, beat-matched motion or a sound track.                                         |
| `reference_videos` | `list[str] \| None` | Video URLs or provider file URIs the video takes its motion, subjects or style from.                                      |
| `first_frame`      | `str \| None`       | Image the video starts from, in the same forms as `reference_images`.                                                     |
| `last_frame`       | `str \| None`       | Image the video ends on, in the same forms as `reference_images`.                                                         |
| `generate_audio`   | `bool \| None`      | Whether the video carries a sound track. `None` leaves the provider's default.                                            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mozilla.ai/api-reference/completion-1/video.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
