# Video

Video uses the OpenAI Sora format on `/v1/videos`. Generation is asynchronous: create a video, then poll it.

## Create

`POST /v1/videos` with JSON (or multipart). `model` is required. Common fields: `prompt`, `seconds` (a positive integer, as a string or number), `size` as `WIDTHxHEIGHT`, and `input_reference` (an image URL, or a file in multipart). Other fields are passed to the model's channel.

`model` takes a video model id from `GET /v1/models`, or the `group/model` form.

```bash
curl https://api.novapi.ai/v1/videos \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "MODEL_ID",
  "prompt": "Golden-hour drone shot over a misty mountain village, slow push-in",
  "seconds": "8",
  "size": "1280x720"
}'
```

Python (OpenAI SDK):

```python
from openai import OpenAI

client = OpenAI(base_url="https://api.novapi.ai/v1", api_key="sk-...")

video = client.videos.create(
    model="MODEL_ID",
    prompt="Golden-hour drone shot over a misty mountain village, slow push-in",
    seconds="8",
    size="1280x720",
)
print(video.id, video.status)  # poll client.videos.retrieve(id), then download the content
```

## The video object

Creating returns a video object immediately. Its `id` starts with `video_`. The task is charged when it is submitted.

```json
{
  "id": "video_<task-id>",
  "object": "video",
  "model": "MODEL_ID",
  "status": "queued",
  "progress": 0,
  "created_at": <unix-seconds>,
  "completed_at": null,
  "expires_at": null,
  "seconds": "8",
  "size": "1280x720",
  "error": null
}
```

## Poll

`GET /v1/videos/{id}` returns the same object with the current state.

| status | Meaning |
| --- | --- |
| `queued` | Accepted, not started. |
| `in_progress` | Generating. `progress` is a percentage. |
| `completed` | Done. `progress` is 100 and `url` holds the result (an extension field). |
| `failed` | `error.code` is `video_generation_failed`; `error.message` has the reason. |

```bash
curl https://api.novapi.ai/v1/videos/video_<task-id> \
  -H "Authorization: Bearer $API_KEY"

# when finished the object has "status": "completed", "progress": 100
# and a "url" field with the result.
```

## Download

`GET /v1/videos/{id}/content` redirects (302) to the finished file. Only `variant=video` is supported. Before completion it returns 404 with code `video_not_ready`.

```bash
curl -L https://api.novapi.ai/v1/videos/video_<task-id>/content \
  -H "Authorization: Bearer $API_KEY" \
  --output result.mp4
```

## Not available

There is no list or delete endpoint for videos, and no thumbnail or spritesheet variant. A video can only be read by the account that created it; any other id returns 404.

## Legacy response format

Keys that are on the legacy-format list still get the older MiniMax response contract from the same URLs. If your response does not look like the object above, that is the reason; contact support to move the key.

## See also
- [Video model reference](https://www.novapi.ai/docs/sora2)
