> ## 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)。
