# Video Generation API

Generate short videos from text prompts, or from a starting image, with the video model of your choice, and get each clip as a file link with its size, length, the exact model version, its maker, the options used and the exact cost of the job. You pay exactly what each video costs at the model's own rates.

**Pricing:** Metered: you pay exactly each call's cost at the selected model's rates (default Google: Veo 3.1 Lite: $0.08 per second (with audio); $0.05 per second (without audio); $0.05 per second (with audio 720p); $0.03 per second (without audio 720p)). Each model's rates are listed with the `model` parameter's options in the API schema.

**Endpoint:** `POST /v1/data/ai/videos/run`

**Auth:** `Authorization: Bearer mk_live_...`

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `prompts` | array | Yes | What happens in the video, one prompt per line. Each prompt is one video, one job and one row. |
| `model` | string | No | The video model. Pick from the list (popular models first). Each model shows its own rates, mostly per second of video at each resolution, and that is exactly what each video costs. |
| `duration` | integer | No | The clip length in seconds. Leave blank for the model's default. Only the lengths the selected model offers are accepted. |
| `resolution` | string | No | The video resolution, e.g. 480p or 720p. Leave blank for the model's default. |
| `aspectRatio` | string | No | The frame shape, e.g. 16:9 or 9:16. Leave blank for the model's default. |
| `startImage` | string | No | Optional public image URL used as the first frame, for image-to-video models. The same image starts every prompt's video. |

## Example

`?wait=true` holds the request open until the run finishes (up to 60s) and returns the rows inline: one request, no polling.

```bash
curl -X POST "https://api.mindcase.co/v1/data/ai/videos/run?wait=true" \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"params":{"prompts":["..."]}}'
```

```python
import requests

resp = requests.post(
    "https://api.mindcase.co/v1/data/ai/videos/run",
    params={"wait": "true"},
    headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
    json={"params": {
    "prompts": [
        "..."
    ]
}},
)
rows = resp.json()["data"]
```

## Longer runs

If the run is still going at the 60s ceiling you get back `{ job_id, status: "running" }` instead of rows (same if the result is over 100 rows; those come back `truncated`). Poll with that `job_id`:

```bash
# 1) check status
curl https://api.mindcase.co/v1/jobs/JOB_ID \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"

# 2) when status == completed, fetch the rows
curl https://api.mindcase.co/v1/jobs/JOB_ID/results \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"
```

Full API reference (auth, jobs, balance, SDKs, MCP): https://mindcase.co/skills.md

## Response columns

| Field | Display name | Type |
|-------|--------------|------|
| `id` | ID | text |
| `prompt` | Prompt | text |
| `startImage` | Start Image | text |
| `fileUrl` | File URL | text |
| `mimeType` | MIME Type | text |
| `width` | Width | number |
| `height` | Height | number |
| `durationSeconds` | Duration (Seconds) | number |
| `model` | Model | text |
| `provider` | Provider | text |
| `duration` | Requested Duration | number |
| `resolution` | Resolution | text |
| `aspectRatio` | Aspect Ratio | text |
| `costUsd` | Cost (USD) | number |
| `error` | Error | text |
| `createdAt` | Created At | datetime |
