# Grok Imagine Video 1.5 — /videos/generations

Grok Imagine Video 1.5 视频生成（异步任务）：时长 duration=4–15 的任意整数秒，分辨率 480P / 720P，画幅 size=16:9 / 9:16 / 1:1 / 4:3 / 3:4；带 image 即图生视频（最多 7 张，2 张及以上时最长 10 秒）。提交后返回任务号（HTTP 202），轮询 GET /v1/videos/jobs/{id} 直到 status=succeeded，结果在 data[0].url。按条计费：480P $0.30 / 720P $0.40（不传 resolution 默认 720P），同一档内最短与最长同价；失败全额退。

**端点:** `POST https://nezhagate.com/v1/videos/generations`

## 认证
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## 请求参数
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `model` | string | 是 | 模型 ID，此处为 grok-imagine-video-1.5。 |
| `prompt` | string | 是 | 视频内容、镜头与运动的描述。最长 5000 字节（UTF-8，中文一个字算 3 字节）。 |
| `duration` | integer | 否 | 时长秒数，4–15 的任意整数（默认 15，即最长的那个——按条计费，时长不影响价格）。也可写作 seconds。传 2 张及以上参考图时上限降为 10 秒。 |
| `resolution` | string | 否 | 分辨率：480P $0.30 / 720P $0.40（不传默认 720P）。价格只随分辨率变，不随时长变。 |
| `size` | string | 否 | 画幅：16:9 / 9:16 / 1:1 / 4:3 / 3:4（默认 16:9）。也可写作 aspect_ratio。本模型不支持 21:9。 |
| `image` | string | 否 | 图生视频：带参考图即走图生视频，可传公网 URL、data: URI 或 base64；不带则为文生视频。 |
| `images` | array | 否 | 多张参考图，最多 7 张。超过上限直接报错，不会截断。也可写作 reference_images。 |

## 请求示例
```bash
# 1) submit -> 202 {"id":"img_...","status":"queued"}
curl https://nezhagate.com/v1/videos/generations -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' -d '{"model": "grok-imagine-video-1.5", "prompt": "a paper crane unfolding over a misty lake", "duration": 15, "resolution": "720P", "size": "16:9"}'
# image-to-video: also pass  "image": "https://example.com/ref.png"
# 2) poll every ~5s until status=succeeded, then read data[0].url
curl https://nezhagate.com/v1/videos/jobs/img_3f9a...c2 -H 'Authorization: Bearer YOUR_API_KEY'
```

## 响应示例
```json
{
  "id": "img_3f9a...c2",
  "object": "video.generation.job",
  "status": "queued",
  "model": "grok-imagine-video-1.5"
}
```

## 异步视频任务（提交 → 轮询）
一个模型通过参数生成不同类型视频：tier=lite/fast/quality、resolution=720p/1080p/4k（1080p/4k 仅 quality 档）、size=16:9/9:16、duration=4s/6s/8s；带 image 参数即图生视频（以图为首帧）。提交后返回 HTTP 202 与任务号，轮询 GET /v1/videos/jobs/{id} 直到 status=succeeded，结果在 data[0].url（重托管 mp4，约 1-2 分钟）。按条计费、失败全额退。

```bash
# 提交任务（文生视频）
curl __BASE__/v1/videos/generations -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' -d '{"model": "grok-imagine-video-1.5", "prompt": "一只猫在日落时冲浪", "tier": "quality", "resolution": "1080p", "size": "16:9", "duration": "8s"}'
# 图生视频：额外传 image 参数（首帧参考图，公网 URL / data: / base64）
# 轮询结果
curl __BASE__/v1/videos/jobs/img_3f9a...c2 -H 'Authorization: Bearer YOUR_API_KEY'
```