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

# Grok Video 1.5 Preview 视频生成

> 使用 grok-video-1.5-preview 将 1 张参考图生成 10 秒或 15 秒视频

* 仅支持图生视频，不支持文生视频。
* 必须传入且仅能传入 1 张公网参考图 URL。
* 支持 `10` 秒和 `15` 秒视频。
* 画面比例仅支持 `16:9` 和 `9:16`。
* 异步任务 API：提交后使用任务 ID 查询视频生成状态。

<Warning>
  不要直接传入 base64 图片数据。请先使用 [上传图片接口](../../uploads/images) 上传本地图片，再将返回的公网 URL 放入 `images`。
</Warning>

## Authorizations

<ParamField header="Authorization" type="string" required>
  所有接口均需要 Bearer Token 认证。

  ```text theme={null}
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" default="grok-video-1.5-preview" required>
  固定使用 `grok-video-1.5-preview`。
</ParamField>

<ParamField body="prompt" type="string" required>
  描述参考图需要生成的动态效果、镜头运动和视觉方向。
</ParamField>

<ParamField body="images" type="string[]" required>
  传入且仅传入 1 个公网图片 URL。

  * 最少：`1`
  * 最多：`1`
  * 支持 URL 协议：`http://`、`https://`
</ParamField>

<ParamField body="seconds" type="string" default="10">
  视频时长。

  支持值：`"10"`、`"15"`
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  视频画面比例。

  支持值：`16:9`、`9:16`
</ParamField>

## Pricing

| 时长    | 价格                |
| ----- | ----------------- |
| `10s` | `$0.10 / request` |
| `15s` | `$0.15 / request` |

## Response

<ResponseField name="id" type="string">
  用于查询任务状态的任务 ID。
</ResponseField>

<ResponseField name="object" type="string">
  对象类型，固定为 `generation.task`。
</ResponseField>

<ResponseField name="model" type="string">
  本次任务使用的模型名。
</ResponseField>

<ResponseField name="status" type="string">
  任务状态：`queued`、`in_progress`、`completed` 或 `failed`。
</ResponseField>

## 创建视频任务

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://toapis.com/v1/videos/generations \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "grok-video-1.5-preview",
      "prompt": "将这张产品图生成电影感商业视频，轻微镜头推进",
      "images": ["https://example.com/product.jpg"],
      "seconds": "10",
      "aspect_ratio": "16:9"
    }'
  ```

  ```python Python theme={null}
  import requests

  task = requests.post(
      "https://toapis.com/v1/videos/generations",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
      },
      json={
          "model": "grok-video-1.5-preview",
          "prompt": "将这张产品图生成电影感商业视频",
          "images": ["https://example.com/product.jpg"],
          "seconds": "15",
          "aspect_ratio": "16:9",
      },
  ).json()

  print(task["id"])
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "video_abc123def456",
    "object": "generation.task",
    "model": "grok-video-1.5-preview",
    "status": "queued",
    "progress": 0,
    "created_at": 1768380224,
    "metadata": {}
  }
  ```
</ResponseExample>

## 查询任务状态

使用返回的 `id` 调用 [视频任务状态接口](../../tasks/video-status)。
