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

# Generate videos

> Create a video from a prompt with p-video.

`POST /v1/videos/generations` starts a video task.

```bash theme={null}
curl -sS 'https://one-api.ai/v1/videos/generations' \
  -H "Authorization: Bearer $ONE_API_TOKEN" \
  -d '{
    "model": "p-video",
    "prompt": "a kitten walking across a rooftop at night, city lights behind",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "9:16"
  }'
```

The call returns a task id straight away:

```json theme={null}
{ "code": 200, "data": [{ "task_id": "task_30f89ae89b9343f0f383d66cbf708b69", "status": "submitted" }] }
```

Then wait for it:

```bash theme={null}
curl -sS "https://one-api.ai/v1/tasks/task_30f89ae89b9343f0f383d66cbf708b69?wait=60" \
  -H "Authorization: Bearer $ONE_API_TOKEN"
```

When `status` is `completed`, the file is at `result.videos[0].url[0]`.

## Fields for `p-video`

| Field | Type | Default | Notes |
| - | - | - | - |
| `model` | string | required | `p-video` |
| `prompt` | string | required | Up to 2,500 characters |
| `duration` | integer | `5` | Length in seconds, 1 to 20 |
| `resolution` | string | `720p` | `720p` or `1080p` |
| `aspect_ratio` | string | `16:9` | `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3` or `1:1` |
| `draft` | boolean | `false` | A faster, lower-quality preview at a quarter of the price |
| `seed` | integer | random | Use the same seed and prompt to reproduce a video |

A field that is not in this table returns HTTP 400. Reference images and audio are not supported yet.

## Price

Priced per second of output.

| Mode | List price per second | Customer key, credits per second |
| - | - | - |
| 720p | \$0.02 | 21.894737 |
| 1080p | \$0.04 | 43.789474 |
| 720p draft | \$0.005 | 5.473684 |
| 1080p draft | \$0.01 | 10.947368 |

A 5-second 720p video is \$0.10 at list. The whole price is reserved when you create the task and refunded if it fails.

> [!TIP]
>
> Use `"draft": true` to test a prompt cheaply, then run it again without draft once you like the result. Pass the same `seed` to keep the composition close.

## Timing

A short draft takes about half a minute. Longer and higher-resolution videos take a few minutes. A task that has not finished after 20 minutes is failed and refunded.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.