# Create Grok Video

Create asynchronous videos from text, first and last frames, keyframes or reference images with grok-imagine-video-1.5.

- Source: https://www.unifyllm.com/docs/api-reference/create-grok-video/
- Language: en

## Endpoint

```http
POST https://api.unifyllm.top/v1/videos
```

Use the authentication and headers shown in the request examples. Content-Type: application/json

## Generation workflow

Creation is asynchronous. The create response contains a task rather than a video file.

- Call POST /v1/videos with your UnifyLLM API key and save the exact id from the response.

- Poll GET /v1/videos/{task_id} every 5–10 seconds while queued or in_progress.

- Once completed, inspect error for moderation blocks or other problems before downloading GET /v1/videos/{task_id}/content.

## Generation modes

| Mode | Input | Purpose |
| --- | --- | --- |
| Text to video | prompt | Generate from a text description |
| Image to video | prompt + image | Use an image as the first frame |
| Last frame | prompt + last_frame | Specify the ending image |
| First and last frames | prompt + image + last_frame | Lock the starting and ending frames |
| Keyframes | prompt + keyframes; optional first/last frames | Specify intermediate frames |
| Reference images | prompt + reference_images | Guide characters or style without locking exact frames |

## Parameters and media limits

- Use grok-imagine-video-1.5. A non-empty prompt is required in all modes.

- Requests using reference_images, last_frame or keyframes support at most 720p. Do not request 1080p for these modes.

- example.com image URLs are templates. Replace them with actual public images. Image objects use url, not file_id.

- Use at most 4 keyframes, strictly within (0, duration), in distinct 1/3-second slots.

## Parameters

| Field | Location | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- | --- |
| model | body | string | yes | Use grok-imagine-video-1.5. Your API key must have access to this model. | grok-imagine-video-1.5 | grok-imagine-video-1.5 |
| prompt | body | string | yes | Non-empty generation prompt. Required in every mode, including image, last-frame, keyframe and reference-image inputs. |  | A paper boat floats on a calm lake. Locked camera, soft daylight. |
| duration | body | integer | no | Video duration in seconds, from 1 through 15. Default: 8. |  | 3 |
| seconds | body | integer | no | Compatibility alias for duration. Prefer duration and do not send conflicting values. |  | 3 |
| resolution | body | string | no | 480p (default), 720p or 1080p. Requests using reference_images, last_frame or keyframes are limited to 720p. | 480p, 720p, 1080p | 480p |
| aspect_ratio | body | string | no | Video aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 or 5:2. | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 5:2 | 16:9 |
| generate_audio | body | boolean | no | Set false to disable audio generation. Omission uses the upstream default. |  | false |
| image | body | object | no | First-frame object, for example {"url":"https://..."}. Use a public HTTP(S) image URL or a complete image data URL. file_id is not supported. |  | {"url":"https://example.com/start.jpg"} |
| last_frame | body | object | no | Last-frame object, for example {"url":"https://..."}. Use alone or combine with image to lock both ends. Accepts a public image URL or a complete image data URL. |  | {"url":"https://example.com/end.jpg"} |
| keyframes | body | array | no | 1–4 keyframes, each shaped as {"image":{"url":"..."},"timestamp_s":1}. Timestamps must be strictly between 0 and duration and occupy distinct 1/3-second slots. |  | [{"image":{"url":"https://example.com/middle.jpg"},"timestamp_s":1}] |
| reference_images | body | array | no | 1–14 {"url":"https://..."} objects for visual guidance, such as characters or style. These do not lock exact frames. |  | [{"url":"https://example.com/character.jpg"},{"url":"https://example.com/style.jpg"}] |

## Text to Video

```json
{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-imagine-video-1.5",
    "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
    "duration": 3,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": false
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/videos",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"grok-imagine-video-1.5\",\n  \"prompt\": \"A paper boat floats on a calm lake. Locked camera, soft daylight.\",\n  \"duration\": 3,\n  \"resolution\": \"480p\",\n  \"aspect_ratio\": \"16:9\",\n  \"generate_audio\": false\n}")
)
response.raise_for_status()
print(response.json())
```

## Image to Video

```json
{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "image": {
    "url": "https://example.com/start.jpg"
  }
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "image": {
    "url": "https://example.com/start.jpg"
  }
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-imagine-video-1.5",
    "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
    "duration": 3,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": false,
    "image": {
      "url": "https://example.com/start.jpg"
    }
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/videos",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"grok-imagine-video-1.5\",\n  \"prompt\": \"A paper boat floats on a calm lake. Locked camera, soft daylight.\",\n  \"duration\": 3,\n  \"resolution\": \"480p\",\n  \"aspect_ratio\": \"16:9\",\n  \"generate_audio\": false,\n  \"image\": {\n    \"url\": \"https://example.com/start.jpg\"\n  }\n}")
)
response.raise_for_status()
print(response.json())
```

## Last Frame

```json
{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "last_frame": {
    "url": "https://example.com/end.jpg"
  }
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "last_frame": {
    "url": "https://example.com/end.jpg"
  }
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-imagine-video-1.5",
    "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
    "duration": 3,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": false,
    "last_frame": {
      "url": "https://example.com/end.jpg"
    }
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/videos",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"grok-imagine-video-1.5\",\n  \"prompt\": \"A paper boat floats on a calm lake. Locked camera, soft daylight.\",\n  \"duration\": 3,\n  \"resolution\": \"480p\",\n  \"aspect_ratio\": \"16:9\",\n  \"generate_audio\": false,\n  \"last_frame\": {\n    \"url\": \"https://example.com/end.jpg\"\n  }\n}")
)
response.raise_for_status()
print(response.json())
```

## First and Last Frames

```json
{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "image": {
    "url": "https://example.com/start.jpg"
  },
  "last_frame": {
    "url": "https://example.com/end.jpg"
  }
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "image": {
    "url": "https://example.com/start.jpg"
  },
  "last_frame": {
    "url": "https://example.com/end.jpg"
  }
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-imagine-video-1.5",
    "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
    "duration": 3,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": false,
    "image": {
      "url": "https://example.com/start.jpg"
    },
    "last_frame": {
      "url": "https://example.com/end.jpg"
    }
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/videos",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"grok-imagine-video-1.5\",\n  \"prompt\": \"A paper boat floats on a calm lake. Locked camera, soft daylight.\",\n  \"duration\": 3,\n  \"resolution\": \"480p\",\n  \"aspect_ratio\": \"16:9\",\n  \"generate_audio\": false,\n  \"image\": {\n    \"url\": \"https://example.com/start.jpg\"\n  },\n  \"last_frame\": {\n    \"url\": \"https://example.com/end.jpg\"\n  }\n}")
)
response.raise_for_status()
print(response.json())
```

## Keyframes

```json
{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "image": {
    "url": "https://example.com/start.jpg"
  },
  "keyframes": [
    {
      "image": {
        "url": "https://example.com/middle.jpg"
      },
      "timestamp_s": 1
    }
  ],
  "last_frame": {
    "url": "https://example.com/end.jpg"
  }
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "image": {
    "url": "https://example.com/start.jpg"
  },
  "keyframes": [
    {
      "image": {
        "url": "https://example.com/middle.jpg"
      },
      "timestamp_s": 1
    }
  ],
  "last_frame": {
    "url": "https://example.com/end.jpg"
  }
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-imagine-video-1.5",
    "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
    "duration": 3,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": false,
    "image": {
      "url": "https://example.com/start.jpg"
    },
    "keyframes": [
      {
        "image": {
          "url": "https://example.com/middle.jpg"
        },
        "timestamp_s": 1
      }
    ],
    "last_frame": {
      "url": "https://example.com/end.jpg"
    }
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/videos",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"grok-imagine-video-1.5\",\n  \"prompt\": \"A paper boat floats on a calm lake. Locked camera, soft daylight.\",\n  \"duration\": 3,\n  \"resolution\": \"480p\",\n  \"aspect_ratio\": \"16:9\",\n  \"generate_audio\": false,\n  \"image\": {\n    \"url\": \"https://example.com/start.jpg\"\n  },\n  \"keyframes\": [\n    {\n      \"image\": {\n        \"url\": \"https://example.com/middle.jpg\"\n      },\n      \"timestamp_s\": 1\n    }\n  ],\n  \"last_frame\": {\n    \"url\": \"https://example.com/end.jpg\"\n  }\n}")
)
response.raise_for_status()
print(response.json())
```

## Reference Images to Video

```json
{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "reference_images": [
    {
      "url": "https://example.com/character.jpg"
    },
    {
      "url": "https://example.com/style.jpg"
    }
  ]
}
```

### cURL

```bash
curl --request POST \
  --url 'https://api.unifyllm.top/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "grok-imagine-video-1.5",
  "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
  "duration": 3,
  "resolution": "480p",
  "aspect_ratio": "16:9",
  "generate_audio": false,
  "reference_images": [
    {
      "url": "https://example.com/character.jpg"
    },
    {
      "url": "https://example.com/style.jpg"
    }
  ]
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.unifyllm.top/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "grok-imagine-video-1.5",
    "prompt": "A paper boat floats on a calm lake. Locked camera, soft daylight.",
    "duration": 3,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": false,
    "reference_images": [
      {
        "url": "https://example.com/character.jpg"
      },
      {
        "url": "https://example.com/style.jpg"
      }
    ]
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import json
import requests

response = requests.post(
    "https://api.unifyllm.top/v1/videos",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json=json.loads("{\n  \"model\": \"grok-imagine-video-1.5\",\n  \"prompt\": \"A paper boat floats on a calm lake. Locked camera, soft daylight.\",\n  \"duration\": 3,\n  \"resolution\": \"480p\",\n  \"aspect_ratio\": \"16:9\",\n  \"generate_audio\": false,\n  \"reference_images\": [\n    {\n      \"url\": \"https://example.com/character.jpg\"\n    },\n    {\n      \"url\": \"https://example.com/style.jpg\"\n    }\n  ]\n}")
)
response.raise_for_status()
print(response.json())
```

## Response examples

### Task Queued — HTTP 200

```json
{
  "id": "task_example",
  "object": "video",
  "model": "grok-imagine-video-1.5",
  "status": "queued",
  "progress": 0
}
```

## Usage notes

- This channel supports Grok 1.5 generation, not video editing, extension, audio references, storage_options or custom output uploads.

- Save the exact id returned by creation and query its status instead of submitting creation again.

## Related endpoints

- [Get Grok Video](https://www.unifyllm.com/docs/api-reference/get-grok-video/)
- [Download Grok Video](https://www.unifyllm.com/docs/api-reference/download-grok-video/)
